[SciPy-user] ODE solver's in scipy

Robert Kern kern at caltech.edu
Mon Nov 4 06:37:31 EST 2002


On Mon, Nov 04, 2002 at 12:34:36PM +0100, Nils Wagner wrote:
> Hi,
> 
> How can I solve the following ODE in scipy
> 
> A(t,z) \dot{z} = f(z),    z(0) = z_0
> 
> where A is a real matrix depending on t and z;
> \dot denotes derivative with respect to time t.

from scipy import linalg, integrate

def A(t,z):
   ...

def f(z):
   ...

def F(z, t):
  return linalg.solve(A(t,z), f(z))

t = arange(0, 100, 0.1)  # or whatever
z0 = array([...])

z = integrate.odeint(F, z0, t)

-- 
Robert Kern
Ruddock House President
kern at caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter



More information about the SciPy-User mailing list