Calculator · Engineering Mathematics

Newton–Raphson Calculator

Root of a single-variable function by Newton's method, xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ), with the derivative either estimated by a central difference or supplied analytically.

Problem definition

Operators + − * / ^, parentheses, pi and e, and sin, cos, tan, asin, acos, atan, exp, sqrt, abs, ln, log, log10. Write 2*x, not 2x.

Results

Root estimate x*1.414
Residual f(x*)4.511e-12
Iterations4
Function evaluations13
Final step |Δx|2.124e-6
StatusConverged
Derivative at x*2.828
Derivative sourcecentral finite difference

Function plot

y = f(x) with x₀ = 1 and root estimate x* = 1.414

Iteration history

Newton–Raphson iterations
nxₙf(xₙ)f′(xₙ)Step Δxxₙ₊₁
01-120.51.5
11.50.253-0.083331.417
21.4170.0069442.833-0.0024511.414
31.4146.007e-62.828-2.124e-61.414

Continue

Open in Root Finding Lab

f(x), x₀, the tolerance and the iteration limit continue into the Lab, with Newton enabled. The Lab always differentiates numerically, so a supplied f′(x) stays on this page.

Assumptions & validity

  • · f is differentiable near the root.
  • · The root is simple, f′(x*) ≠ 0, for the quadratic convergence rate to apply.
  • · The initial guess x₀ is close enough to the root for the tangent iteration to converge.
  • · There is no bracket guarantee: a poor x₀ can diverge or converge to a different root.

Technical reference

xₙ₊₁ = xₙ − f(xₙ) / f′(xₙ)

Central difference fallback: f′(x) ≈ [f(x + h) − f(x − h)] / (2h), h ∝ ∛ε·max(|x|, 1)

Local convergence: |eₙ₊₁| ≈ |f″(x*) / (2 f′(x*))| · |eₙ|²

xₙ
current iterate
f
the function whose root is sought
f′
derivative of f, analytic or numerical
h
finite-difference step
eₙ
error at step n, xₙ − x*
x*
the root

Quadratic convergence holds only locally and only for a simple root (f′(x*) ≠ 0); it degrades to linear at a multiple root.

A near-zero derivative makes the tangent step meaningless, so the method stops instead of jumping to a wild iterate.

The method is not bracketed, so a poor initial guess can diverge or converge to a different root than intended.

The numerical derivative costs two extra evaluations per iteration. With a smooth, well-scaled function the automatic central-difference step balances O(h²) truncation error against O(ε/h) roundoff; the classical balance gives h ∼ ∛ε and a derivative error of order ε^(2/3). That is the accuracy of f′, not of the root: Newton tolerates an approximate derivative, which mainly costs convergence rate rather than final accuracy.

The test for a numerically vanishing derivative is based on machine precision and the local f and x scales, not on the root tolerance you choose — asking for a looser root never changes whether f′(x) is considered resolvable.

The stopping rule is the normalised residual test |f(x)|/fScale ≤ atol + rtol; a negligible step with a large residual is reported as stalled rather than converged.

Because the residual is normalised and the step test is separate and in x, replacing f by c·f (with derivative c·f′) leaves the iterates and the verdict unchanged.

Related tools