ODEForwardSensitivityProblem(prob) (or (f, u0, tspan, p)) builds an
ODE problem whose state is the original state followed by its
sensitivities, solved with solve() like any ODEProblem.
extract_local_sensitivities(sol) splits the solution into the values
and the sensitivities.
Usage
ODEForwardSensitivityProblem(
f,
u0 = NULL,
tspan = NULL,
p = NULL,
sensealg = ForwardSensitivity(),
du0 = NULL,
dp = NULL,
...
)
extract_local_sensitivities(sol, i = NULL, asmatrix = FALSE, t = NULL)Arguments
- f
An
ODEProblem, a completeSystem, an R functionf(u, p, t)or anODEFunction.- u0, tspan, p
Initial values, time span and parameters (ignored when
fis a problem; for a Systemu0is the operating point).- sensealg
- du0, dp
Seed matrices (see Details).
- ...
Further arguments for
ODEProblem()whenfis a System or function.- sol
A solution of an
ODEForwardSensitivityProblem.- i
Index of a saved time;
NULLfor all saved times.- asmatrix
Return the sensitivities as one n x m matrix (per time) instead of a list with one vector (or time series) per direction.
- t
Times to interpolate at instead of
i.
Details
With sensealg = ForwardSensitivity() the sensitivities are with respect
to the parameters p. ForwardDiffSensitivity() takes seed matrices:
du0 (n x m) and dp (length(p) x m) give the derivatives of the
initial values and the parameters with respect to m directions
(cbind(diag(n), 0) and cbind(0, diag(length(p))) differentiate with
respect to both). For a problem built from a System, du0 adds the
dependence of the initial values on the parameters through
initialization. Events (callbacks of the problem) are differentiated,
including the dependence of the event time on the parameters.
Derivatives of the right-hand side come from the System (symbolic
Jacobians compiled to R) or, for R functions, from jac_fn or central
finite differences.