Numerical representation
Jon Herman
jfc.herman at gmail.com
Mon Mar 7 13:50:21 EST 2011
Sorry Robert, I'd missed your post when I just made my last one. The output
I am getting in Python looks as follows:
array([ 9.91565050e-01, 1.55680112e-05, -1.53258602e-05,
-5.75847623e-05, -9.64290960e-03, -8.26333458e-08])
This is the final state vector, consisting of 6 states (postion and
velocity), although this isn't really relevant right now.
In MATLAB, using the same process for the RKF78, I get the following output:
Xend =
Columns 1 through 3
9.915755153307796e-001 3.592556838089922e-016
-1.523933534321440e-005
Columns 4 through 6
-7.175069559491303e-015 -9.624755221500220e-003
1.289789641929434e-017
As you can see, the results are close but there is a big difference in
precision (the 2nd, 4th and 6th entries are supposed to be zero under the
intial and final conditions I am running).
See also the post I just made where you can see the Python code I am using
(MATLAB code is identical but translated)
This is for a fixed timestep in both Python and Matlab. If I let the code
run with an identical method for timestep correction (based on a tolerance),
Python will use a timestep approximately 10^5 SMALLER than Matlab uses. So
I'm really sure it's not a representation issue, but actually a precision
issue.
Thanks for any advice!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110307/a6e38351/attachment-0001.html>
More information about the Python-list
mailing list