Pauli Virtanen | 23 Feb 10:03 2009
Picon
Picon

Re: some new ode solvers

Sun, 22 Feb 2009 23:56:55 +0000, John Travers wrote:
> Attached is a patch which adds two new ODE solvers to the
> scipy.integrate.ode module.
[clip]

I think this is a good point to discuss some API design decisions on 
scipy.integrate.ode.

There are currently two main interfaces to ODE integration:

- vode: a class, requires people to repeatedly call .integrate()
  to get values at separated points. Parameters set via method calls to
  the object. Uses DVODE/ZVODE.

- odeint: a function, computes values at points given as arguments.
  Parameters set via (keyword) arguments to the function. Uses LSODA.

Clearly, here we have one interface too many, and it's a bit of a mess. 
Either both LSODA and DVODE should be available only via one way (or both 
ways, as we decided to go with scipy.interpolate). Which to deprecate?

Also, how to specify the integrator to use: choose the correct function, 
or specify the name of the integrator as a string?

I'd perhaps like to see:
- All integrators moved to classes (with CamelCase names). 
  If you want to use eg. the ZVODE solver, you'd instantiate 'Zvode'
  class.
- The 'integrate' method would support getting multiple time points at 
  once.
- There'd also be thin wrapper functions (with lowercase names), e.g.
  'zvode' that would allow all solvers to have a simple odeint-type
  interface.
- Both of the current 'ode' and 'odeint' interfaces would be dropped in
  Scipy 1.0, and deprecated before that.

How would this sound?

--

-- 
Pauli Virtanen

Gmane