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: Params:
- x: The state vector at time t
- p: The parameters of the model; Use the [fetch_params!] macro to extract the parameters
- t: The time at which the differential equation is evaluated
- dx: A mutable reference to the derivative of the state vector at time t
- rateiv: A vector of infusion rates at time t
- cov: 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];
};