| Version 6 (modified by warren.weckesser, 3 years ago) |
|---|
See Task #919
The scipy.integrate.ode/odeint API needs some cleanup. This page details a suggestion what a revised API should look like.
Problems with current api
- ode is a class, odeint a function
- ode has different semantics than odeint for the callback function
Proposed API
The idea would be to follow the lead of the scipy.interpolate API (cf. eg. KroghInterpolate).
- CamelCase classes Vode, Zvode, Dopri, etc., functionality similar to ode
- Thin wrapper functions vode, zvode, ..., with functionality similar to odeint
The second point could perhaps also be
- One wrapper function odeint (or something similar) with a suitable keyword argument.
Use cases
Integrate a simple ODE
import numpy as np
from scipy.integrate import vode
def f(t,y):
return -2*y + np.array([np.cos(t),0,0])
t = np.linspace(0, 20, 200)
y = np.vode(f, t=t, y0=[0,1,2])
Related
- Related tickets (as of 1 May 2010): #291, #478, #894, #1040, #1169
- Note about wrapping of LSODAR by Ryan Gutenkunst: http://osdir.com/ml/python.scientific.devel/2005-07/msg00028.html
- Gabriel Gellner started to work on something related here: https://launchpad.net/pyode
- Should the design take differential algebraic system in consideration (dae)? An implementation of dae solvers based on current ode implementation is http://scikits.appspot.com/odes
Open questions
- Are the named classes Vode etc. discoverable? (Having names of different solvers in class names is obscure.) The currently published docs don't show the integrators, e.g. http://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html but >>> help(scipy.integrate.ode) does. If Vode etc. are properly indexed then the sphinx documentation should make them discoverable (with search). And if ode class doesn't shadow the ode module then module docs can be incorporated in the documentation
- Is complex_ode separate from ode/odeint or should it have the same changes to the API or merged? help(scipy.integrate.complex_ode) doesn't show which integrators are available
