[SciPy-User] odeint (python vs mathematica)

Mark McClure mcmcclur@unca....
Wed Feb 10 15:52:04 CST 2010

On Wed, Feb 10, 2010 at 10:08 AM, Mark P <m.perrin@me.com> wrote:
> I have been performing modelling of ionic currents in Mathematica for the
> past three years as a student. ... I have been looking at - the rabbit/fox
> model ( Lotka-Volterra Tutorial), that is helping me to understand odeint.
> ... SciPy and Mathematica ODE code snipped ...
> My question is about speed. When computed in Mathematica 7 the code is
> roughly about 10x faster than odeint ... But I know
> from the web that numpy/scipy can be of an equivalent or faster speed. I was
> wondering whether the solution can be sped up; and would that require the
> use of C or Fortran.

As I understand it, claims (typically correct) that Python is several
times faster than Mathematica or Matlab, this is usually in reference
to procedural code.  My experience indeed confirms that complicated,
nested loops in Python usually run much faster than equivalent
Mathematica or Matlab code.  The code you present, however, simply
calls a library function, quite possibly the same library in both
cases.  The speed difference is probably caused by default parameters
(that you could likely fiddle with) and/or the quality of the
optimization of the library at compile time (that you probably can't
fiddle with).

Mark McClure

More information about the SciPy-User mailing list