[SciPy-User] odeint with saturation?
Fri Oct 15 10:55:42 CDT 2010
On 10/12/10 11:00 , email@example.com wrote:
> Date: Tue, 12 Oct 2010 08:12:41 -0400
> From: Brian Blais<firstname.lastname@example.org>
> Subject: [SciPy-User] odeint with saturation?
> To: SciPy Users List<email@example.com>
> I am using odeint to solve some diff eqs, and it works great, but
> 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
> doesn't seem as if odeint can do this, but is there an easy or
> preferred way of solving that kind of system?
> Brian Blais
Maybe you have figured this out on your own already, but I have one
suggestion. In your function that defines the set of ODEs, do something
if var < eps && dvar<0:
dvar = 0
return [array of rate variables including dvar]
Where 'var' is the variable you want to prevent being negative and
'dvar' is the rate for var calculated earlier in your function.
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.
More information about the SciPy-User