Event tracking for continuous functions
This is a feature request. At the moment, Diffrax only supports two types of events, DiscreteTerminatingEvent and SteadyStateEvent. For many applications (ODEs with collision or reflection, first passage problems for SDEs) it would be very convenient to have an event tracker as in SciPy's scipy.integrate.solve_ivp. This would allow the user to provide a real-valued, continuous function (state, **kwargs) -> float and use a root finder to determine precisely when this function crosses 0. At the moment, DiscreteTerminatingEvent will significantly overshoot the zero-crossing and I have to use additional post-processing. SciPy also allows the user to specify which directionality (i.e. from negative to postive or positive to negative) of a zero-crossing should terminate integration, which is very helpful in practice.
Haha, this is good timing! As it turns out this is something that we're working on at the moment. Keep your eyes peeled :)
Regarding this continuous time event feature: Will the output of the ODE/SDE be differentiable wrt. to parameters in the cond_fn of the Event? If one wants to implement this functionality with the current version of diffrax how would you suggest them to proceed?
Thanks for the help :)
We now have a prototype of this feature in #387! It's very much a work-in-progress but folks should feel free to try it out and offer feedback.
Indeed we definitely should be differentiable with respect to the condition function for the event.
(Tagging also @cholberg here for visibility.)
Excellent, this looks like precisely what I need. Looking forward to trying it out!
Hi @patrick-kidger! I see that https://github.com/patrick-kidger/diffrax/pull/387 was just closed, I'm wondering what the status of the new Event functionality is? This is something that is being tabled for now, but may be reopened soon?
Closed by mistake only! :D