ODEForwardSensitivityFunction(prob, sensealg, Q) is the right-hand side
F(z, p, t) of the forward sensitivity equations of an ODEProblem, the
function ODEForwardSensitivityProblem() integrates: for the state
z = (u, S) with the sensitivities S (n x m, stored column by
column), F returns (f(u, p, t), J S + f_p Q), where Q (length(p)
x m) holds the derivatives of the parameters with respect to the m
directions (the identity for the parameter sensitivities). With tracked = TRUE, Q is part of the state (after S) and has zero rate, so events
can change it.
Usage
ODEForwardSensitivityFunction(
prob,
sensealg = ForwardSensitivity(),
Q = NULL,
tracked = FALSE
)Arguments
Value
A function (z, p, t) of class ODEForwardSensitivityFunction
with attributes numindvar and numparams.
Details
Derivatives come from the System (symbolic Jacobians) or, for R
functions, from jac_fn or central differences, as for
ODEForwardSensitivityProblem().
Examples
prob <- ODEProblem(function(u, p, t) -p[1] * u, 1, c(0, 1), 2)
F <- ODEForwardSensitivityFunction(prob)
F(c(1, 0), 2, 0) # (-p u, -p S - u)
#> [1] -2 -1