lsode 0.2.8

Solve systems of differntial equations using LSODE subroutine from ODEPACK written in Fortran.
docs.rs failed to build lsode-0.2.8
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: lsode-0.2.7

Docs are here.

Solve systems of differential equations

This crate uses ODEPACK Fortran library to solve systems of ordinary differential equations.

I created this crate mainly to be able to solve stiff ODE problems in Rust.

Example

This example has the setup from DifferentialEquations.jl documentation.

use lsode::{linspace, solve_ode};

fn main() {
    let l: f64 = 1.0;
    let m: f64 = 1.0;
    let g: f64 = 9.81;
    let torque = |t: &f64| 0.1*t.sin();

    let f = |y: &[f64], t: &f64 | {
        let mut dy = vec![0.0, 0.0];
        dy[0] = y[1];
        dy[1] = -3.0*g/(2.0*l)*y[0].sin() + 3.0/(m*l*l)*torque(t);
        dy
    };

    let y0 = [0.01, 0.0];
    let ts = linspace(0.0, 10.0, 1000);
    let (atol, rtol) = (1e-6, 1e-6);

    let sol = solve_ode(f, &y0, ts.clone(), atol, rtol);

    for (i, t) in sol.iter().zip(ts) {
        println!("{} {} {}", t, i[0], i[1]);
    }
}

ODEPACK

I obtained the ODEPACK code that is present in this repository from here. I do not know what the licensing of the original ODEPACK code is, I assume it is released to the public domain.