Solution - Diffrax (original) (raw)

If dense output was saved, then calculate an approximation to the derivative of the solution at any point in the region of integration self.t0to self.t1.

That is, letting \(y\) denote the solution over the interval [t0, t1], then this calculates an approximation to \(\frac{\mathrm{d}y}{\mathrm{d}t}\).

(This is not backpropagating through the differential equation -- that typically corresponds to e.g. \(\frac{\mathrm{d}y(t_1)}{\mathrm{d}y(t_0)}\).)

Example

For an ODE satisfying

\(\frac{\mathrm{d}y}{\mathrm{d}t} = f(t, y(t))\)

then this value is approximately equal to \(f(t, y(t))\).

Warning

This value is generally not very accurate. Differential equation solvers are usually designed to produce splines whose value is close to the true solution; not to produce splines whose derivative is close to the derivative of the true solution.

If you need accurate derivatives for the solution of an ODE, it is usually best to calculate vector_field(t, sol.evaluate(t), args). That is, to pay the extra computational cost of another vector field evaluation, in order to get a more accurate value.

Put precisely: this derivative method returns the derivative of the numerical solution, and not an approximation to the derivative of the true solution.

Arguments: