[SciPy-user] Coupled ODEs

Lou Pecora lou_boog2000@yahoo....
Tue Apr 22 12:14:10 CDT 2008

You use arrays (2-dimensional in your example) for
initial conditions and define f to be a function from
R^2 to R^2 (i.e. it returns a 2D array of function
values - called the vector field of the ODE- using the
input 2D array (y,z) ).  SciPy.odeint is set up to
handle arrays, not just scalars.  You should get the
tutorial on SciPy by Travis Oliphant at 


the above URL should be all on one line. Search for
ODEINT and all is explained.

-- Lou Pecora

--- Colin Gillespie wrote:


How do I solve coupled ODEs using scipy?

For the ODE

dz/dt = z2

I have

from scipy import *
def f(t,z):
    return z**2
t = [0,1]
z0 = array([0])

z = integrate.odeint(f, z0, t)
print z

But how do I handle:

dy/dt = y*z
dz/dt = z2+y



Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

More information about the SciPy-user mailing list