pub fn newton_raphson<F, D>(
f: F,
derivative: D,
initial: f64,
options: RootOptions,
) -> Result<f64, RootError>Expand description
Finds a root with Newton-Raphson iteration.
This is an approximate iterative solver, not an exact equation helper. The tolerance must be finite and positive. Non-finite values and approximately zero derivatives return explicit errors.
ยงErrors
Returns RootError::InvalidTolerance when the tolerance is not
finite and positive; RootError::NonFiniteValue when the initial
value, a function evaluation, a derivative evaluation, or the next
iterate is non-finite; RootError::ZeroDerivative when the
derivative is approximately zero; and
RootError::MaxIterationsReached when the iteration budget is
exhausted without convergence.