Skip to main content

ridders_method

Function ridders_method 

Source
pub fn ridders_method<F>(
    f: F,
    a: f64,
    b: f64,
    tol: f64,
) -> Result<f64, ErrorsJSL>
where F: Fn(f64) -> f64,
Expand description

Finds a root of f in [a, b] using Ridders’ method (C. Ridders, 1979). Requires a sign change over the interval.

Each iteration evaluates f at the midpoint and at an exponentially-corrected false-position point, keeping a bracket; it stops when successive estimates or the bracket width fall below tol, and errors after 100 iterations.