Type Alias DiffEq
pub type DiffEq = fn(&NalgebraVec<f64>, &NalgebraVec<f64>, f64, &mut NalgebraVec<f64>, NalgebraVec<f64>, &Covariates);
Expand description
This closure represents the differential equation of the model.
§Parameters
x
: The state vector at time tp
: The parameters of the model; Use the [fetch_params!] macro to extract the parameterst
: The time at which the differential equation is evaluateddx
: A mutable reference to the derivative of the state vector at time trateiv
: A vector of infusion rates at time tcov
: A reference to the covariates at time t; Use the [fetch_cov!] macro to extract the covariates
§Example
ⓘ
use pharmsol::*;
let diff_eq = |x, p, t, dx, rateiv, cov| {
fetch_params!(p, ka, ke, v);
fetch_cov!(cov, t, wt);
dx[0] = -ka * x[0];
dx[1] = ka * x[0] - ke * x[1];
};