Type Alias DiffEq
pub type DiffEq = fn(_: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, _: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, _: f64, _: &mut Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, _: Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, _: &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];
};