Skip to main content

halley

Function halley 

Source
pub fn halley<F, D, D2>(
    f: F,
    df: D,
    d2f: D2,
    x0: f64,
    tol: f64,
) -> Result<f64, ErrorsJSL>
where F: Fn(f64) -> f64, D: Fn(f64) -> f64, D2: Fn(f64) -> f64,
Expand description

Finds a root of f by Halley’s method from x0, as SciPy’s newton with fprime2: the Newton step δ = f/f' is divided by 1 − δ f''/(2f') whenever that correction is below one in magnitude. Stops when successive iterates differ by at most tol (SciPy’s default is 1.48·10⁻⁸) or f(x) is exactly zero; errors on a zero derivative or after 50 iterations. Converges cubically near a simple root.