[SciPy-user] problem with odeint
rng7 at cornell.edu
Fri Mar 3 08:50:18 CST 2006
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 : 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.
> 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.
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.
Ryan Gutenkunst |
Cornell LASSP | "It is not the mountain
| we conquer but ourselves."
Clark 535 / (607)227-7914 | -- Sir Edmund Hillary
AIM: JepettoRNG |
More information about the SciPy-user