Code style query: multiple assignments in if/elif tree
Steven D'Aprano
steve at pearwood.info
Tue Apr 1 03:29:53 EDT 2014
On Tue, 01 Apr 2014 17:55:32 +1100, Chris Angelico wrote:
> On Tue, Apr 1, 2014 at 5:13 PM, Ian Kelly <ian.g.kelly at 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,
We're talking deceleration, so it actually decreases linearly until it
reaches minimum :-)
>> 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.
Concave upwards, since we're decelerating.
>> 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.
Integral of the line segment is greater 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?
I thought that there was a chance that there might be, but it turns out,
not so much. There is a difference, but for the purposes of the
simulation it probably doesn't matter. If you were trying to land a
spacecraft on Mars, that's a different story...
--
Steven
More information about the Python-list
mailing list