brent

Function brent 

Source
pub fn brent<N, F>(initial: (N, N), f: F, tol: N) -> Result<N, String>
where N: RealField + FromPrimitive + Copy, F: FnMut(N) -> N,
Expand description

Use Brent’s method to find the root of a function

The initial guesses must bracket the root. That is, the function evaluations of the initial guesses must differ in sign.

§Examples

use bacon_sci::roots::brent;
fn cubic(x: f64) -> f64 {
    x.powi(3)
}
//...
fn example() {
  let solution = brent((0.1, -0.1), cubic, 1e-5).unwrap();
}