patrick-kidger / patrick-kidger/diffrax
Perform root-finding to tune the final step of an integration with a `DiscreteTerminatingEvent`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
A common feature in ODE solvers that feature event handling (e.g. scipy, DifferentialEquations.jl) is a root finding step that ensures the final step of the integration is placed on (or within tolerance, at least) the surface defined by the event. However, in Diffrax the integration is simply cut off after this boundary, placing a point wherever that happened to be.
Is this a planned feature? It would be very useful, especially in cases such as mine where having this finishing point finely resolved in time is very important.
edit: adding a plot to illustrate what I mean

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Diffrax's handling of DiscreteTerminatingEvent and where integration termination selects the final point. Review the existing event-handling behavior and determine how root finding should interact with solver tolerances. Done means the final integration point lies on, or within tolerance of, the event surface, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100