Running an ODEProblem until given a signal

Is it possible for the timespan of an ODEProblem to be open-ended, i.e. for the problem to run until given an external signal (possibly via a discrete callback with an appropriate condition)? Intuitively, this would mean giving something like tspan = (0.0, Inf), although I’m not sure if that is allowed and can’t seem to find anything in the documentation. TIA.

Cross-posted in callback - Running an ODEProblem until given a signal - Stack Overflow

Yes, Inf is allowed. I’m surprised I didn’t use Inf in the terminating example in the docs, but you can definitely use it as long as you set a terminating event or manually step via the integrator interface.

Thanks for the quick answer. So far, using DifferentialEquations.jl is by far easier and more pleasant than my old hand-written codes, and features like this, together with how generally easy it is with it to port maths into working code, are turning it into by far my favourite [meta-]package.

4 Likes