pub fn bisection<F>(
f: F,
a: f64,
b: f64,
tol: f64,
max_iter: usize,
) -> Result<f64>Expand description
Find a root of f(x) = 0 using the bisection method.
§Arguments
f- The function to find the root ofa- Left bound of the intervalb- Right bound of the intervaltol- Tolerance for convergencemax_iter- Maximum number of iterations
§Returns
The approximate root x such that f(x) ≈ 0
§Errors
Returns an error if f(a) and f(b) have the same sign or max iterations exceeded