[SciPy-user] question about ODE output and time steps

Anne Archibald peridot.faceted@gmail....
Thu Apr 26 10:57:49 CDT 2007


On 26/04/07, Trevis Crane <t_crane@mrl.uiuc.edu> wrote:

> [Trevis Crane]
>
> I assumed it was fixed since you supply the dt value (or in the case of
> odeint, an array of t values).  By you statement above, though, I assume
> these are simply to tell the solver at what times you want y information
> (much like MATLAB's solvers).
>
> What I really want to do, however, requires that I stop the solver at
> some iteration step that, a priori, is unknown.  I'm simulating a
> dynamic system and my condition for stopping the solver is when the
> energy of the system stops changing beyond a specified threshold.  So
> each iteration of the solver I calculated the energy, and if after so
> many iterations it stops changing (much), I want the solver to stop.

I had essentially the same need. I tried various hacks - it turns out
odeint actually allows you to backtrack within one integrator step -
but they failed and were a pain to use. I came up with a wrapper for
ODEPACK's LSODAR, which has a stop-on-contstraint function that does
exactly the right thing but is otherwise identical to LSODA that
odeint uses. But PyDSTool did it right, apparently (I haven't used
it).

Anne


More information about the SciPy-user mailing list