Skip to main content

bracket_root

Function bracket_root 

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

Searches outward from the interval [a, b] for a sign change of f.

The interval is expanded geometrically (by a factor of 1.6 per step, on the side with the smaller |f|) for up to 50 iterations. Returns (lo, hi) with f(lo) * f(hi) <= 0.