pub fn rk4_solve<F>(
f: F,
t0: f64,
y0: &[f64],
t1: f64,
n_steps: usize,
) -> Result<OdeSolution, ErrorsJSL>Expand description
Solves y' = f(t, y) from (t0, y0) to t1 with n_steps steps of the classical
fourth-order Runge-Kutta method (RK4), returning the state after every step.
Each step costs four evaluations of f and has local error O(h⁵), so the global error is
O(h⁴): halving the step divides it by about 16. There is no error control; use
dormand_prince_solve when the accuracy must be
guaranteed or the solution changes on very different time scales.