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 |
| Iterations | 4 |
| Function evaluations | 13 |
| Final step |Δx| | 2.124e-6 |
| Status | Converged |
| Derivative at x* | 2.828 |
| Derivative source | central finite difference |
Function plot
Iteration history
| n | xₙ | f(xₙ) | f′(xₙ) | Step Δx | xₙ₊₁ |
|---|---|---|---|---|---|
| 0 | 1 | -1 | 2 | 0.5 | 1.5 |
| 1 | 1.5 | 0.25 | 3 | -0.08333 | 1.417 |
| 2 | 1.417 | 0.006944 | 2.833 | -0.002451 | 1.414 |
| 3 | 1.414 | 6.007e-6 | 2.828 | -2.124e-6 | 1.414 |
Continue
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.