[SciPy-User] possible bug with scipy.integrate.ode
Fri Nov 4 08:30:49 CDT 2011
The sad thing is... I knew about the order of arguments :-(
but moving from one to the other I forgot to swap the arguments...
Thanks, I am very relieved to hear that there is no such bug!
On Fri, Nov 4, 2011 at 11:01, Warren Weckesser <
> On Fri, Nov 4, 2011 at 7:35 AM, Flavio Coelho <firstname.lastname@example.org> 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
> SciPy-User mailing list
Flávio Codeço Coelho
Escola de Matemática Aplicada
Fundação Getúlio Vargas
Rio de Janeiro - RJ
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User