[SciPy-user] Caveat About integrate.odeint

Anne Archibald peridot.faceted@gmail....
Thu Oct 25 10:40:02 CDT 2007


On 25/10/2007, Lorenzo Isella <lorenzo.isella@gmail.com> wrote:

> I do not know if what I am going to write is really useful (maybe it
> is pretty obvious for everybody on this list).
> I have been using integrate.odeint for quite a while to solve some
> population equations.
> Then I made a trivial change (nothing leading to different physics or
> in general such as to justify any substantial difference with the
> previous results), and I woke up in a nightmare: precision errors,
> routine crashing etc...
> I think I now what happened: in my code I was using t [time], T(t)
> [time-dependent temperature], t_0 (initial time) and T_0 (initial
> temperature).
> For Python there is no possibility of confusion, but the underlying
> Fortran made a mess out of this...
> Something very trivial, but it took me a day and a half to debug this.
> Hope it was useful.

Do you have a small piece of demo code? This is very surprising, as
FORTRAN should never see the variable names. I can't replicate it in
spite of headache-inducing variable names:

In [17]: T = lambda t, T: T

In [18]: T0 = 1

In [19]: t = [0,1,2]

In [20]: scipy.integrate.odeint(T,T0,t)
Out[20]:
array([[ 1.        ],
       [ 1.50000001],
       [ 3.00000001]])

Anne


More information about the SciPy-user mailing list