[SciPy-User] Zero crossing detection

Lafras Uys lafras at sun.ac.za
Tue Mar 30 03:45:58 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> On 29 March 2010 15:31, Moritz Maus <moritz.maus at uni-jena.de> wrote:
>> Is there a way for the ODE-integrators to
>> a.) stop the simulation when a specific event occurred or
>> b.) doing a MatLab (Simulink)-like "zero crossing detection", (when
>> these timepoints are not pre-defined?)
> 
> The short answer is no. (And we apologize for this.)
> 
> There's a much more powerful set of tools available for working with
> ODEs provided in the python package pydstool; they provide many
> features including this one. Alternatively, there are a number of
> wrappers for the ODEPACK integrator LSODAR (which is included but not
> wrapped in scipy) which provides exactly this capability. Finally, you
> can get some approximation of this behviour using scipy's integrators;
> they can be made to advance "one step" of the underlying integrator at
> a time, and while in this mode they can be used to "backtrack" as far
> as the beginning of the step. So you can just keep advancing until you
> meet your criterion then backtrack.
> 
> This brings me to a warning: no ODE solver I know of is able to deal
> with "here there be dragons"-type events, that is, situations where
> you not only want the integrator to stop, but where it is not allowed
> to evaluate anything past that point (perhaps because your RHS
> function yields nonsense). The standard approach is to write RHS
> functions so that they detect out-of-bounds conditions and return some
> not-too-offensive value, hoping that this won't send the integrator
> into a frenzy.

Not SciPy either, but PySUNDIALS (http://pysundials.sourceforge.net/) is
a set of python bindings for SUNDIALS. SUNDIALS can handle triggers,
events, delays and so forth.

Lafras
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkuxrCwACgkQKUpCd+bV+kpYwACgkJ25xeI4OtDTtPAn52o9SCJt
abcAoKAjJnWnNDk4NrVXamXkUhFTzk5n
=BDRY
-----END PGP SIGNATURE-----



More information about the SciPy-User mailing list