Closed nsteffen closed 5 months ago
So this is because you have a "discrete" terminating event -- the event halts at the end of the step in which the event was triggered. As that's a discrete thing then there (correctly) is no gradient.
You may like to try #387, which is a more featureful approach to events. In particular this includes the ability to (a) have an event return a real number, for which the solve terminates where that number is zero, and (b) have that exact location determined using a root find.
Tagging @cholberg for visibility, but I believe that should give you gradients.
Just got to testing that out, and it looks like your suggestion worked! Thanks for the help; I'm excited for this feature to be part of the main code!
Hello!
I am working on a problem where I want to propagate a trajectory using
diffrax
, use a discrete terminating event to end that trajectory, and then get the derivative of that final time with respect to a variable. Regardless of the problems I have tried to do this on, the gradient of the final time always ends up as zero. Below is an example where I model the simplified dynamics of a cannonball and I try to evaluate the gradient of the final time with respect to the coefficient of drag.Is there a correct/better way to do this? Thanks in advance!