Skip to main content

solve

Function solve 

Source
pub fn solve(
    f: &dyn Fn(f64, f64) -> f64,
    x0: f64,
    y0: f64,
    x_end: f64,
    n: usize,
) -> (Vec<f64>, Vec<f64>)
Expand description

Solve an IVP using the 2-step Adams-Bashforth method.

The first step is bootstrapped with a single RK4 step.

§Arguments

  • f — Right-hand side.
  • x0 — Initial x.
  • y0 — Initial y.
  • x_end — Terminal x.
  • n — Number of steps (≥ 2 for AB2 to be used; if n == 1, falls back to Euler).

§Returns

(xs, ys) — all computed points.