Open ivandariojr opened 5 months ago
Hey there! I'm glad you're enjoying Diffrax :)
This is expected behaviour -- the "discrete" in "discrete terminating event" means that it does not attempt to find the root of the event function. Rather, it simply stops integrating when the event triggers over the course on an individual numerical step. This approach is useful when you don't care precisely when something occured (e.g. when integrating to a steady state) and don't need to spend extra computation resolving the exact time.
In this case, the fact that the constant step size got much closer is just a fluke.
If you do need the exact location then we intend to add this as feature shortly. Check out the feature branch #387 and give it a go -- we'd love to get some feedback on it!
When using the adaptive step size solver to integrate an ODE with a discrete terminating event, the detected event time is significantly after the detected event time computed with a constant step size solver. This error is significant for my application and above all tolerances I set. Is this expected behavior?
I am attaching a plot to illustrate the problem. You can see that the adaptive step solver continues integrating long after the event should be triggered (computed analytically).
And a minimum working example:
P.S.: Thanks so much for your work on diffrax. It has been invaluable for my research.