0

I have a list of lists wherein the first element is $x$ , second element is $y$ and last element is speed. How do I calculate the total dist traveled?. My data looks like this:

[32,22,0];[33,26,20];[31,25,26];[30,21,33];[29,20,21];[27,18,15]

I know about the variation of the Pythagoras theorem , but AFAIK , that is only for a 2 pairs of $x$ and $y$ coordinated and not multiple.

user860374
  • 4,131
letsc
  • 101
  • I dint realize this was a tough question. I though it was just my extremely poor math skills. – letsc Nov 19 '14 at 23:20
  • Is the assumption that you travel in a straight line from point to point, or does the velocity matter and that you have a limitation in the ability to change direction at velocity? – Dijkgraaf Nov 20 '14 at 01:14

1 Answers1

1

Without a turning ratio limitation you can't use the speed to determine the curved distance, so it would be a straight line calculation between points.

The variation on the Pythagoras theorem which I believe you refer to is

$$d((x_1, y_1),(x_2, y_2)) = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 }$$

So to work out the distance for a series of points you just need to add the distances between the sets of points, so your formula becomes.

$$d((x_1, x_2),(x_2, y_2),(x_3,y_3),..,(x_n,y_n)) = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} + \sqrt{(x_3-x_2)^2 + (y_3-y_2)^2} + .. + \sqrt{(x_n-x_p)^2 + (y_n-y_p)^2} $$

Where n is the number of points and p = n -1

Dijkgraaf
  • 180