[SciPy-User] odeint with saturation?
Jonathan Stickel
jjstickel@vcn....
Fri Oct 15 14:30:24 CDT 2010
On 10/15/10 11:58 , Brian Blais wrote:
> On Oct 15, 2010, at 11:55 AM, Jonathan Stickel wrote:
>
>>> some of my cases have saturating values. In many cases a value
>>> can't go negative (if it does, it should just be set equal to
>>> zero). It
>>
>> ... if var< eps&& dvar<0: dvar = 0 ...
>
> thanks! so the obvious works...I feel a little sheepish now... :)
>
>>
>> P.S. I found that the effort to learn how to use
>> scipy.integrate.ode was the effort. It provides more control and a
>> slightly better solver than scipy.integrate.odeint. YMMV.
>
> what's the difference? it looks like ode lets you choose the
> integrator, and has some fine-grained options dependent on integrator
> method. is that right, or is there another advantage to using ode
> instead of odeint?
>
The help strings indicate that odeint uses LSODA and ode uses VODE.
Based on a little research, it seems that VODE is a slightly newer and
improved algorithm. The primary difference that I have observed is that
ode does a bit better with its automatic time step determination.
I also like the way that ode is typically used, i.e. in a loop. If I
use a while loop, I can stop based on some criteria other than time,
e.g. a variable's value or rate of convergence. I suppose odeint could
be used like this as well (in a loop), but it doesn't seem that it was
intended to be used this way.
Jonathan
More information about the SciPy-User
mailing list