[SciPy-user] Behaviour of odeint

Anne Archibald peridot.faceted@gmail....
Mon Apr 21 21:02:11 CDT 2008

On 21/04/2008, Gabriel Gellner <ggellner@uoguelph.ca> wrote:
> I just noticed that when you send odeint an empty array, it returns an empty
>  array (that is it doesn't raise and error), is this intentional?
>  I noticed similarly with array functions like numpy.sin, have the same
>  behaviour. Can anyone shed light on the logic behind this, I find in
>  confusing, but I am easily convince ;-)

For numpy.sin and friends (ufuncs) the idea is that these functions
act elementwise on arrays; you can get the same effect in pure python
with, for example,

map(math.sin, list)
[sin(x) for x in list]

In both cases it's clear that the empty list means "do nothing".

For odeint I'm not so convinced; since you normally need to supply it
with the starting time, plus any times you want it to integrate to, it
seems like calling it with an empty list is always an error. Still, I
suppose I can imagine some application for odeint working on an empty

I don't know that it's worth putting much effort into replicating
odeint's interface.


More information about the SciPy-user mailing list