[SciPy-user] odeint limitations?

Pearu Peterson pearu at cens.ioc.ee
Sat Mar 9 14:49:13 CST 2002


On Sat, 9 Mar 2002, Brad Reisfeld wrote:

> Pearu, I was not able to find the interface to vode anywhere. Please give me
> some pointers on how I access this function or library. I have the vode
> source code. What do I do from there?

I assume that you use Scipy-0.2 from CVS. There is no vode support in
Scipy-0.1. So, the first pointer is

>>> import scipy
>>> print scipy.integrate.ode.__doc__ 
ode  - a generic interface class to numeric integrators. It has the
  following methods:
    integrator = ode(f,jac=None)
    integrator = integrator.set_integrator(name,**params)
    integrator = integrator.set_initial_value(y0,t0=0.0)
    integrator = integrator.set_f_params(*args)
    integrator = integrator.set_jac_params(*args)
    y1 = integrator.integrate(t1,step=0,relax=0)
    flag = integrator.successful()

  Typical usage:
    r = ode(f,jac).set_integrator('vode').set_initial_value(y0,t0)
    t1 = <final t>
    dt = <step>
    while r.successful() and r.t < t1:
        r.integrate(r.t+dt)
        print r.t, r.y
  where f and jac have the following signatures:
    def f(t,y[,arg1,..]):
        return <f(t,y)>
    def jac(t,y[,arg1,..]):
        return <df/dy(t,y)>
    
>>>

Second, you can take a look at the source code in

	scipy/integrate/ode.py

There are some general notes in the header.
The file contains two simple examples, you should also study these.


In fact, you don't need scipy to run vode from python but
then you need to have the following files from scipy/integrate/ directory:

  vode.pyf  - this must be compiled with f2py.
  ode.py    - high level interface to vode function
  vode.f + some blas/lapack functions.

Then you can run

  f2py -c vode.pyf vode.f -L/path/to/atlas -lf77blas -lcblas -latlas -lg2c

that will build vode.so extension module that is used by ode.py.

Pearu




More information about the SciPy-user mailing list