pub fn bisect(
f: &dyn Fn(f64) -> f64,
a: f64,
b: f64,
tol: f64,
max_iter: usize,
) -> Result<f64, String>Expand description
Bisection method for scalar root finding.
Finds x in [a, b] such that |f(x)| < tol, given that f(a) and
f(b) have opposite signs. Returns Err if the bracket is invalid.