On Tue, Apr 1, 2014 at 12:55 AM, Chris Angelico <ros...@gmail.com> wrote: > On Tue, Apr 1, 2014 at 5:13 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >> Then your computation is incorrect and will systematically >> underestimate the stopping distance. Assuming for simplicity that the >> acceleration actually increases linearly until it reaches maximum, >> picture the velocity graph between, say, t=0 and t=1s. You are >> modeling it as a straight line segment. However, it would actually be >> part of a quadratic curve connecting the same points, convex upwards. >> The line segment is short-cutting the curve between the two points. >> The distance traveled is the integral of the curve, and it is easy to >> see that the integral of the line segment is less than the integral of >> the actual curve. > > .... great. > > Okay. I never studied calculus, so this is beyond my expertise. Is > this going to make a majorly significant difference to the end result? > If so, I guess the code's going to have to be a whole lot more > sophisticated, which means I need to learn a whole lot more maths in > order to write it. And I'm still trying to find time to get familiar > with systemd (having jumped on the Upstart bandwagon and now find > myself backing a losing horse, if you'll forgive a mixed metaphor) and > Cython (just need an excuse for that one).
Assuming the stated acceleration averages are correct, we can put an upper bound on the error. Draw a rectangle bounding the two consecutive points on the velocity graph. Given that the actual velocity decreases monotonically (which should be a safe assumption), that curve must be contained within this rectangle. Given that the deceleration also increases monotonically, we can also say that the curve must be contained within the upper triangle of that rectangle, as bisected by the straight line segment of the constant average acceleration version. The area of this triangle is 1s * 0.2 m/s / 2 = 0.1m. The area of the same triangle between t=1s and t=2s is 1s * 0.425 m/s / 2= 0.2125 m. Summing those, the upper bound for the error is only 0.3125 m. -- https://mail.python.org/mailman/listinfo/python-list