Let's Imagine such a situation.
A man is walking for the first hour with a speed of $4km/h$.
The next hour he is jogging, with the speed of $9km/h$
Finally, after two hours, he starts to run, with the speed of $12km/h$
As one might expect, I want to calculate the distance which has been travelled after given time in hours $t$.
My approach to solve such a problem was to first determine, how long has the runner been going.
If it was less than one hour, his distance would be $t*V_{0}$.
If it was more than one hour, but less than two, it would be $V_{o}+(t-1)V_{1}$
Finally, if he has been going for more than two hours: $V_{0}+V_{1}+(t-2)V_{2}$
This way of doing calculations is valid and works, but I am looking for a better way which I guess must exist.
Is there any way to describe distance with a function of variable $(t)$ which is described by a single formula(Instead of three like right now)?
If it is not possible, can this be proven mathematically?
Say I have two runners, both have their distances defined by a picewise function. One of the runners starts later than the first one, but generally his average speed is higher. To calculate time after they will meet I have to consider many cases, that's why I'm looking for a faster way
– Karol Szustakowski Sep 22 '18 at 11:06