Skip to main content

Crate numra_dde

Crate numra_dde 

Source
Expand description

DDE (Delay Differential Equation) solvers for Numra.

This crate provides methods for solving delay differential equations of the form:

y'(t) = f(t, y(t), y(t - τ₁), y(t - τ₂), ...)

where τᵢ are the delays (constant or state-dependent).

§Solvers

§Example

use numra_dde::{DdeSystem, MethodOfSteps, DdeSolver, DdeOptions};

// Mackey-Glass equation: y'(t) = β * y(t-τ) / (1 + y(t-τ)^n) - γ * y(t)
struct MackeyGlass {
    beta: f64,
    gamma: f64,
    n: f64,
    tau: f64,
}

impl DdeSystem<f64> for MackeyGlass {
    fn dim(&self) -> usize { 1 }
    fn delays(&self) -> Vec<f64> { vec![self.tau] }
    fn rhs(&self, _t: f64, y: &[f64], y_delayed: &[&[f64]], dydt: &mut [f64]) {
        let y_tau = y_delayed[0][0];  // y(t - tau)
        dydt[0] = self.beta * y_tau / (1.0 + y_tau.powf(self.n)) - self.gamma * y[0];
    }
}

let mg = MackeyGlass { beta: 2.0, gamma: 1.0, n: 9.65, tau: 2.0 };
let history = |_t: f64| vec![0.5];  // Constant history
let opts = DdeOptions::default();
let result = MethodOfSteps::solve(&mg, 0.0, 100.0, &history, &opts);

Author: Moussa Leblouba Date: 3 February 2026 Modified: 2 May 2026

Structs§

DdeOptions
Options for DDE solvers.
DdeResult
Result of DDE integration.
DdeStats
Statistics from DDE solver.
HermiteInterpolator
Hermite cubic interpolator for a single step.
History
History storage for DDE solver.
MethodOfSteps
Method of Steps DDE solver.

Traits§

DdeSolver
Trait for DDE solvers.
DdeSystem
Trait for delay differential equation systems.
HistoryFunction
Trait for history functions.
Scalar
A real scalar type suitable for numerical computation.