[SciPy-user] ODE solvers and Scipy

Robert Clewley rclewley at cam.cornell.edu
Sat Aug 12 12:30:40 CDT 2006

On Sat, 12 Aug 2006, JJ wrote:

> Hello.
> I am just about to start building a somewhat complex
> dynamic model that will incorporate a large  number
> (~50-100) of differential equations and parameters to
> be estimated.  This is my first project of this type,
> so I am on a steep learning curve.  I could build it
> using Matlab's Simulink, but I would rather build it
> in Python.  I have looked for good graphical
> interfaces to ODE solvers in Python but have not found
> any that seem suitable.

Have you even found any at all? I am not aware of any graphical interfaces 
to ODE solvers in Python. I think Simulink is great for learning with and 
can be quite easy to start out with, but it's horribly inefficient for 
serious projects like parameter estimation with 100 ODEs. And if you want 
to make broad systematic changes to your model (like changing many related 
parameters at once) you'd better learn how to edit the simulink script 
file directly! 50 DEs is already past my limit of what I'd consider 
dealing with graphically.

> -- The (few) examples I have seen in using Scipy's ODE
> functions are only small, simple ones.  Is there
> anything to prevent use of the solvers for larger,
> more complex systems of ODEs?

No, I don't think so. I use SciPy's VODE for large systems sometimes and 
it's OK. The main problem is the inefficiency of the integrators needing 
to call back to your python function that defines the right hand sides of 
your ODEs.

> -- Has anyone seen a good tutorial on use of Scipy's
> ODE solver for larger (or at least not tiny) problems?

Other than sparseness I don't know what kind of issues
arise with larger system size that would need a specific tutorial.

> -- Are there other Open Source packages out there that
> might offer more options than Scipy's ODE solver?  I
> dont want to make this job any harder than I need to.
> Ive looked but didnt see any.

My group provides the distinctly non-graphically interfaced PyDSTool OSS 
package built over old numarray/scipy array classes, and where we've 
wrapped faster and well-established C-based ODE stiff and non-stiff 
integrators (avoiding the slow python callback problem). There is somewhat 
improved error-handling and support for stopping at events compared to the 
wrapping of the Scipy integrators. Parameter estimation and handling the 
book-keeping of a large system is somewhat easier with our Python classes 
too, I would say. We also support DAEs (a feature you might be looking for 
in Sundials), hybrid systems and maps.

> -- Simulink offers use of various model blocks to
> simplify model building.  I can write my own, but is
> there any public code already available along these
> lines for use with Scipy's ODE solver?

PyDSTool provides a model building system (basically template classes for 
coupling simulink-link "blocks") which has not been filled out with 
examples such as those in Simulink. You build the models in scripts as you 
would in matlb. But it's easy to make your own "blocks" with these classes 
and there are some examples provided for other types of problem.


More information about the SciPy-user mailing list