pub fn find_root(f: fn(f64) -> f64, fd: fn(f64) -> f64, guess: f64, iterations: i32) -> f64 {
    let mut result = guess;
    for _ in 0..iterations {
        result = iteration(f, fd, result);
    }
    result
}
/// Finds the root of the function f
///
/// # Examples
///
/// [Finding the square root of a number]
/// (https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number)
///
/// ```
/// use newton_raphson::find_root;
/// fn sqrt_of_612(x: f64) -> f64 {
///     (x * x) - 612.0
/// }
///
/// fn sqrt_of_612_d(x: f64) -> f64 {
///     2.0 * x
/// }
///
/// assert_eq!(24.738633753766084, find_root(sqrt_of_612, sqrt_of_612_d, 10.0, 5))
/// ```
Finds the root of the function f
Finds the root of the function f
pub fn find_root(f: fn(f64) -> f64, fd: fn(f64) -> f64, guess: f64, iterations: i32) -> f64 {
    let mut result = guess;
    for _ in 0..iterations {
        result = iteration(f, fd, result);
    }
    result
}
pub fn find_root ( f : fn ( f64 ) -> f64 , fd : fn ( f64 ) -> f64 , guess : f64 , iterations : i32 ) -> f64 { let mut result = guess ; for _ in 0 .. iterations { result = iteration ( f , fd , result ) ; } result }
Finds the root of the function f
Finds the root of the function f
f
fn(f64) -> f64
fd
fn(f64) -> f64
guess
f64
iterations
i32
examples
[Finding the square root of a number]






[ Finding the square root of a number ]