Math novice here. What would be a mathematical approach to find when the next event will be if it happens every 1008 hours after the first event of 28224 hours.
Background is a hardware failure that gets triggered at 28224 hours of power_on and will occur again every 1008 hours.
Looking for a function that would give X hours til next event. Easy enough to find things that are under 28224 hours but given for example 38300 hours, would output 4 hours remaining.
I was using this but it only works for numbers greater than 28224.
1008 - (38300 mod 1008) = 4
Is a way possible that would work with all numbers not just ones greater than 28224?
CodePudding user response:
In pure math, you need what's called a step function. Most people won't recognize the symbols for that so you're better off using words to explain your if/then situation.
In Excel, it's easier.
=IF(A1<28224, 28224 - A1,1008 - MOD(A1, 1008)
where A1
is the time, in hours.
In computer languages it's simple to put an if/then within a function as well... but that's because it's a language that computers (and others who know the language) can easily recognize. In pure math however, there are ways to write it, but if it's using a nomenclature a few people will understand how to read then what's that worth? Just use words.