Skip to main content

dormand_prince_solve

Function dormand_prince_solve 

Source
pub fn dormand_prince_solve<F>(
    f: F,
    t0: f64,
    y0: &[f64],
    t1: f64,
    options: OdeOptions,
) -> Result<OdeSolution, ErrorsJSL>
where F: Fn(f64, &[f64]) -> Vec<f64>,
Expand description

Solves y' = f(t, y) from (t0, y0) to t1 (which may be less than t0) with the adaptive Dormand-Prince 5(4) method, the method of MATLAB’s ode45 and SciPy’s RK45.

Each step costs six new evaluations of f (the seventh is reused by the next step). The embedded fourth-order solution estimates the local error, and steps are accepted when every component’s error is below absolute_tolerance + relative_tolerance · |yᵢ|; the step size then grows or shrinks by 0.9 · error^(−1/5), between a fifth and five times. Returns every accepted step. For stiff problems, where this method is forced into tiny steps, use rosenbrock23 or bdf.