[SciPy-User] possible bug with scipy.integrate.ode
Fri Nov 4 08:01:07 CDT 2011
On Fri, Nov 4, 2011 at 7:35 AM, Flavio Coelho <email@example.com> wrote:
> I am a long time user of scipy.integrate.odeint for solving ODEs. Today I
> decided to test the "other solver" in scipy: scipy.integrate.ode I am
> getting strange results for model below:
> def fun(y,t):
> Logistic model
> a = .5
> k = 1000.0
> return a*(1-y/k)*y
> r = ode(fun).set_integrator('vode',method='bdf', with_jacobian=False)
> res = np.zeros(10000)
> i = 0
> while r.successful() and r.t < 100:
> res[i] = r.y
> i += 1
> odeint solves this correctly and returns the caracteristic logistic curve
> which maxes out at 1000. ode, however, keeps growing beyond 1000.
> I may be doing something stupid, since I am not familiar with the usage of
> ode. Or there maybe a bug in ode.
It is unfortunate, but odeint and ode use different conventions for the
order of the arguments of the function that defines the system of
differential equations. If you change the signature of your definition of
'fun' to 'def fun(t, y):', your example works fine.
> I'll just stay away from ode for now, but I thought it might be a good
> Idea to report this.
> Flávio Codeço Coelho
> +55(21) 3799-5567
> Escola de Matemática Aplicada
> Fundação Getúlio Vargas
> Rio de Janeiro - RJ
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User