Skip to main content

bisect_monotone

Function bisect_monotone 

pub(crate) fn bisect_monotone(
    f: impl FnMut(f64) -> f64,
    lo: f64,
    hi: f64,
    target: f64,
    tol: SolveTolerance,
    cap: usize,
) -> Result<Solved, SolveFailure>
Expand description

Bisection for f(x) = target on a monotone f over [lo, hi].

The bracket endpoints are evaluated once; each iteration evaluates f exactly once, so a converged solve costs iterations + 2 evaluations.