I have a home trainer that is connected to an application that I am writing which needs to calculate a distance traveled given the speeds that the trainer is sending.
As such, every second, the trainer sends the instantaneous speed of the rider.
Example:
At Second 0: 10 km/h At Second 1: 15 km/h At Second 2: 12 km/h
..
Again, all that I receive are the speeds.
Each second, I need to calculate the total distance traveled.
Example: At second 1, I should know how far the rider has traveled (knowing the speeds from Second 0 and Second 1). At second 2, again, I would need to know how far the rider has traveled (knowing the speed at Second 1 and at Second 2) and so on.
What would be the correct way to at least approximate it?