[SciPy-user] Bug in scipy.integrate.odeint ?

David M. Cooke cookedm@physics.mcmaster...
Thu Nov 1 09:56:19 CDT 2007


On Nov 1, 2007, at 10:27 , LB wrote:

> Hi,
>
> I find the behaviour of scipy.integrate.odeint very strange :
>>>> from numpy import *
>>>> from scipy import integrate
>>>>
>>>> def f(x, t):
> ...        return cos(x)
> ...
>>>>
>>>> X0 = array([0.0])
>>>> X0_ini = X0.copy()
>>>> t = linspace(0, 20., 200)
>>>> X = integrate.odeint(f, X0, t)
>>>> X0 == X0_ini
> array([False], dtype=bool)
>>>> X0 == X[-1]
> array([True], dtype=bool)
>
> Why do odeint modify X0 ?
> Is there any reason for this ?
> For me, it seems really like a bug and could easily lead to bugs if
> there's no mention of this in the doc string.


I'm guessing you've got an old version of scipy installed, as it was  
changed in February to use a copy of the input arguments instead.

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm@physics.mcmaster.ca



More information about the SciPy-user mailing list