The choices allowed for "ParametricSensitivity"
can be seen from the following error message
ParametricNDSolveValue[{y'[t] == 1, y[0] == a}, y[1], {t, 1}, a,
Method -> {"ParametricSensitivity" -> "?"}];
(* ParametricNDSolveValue::bdsmtd: Method ? for solution stage ParametricSensitivity
is not one of {Automatic, None, ForwardSensitivity, AdjointSensitivity}. >> *)
None
means no sensitivities will be computed. The default method setting is Automatic
, which will typically compute forward sensitivities, although "AdjointSensitivity"
may be used in some cases, e.g. if the solution is only requested at a particular time.
In the important default case when WorkingPrecision
is machine precision and no time integration method has been specified, Mathematica useswill use the SUNDIALS/CVODESbuilt-in sensitivity solvers from the SUNDIALS suite, in particular the CVODES or IDAS libraries for initial value ODE problems or DAE systems respectively. For some mathematical background on the methods used, I would recommend the following paper and the references therein. Quoting from the introduction,
The forward sensitivity module in CVODES implements the simultaneous corrector method, as well as two flavors of staggered corrector methods. Its adjoint sensitivity module provides a combination of checkpointing and cubic Hermite interpolation for the efficient generation of the forward solution during the adjoint system integration.
In cases when CVODES or IDAS cannot be used (e.g. explicit method specified or not a machine precision problem), sensitivities are computed by solving an augmented system that includes the sensitivity equations.
The "ParametricSensitivity"
results are accessible to the user by asking for derivatives with respect to the parameters. Other numerical solvers in Mathematica
(e.g. FindRoot
or FindMinimum
) will make automatic use of sensitivities, if available, in the same way: by requesting derivatives whenever needed by the underlying algorithm.
For additional examples, I would also mention the following presentation from the 2012 Wolfram Technology Conference.