Trait peroxide::numerical::ode::ODEProblem

source ·
pub trait ODEProblem {
    // Required method
    fn rhs(&self, t: f64, y: &[f64], dy: &mut [f64]) -> Result<()>;
}
Expand description

Trait for defining an ODE problem.

Implement this trait to define your own ODE problem.

§Example

use peroxide::fuga::*;

struct MyODEProblem;

impl ODEProblem for MyODEProblem {
    fn rhs(&self, t: f64, y: &[f64], dy: &mut [f64]) -> anyhow::Result<()> {
        dy[0] = -0.5 * y[0];
        dy[1] = y[0] - y[1];
        Ok(())
    }
}

Required Methods§

source

fn rhs(&self, t: f64, y: &[f64], dy: &mut [f64]) -> Result<()>

Implementors§