Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event tracking for continuous functions #380

Open
nikolas-claussen opened this issue Feb 23, 2024 · 4 comments
Open

Event tracking for continuous functions #380

nikolas-claussen opened this issue Feb 23, 2024 · 4 comments
Labels
feature New feature next Higher-priority items

Comments

@nikolas-claussen
Copy link

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.

@patrick-kidger
Copy link
Owner

Haha, this is good timing! As it turns out this is something that we're working on at the moment.
Keep your eyes peeled :)

@patrick-kidger patrick-kidger added feature New feature next Higher-priority items labels Feb 23, 2024
@LuggiStruggi
Copy link

LuggiStruggi commented Apr 29, 2024

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 :)

@patrick-kidger
Copy link
Owner

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.)

@nikolas-claussen
Copy link
Author

Excellent, this looks like precisely what I need. Looking forward to trying it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature next Higher-priority items
Projects
None yet
Development

No branches or pull requests

3 participants