Install Numra.

Numra is a Rust crate. If you have a recent stable Rust toolchain, adding Numra is one command. The MSRV is published on the stability page.

1. Add the crate.

cargo add numra

That pulls the workspace facade. Modules become available under numra::ode, numra::sde, numra::dde, numra::pde, and so on.

2. Solve a Lorenz system.

Drop this into src/main.rs:

use numra::ode::{solve_ivp, Tsit5};
use numra::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let lorenz = |_t: f64, y: &[f64], dy: &mut [f64]| {
        let (s, r, b) = (10.0, 28.0, 8.0 / 3.0);
        dy[0] = s * (y[1] - y[0]);
        dy[1] = y[0] * (r - y[2]) - y[1];
        dy[2] = y[0] * y[1] - b * y[2];
    };

    let sol = solve_ivp(lorenz, (0.0, 40.0), &[1.0, 1.0, 1.0])
        .method(Tsit5::new())
        .rtol(1e-8)
        .atol(1e-10)
        .dense_output(true)
        .run()?;

    println!("steps: {}, final state: {:?}", sol.t.len(), sol.y_last());
    Ok(())
}

3. Run.

cargo run --release

What's next?