Description
There are many interpolations with a discontinuous derivative. Right now, ConstantInterpolation returns a NaN
at the node points. That ends up being really bad behavior for many solver contexts because that NaN can be hard to recover from. Instead, it would be good to choose a directional derivative.
For the purpose of use in solvers, it almost always makes sense to use the right derivative. This is because solvers are trying [t, t+dt]
moving from left to right, so if the derivative at the start is different, you get a jump the solver cannot handle. So normally it's this derivative. But it would be good to allow the choice. In DifferentialEquations this is handled via continuity = :right
with a choice of :left
. It would be good to add this argument to derivative
.