Skip to main content

brent

Function brent 

Source
pub fn brent<F>(
    f: F,
    a: f64,
    b: f64,
    criteria: Criteria,
) -> OgeomResult<Solution>
where F: FnMut(f64) -> f64,
Expand description

Find a root of f in [a, b] by Brent’s method.

Combines bisection, the secant method and inverse quadratic interpolation, taking whichever step is both safe and fast. Guaranteed to converge for a continuous function that changes sign across the bracket, and superlinear in practice, the right default when a bracket is available.

§Errors

OgeomError::Construction if the bracket is malformed, or if f does not change sign across it, which means there is no root to find by this method.