32 bit or 64 bit?

Peter Otten __peter__ at web.de
Sun Jun 15 13:52:56 EDT 2008


ram.rachum at gmail.com wrote:

> I have a physical system set up in which a body is supposed to
> accelerate and to get very close to lightspeed, while never really
> attaining it. After approx. 680 seconds, Python gets stuck and tells
> me the object has passed lightspeed. I put the same equations in
> Mathematica, again I get the same mistake around 680 seconds. So I
> think, I have a problem with my model! Then I pump up the
> WorkingPrecision in Mathematica to about 10. I run the same equations
> again, and it works! At least for the first 10,000 seconds, the object
> does not pass lightspeed.

That the values are possible doesn't mean that you can trust them.

> I concluded that I need Python to work at a higher precision.

How is WorkingPrecision defined? Python floats have about 16 significant
digits in base 10, so at first glance I would guess that you switched to
a /lower/ precision.

But I've come to agree with Christian that it would be good to show your
model to a physics and/or numerical maths expert. Perhaps you can find a
way for the errors to cancel out rather than accumulate.

Peter




More information about the Python-list mailing list