Computing Library › Numerical Methods
Numerical Methods

Newton-Raphson Method

Newton's method follows the tangent line to a better estimate, converging quadratically near a simple root when the derivative is available.

Following the tangent

Newton-Raphson approximates f near the current guess x_n by its tangent line and takes the next guess to be where that line crosses zero. This gives the update x_{n+1} = x_n - f(x_n)/f'(x_n). Each step requires both the function value and its derivative.

python
def newton(f, df, x0, tol=1e-12, nmax=100):
    x = x0
    for _ in range(nmax):
        fx = f(x)
        if abs(fx) < tol:
            return x
        x = x - fx/df(x)
    return x
Kronos motion — when

Quadratic convergence

Near a simple root, Newton's method converges quadratically: the number of correct digits roughly doubles each iteration. If the current error is e, the next error is about C e^2. From a good starting point it reaches machine precision in a handful of steps, far faster than bisection.

When it fails

Newton's method is not globally reliable. A zero or near-zero derivative sends the step to infinity or wildly off target. Poor starting points can cycle, diverge, or converge to the wrong root. At a multiple root convergence degrades to linear, though a modified Newton step restores quadratic speed if the multiplicity is known.

In multivariable form, Newton's method solves systems by replacing the derivative with the Jacobian matrix and dividing by solving a linear system each step. This is the workhorse for the implicit solvers used in stiff plasma and circuit models, including simulations supporting the breeder Hyperion.