num::secant¶
Defined in header <roots/roots.hpp>
template <typename Float = double, std::invocable<Float> Func = scalar_fn>
root_result<Float> secant(Func &&f, Float x0, Float x1, Float tol = Float{1e-10},
idx max_iter = 1000);
Find a root by the secant method: \(x_{k+1} = x_k - f(x_k) \frac{x_k - x_{k-1}}{f(x_k) - f(x_{k-1})}\).