I am having a problem with odeint. My integration runs o.k. if I choose a fairly short time interval, but when I set the maximum value for my t vector higher than about 1 second, I get this message: In [178]: run sweptsine_ode.py lsoda-- at t (=r1), too much accuracy requested for precision of machine.. see tolsf (=r2) ls in above, r1 = 0.5448183650273E+00 r2 = NAN Excess accuracy requested (tolerances too small). Run with full_output = 1 to get quantitative information. Running with fulloutput produces: {'hu': array([ 0.00020682, 0.00043534, 0.00043534, ..., 0. , 0. , 0. ]), 'imxer': -1267232872, 'leniw': 23, 'lenrw': 68, 'message': 'Excess accuracy requested (tolerances too small).', 'mused': array([1, 1, 1, ..., 0, 0, 0]), 'nfe': array([19, 27, 31, ..., 0, 0, 0]), 'nje': array([0, 0, 0, ..., 0, 0, 0]), 'nqu': array([2, 3, 3, ..., 0, 0, 0]), 'nst': array([ 9, 13, 15, ..., 0, 0, 0]), 'tcur': array([ 0.00106956, 0.00235387, 0.00322454, ..., 0. , 0. , 0. ]), 'tolsf': array([ 7.88983883e-314, 7.88983883e-314, 7.88983883e-314, ..., 0.00000000e+000, 0.00000000e+000, 0.00000000e+000]), 'tsw': array([ 0., 0., 0., ..., 0., 0., 0.])} The script is attached and should be self contained. Messing with atol and rtol doesn't seem to help, so I don't know what the message about requested accuracy means. Any help/direction in fixing this would be appreciated. Thanks, Ryan
Ryan Krauss wrote:
I am having a problem with odeint. My integration runs o.k. if I choose a fairly short time interval, but when I set the maximum value for my t vector higher than about 1 second, I get this message:
In [178]: run sweptsine_ode.py lsoda-- at t (=r1), too much accuracy requested for precision of machine.. see tolsf (=r2) ls in above, r1 = 0.5448183650273E+00 r2 = NAN Excess accuracy requested (tolerances too small). Run with full_output = 1 to get quantitative information.
<snip>
The script is attached and should be self contained. Messing with atol and rtol doesn't seem to help, so I don't know what the message about requested accuracy means.
Any help/direction in fixing this would be appreciated.
Thanks,
Ryan
Hi Ryan, When I run your code under Scipy 0.3.2, I get errors about assigning complex numbers to floats. Changing the q2 = sqrt(...) calls to q2 = sqrt(abs(...)) calls fixes these and allows me to run as long as I want. I'm guessing that the argument to the sqrt(...) is getting to zero within numerical precision, and small negative values are creeping in. Another factor may be that, in stiff mode, odeint takes large extrapolating steps then back-corrects them. A large attempted step may be taking you into negative argument regions, which then causes the code to choke before it can back-correct. Cheers, Ryan -- Ryan Gutenkunst | Cornell LASSP | "It is not the mountain | we conquer but ourselves." Clark 535 / (607)227-7914 | -- Sir Edmund Hillary AIM: JepettoRNG | http://www.physics.cornell.edu/~rgutenkunst/
participants (2)
-
Ryan Gutenkunst
-
Ryan Krauss