Tangent-line root finder · iteration-by-iteration audit
Newton Method Iteration Calculator
Choose a function family, set a starting point and stopping tolerance, then inspect every Newton update. The result distinguishes a small step from a small residual and warns when the derivative is too small or the iteration cap is reached.
Set the root problem
Domain note: The selected function is evaluated with ordinary real-number browser arithmetic. A starting point can determine which root is reached or whether convergence occurs.
Convergence staircase
| k | xₖ | f(xₖ) | f′(xₖ) | Δx = −f/f′ | xₖ₊₁ |
|---|---|---|---|---|---|
| 0 | 1.0000000000 | −1.0000000000 | 2.0000000000 | 0.5000000000 | 1.5000000000 |
| 1 | 1.5000000000 | 0.2500000000 | 3.0000000000 | −0.0833333333 | 1.4166666667 |
| 2 | 1.4166666667 | 0.0069444444 | 2.8333333333 | −0.0024509804 | 1.4142156863 |
| 3 | 1.4142156863 | 0.0000060073 | 2.8284313725 | −0.0000021239 | 1.4142135624 |
| 4 | 1.4142135624 | 0.0000000000 | 2.8284271247 | −0.0000000000 | 1.4142135624 |
| 5 | |||||
| 6 | |||||
| 7 | |||||
| 8 | |||||
| 9 | |||||
| 10 | |||||
| 11 |
All five updates are shown.
The sequence reached a point where both the proposed update and function residual meet the selected tolerance. Substitution gives x² − 2 ≈ 0.
Newton’s tangent-line update
Newton’s method replaces a nonlinear function by its tangent line near the current estimate. The tangent crosses the x-axis at the next estimate. Algebraically, xₖ₊₁ = xₖ − f(xₖ)/f′(xₖ). The method needs both a function and its derivative.
When the starting point is sufficiently close to a simple root and the function is smooth, the number of correct digits often roughly doubles each iteration. This quadratic convergence makes Newton’s method fast, but it is local rather than guaranteed from every start.
Δxₖ = −f(xₖ)/f′(xₖ); xₖ₊₁ = xₖ + Δxₖ
Stop here only when |Δxₖ| ≤ tolerance and |f(xₖ₊₁)| ≤ tolerance.
Worked square-root example
To find √2, solve f(x)=x²−2=0 with derivative f′(x)=2x. Starting at x₀=1 gives correction −(−1)/2=0.5 and x₁=1.5. The next correction is −0.25/3=−0.0833333, producing x₂≈1.4166667.
Further updates yield approximately 1.4142156863 and 1.4142135624. By the fifth update, the step is around 1.6×10⁻¹² and the residual is at floating-point noise level. The result agrees with the browser’s independent √2 evaluation.
For x²−c, the update can also be written xₖ₊₁=(xₖ+c/xₖ)/2. This Babylonian form is algebraically the same Newton step, provided xₖ is nonzero.
Function families in this calculator
x² − c
Finds a real square root when c is nonnegative. Positive and negative starts can approach opposite roots.
x³ − c
Finds a real cube root for positive or negative c, with derivative 3x².
Transcendental fixed points
cos(x)−x and e^(−x)−x demonstrate roots without an elementary closed form.
The constant c is ignored for the two transcendental options. The function selector provides exact derivatives rather than attempting to parse arbitrary text, preventing ambiguous syntax and unsafe code evaluation.
Why both stopping tests matter
A small update can occur because the derivative is huge, even when the residual remains unacceptable. A small residual can occur in a very flat scaled function while x is still uncertain. Requiring both offers a clearer default certificate, though applications may need relative tolerances.
An absolute tolerance of 10⁻¹⁰ may be strict for values near zero and loose for roots near 10¹². A scale-aware test can compare |Δx| with tolerance × max(1,|x|) and compare residual with a function scale. This educational calculator keeps one absolute value visible.
Displayed decimal rounding is separate from the internal stop. A table may show a zero correction while hidden digits remain nonzero. The scientific-notation metrics retain evidence below the ordinary decimal display.
Derivative hazards
If f′(xₖ) is zero or very small, the tangent is horizontal and division can create an enormous jump. The derivative floor stops before that update. Increasing the floor can be prudent when coefficients or measured inputs are uncertain.
Repeated roots converge more slowly because the derivative also approaches zero. A modified Newton step that multiplies f/f′ by known multiplicity can restore faster convergence. Unknown multiplicity requires diagnostic care.
Numerical derivatives introduce step-size error and cancellation. The calculator uses analytic derivatives for its four families. For a custom scientific model, automatic differentiation or a verified analytic derivative is generally preferable.
Failure and cycling patterns
Newton iterations can diverge, bounce between values, enter a cycle, or reach a different root than expected. A maximum iteration cap prevents an endless loop but does not transform nonconvergence into a root. Inspect the sequence and residual.
Bracketing methods such as bisection are slower but guarantee convergence for a continuous sign-changing interval. A hybrid method can keep Newton’s speed while rejecting steps that leave a bracket. Secant methods avoid derivatives but usually converge more slowly than a successful Newton run.
A discontinuity or domain boundary can invalidate tangent reasoning. Logarithms require positive inputs, square roots restrict domains, and overflow can turn an otherwise valid formula into infinity. Choose a start within the intended real domain.
Starting values and multiple roots
For functions with several roots, starting values partition the line into basins of attraction, sometimes with complicated boundaries. A converged result is one root, not proof that it is the only root. Scan the domain, use sign information, or analyze derivatives to locate alternatives.
For x²−c with positive c, a positive start normally reaches +√c and a negative start reaches −√c. Starting at zero fails immediately because the derivative is zero. For cube roots, a start near zero can produce a large jump when c is nonzero.
Record the start, formula, tolerance, derivative floor, iteration cap, and final residual. Without these, a numeric root is difficult to reproduce.
Deriving the tangent update
Near xₖ, the first-order Taylor approximation is f(x) ≈ f(xₖ) + f′(xₖ)(x−xₖ). Set this local line equal to zero and solve for x. The result is x = xₖ − f(xₖ)/f′(xₖ), which becomes the next iterate.
The neglected Taylor terms explain both speed and risk. Close to a simple root, second-order error dominates and the linear model is excellent. Far away, curvature can make the tangent’s x-intercept a poor guide. A tangent may cross the axis outside the function’s domain even when the current point is valid.
Newton’s method is invariant to multiplying f by a nonzero constant because that factor appears in both numerator and derivative and cancels. Residual magnitude, however, does change under scaling, which is why a universal absolute residual threshold needs context.
Quadratic convergence and multiplicity
For a sufficiently smooth function and simple root r with f′(r) ≠ 0, the next error is approximately a constant times the square of the current error. If eₖ = xₖ−r, then |eₖ₊₁| is roughly C|eₖ|² near the root. Squaring a small error produces the rapid digit gain seen in the √2 table.
At a root of multiplicity q greater than one, ordinary Newton convergence typically becomes linear. The modified step xₖ₊₁ = xₖ − qf(xₖ)/f′(xₖ) can restore quadratic behavior when q is known. Estimating multiplicity from noisy numerical data can itself be unstable.
Quadratic convergence is an asymptotic statement, not a promise from iteration zero. Early steps may improve slowly or move away before entering the local convergence region.
Damping and bracket safeguards
A damped Newton update uses xₖ₊₁ = xₖ + λΔx with 0 < λ ≤ 1. Reducing λ can keep an iterate inside a valid domain or ensure the residual decreases. Line-search algorithms choose λ systematically instead of applying a fixed fraction.
If a continuous function has opposite signs at endpoints, a bracket can be maintained. Accept a Newton proposal only when it lies inside the bracket and behaves well; otherwise take a bisection step. Each accepted point then updates the endpoint with the matching sign.
These safeguards trade some speed for reliability. They are especially valuable in scientific software where a failed evaluation is expensive or where one start must work across a broad parameter range. This calculator intentionally exposes the undamped textbook method so the raw sequence remains easy to audit.
Relative tolerance and reproducible reporting
For a root near one million, a step of 10⁻⁸ is tiny relative to x; for a root near 10⁻¹², that same step is enormous. A common relative test is |Δx| ≤ atol + rtol|x|. Residual tests can likewise use a characteristic function scale.
Reproducible reporting identifies the function, derivative, parameters, start, precision type, absolute and relative tolerances, derivative safeguard, maximum iterations, final iterate, final residual, and termination reason. Merely saying “Newton converged” hides the numerical contract.
When inputs are measurements, solve accuracy should not exceed their justified precision. A 12-digit root of a model coefficient known to three significant figures does not create nine extra meaningful digits.
Verification after convergence
Substitute the result into the original function using independent code or higher precision when consequences matter. Check that nearby values behave consistently with the desired crossing and that the root lies within a physically meaningful range.
For polynomial roots, synthetic division or factor relationships can provide additional checks. For a fixed-point equation, compare both sides directly.
Numerical boundary: Convergence of floating-point iterations is evidence about the entered function and settings, not a symbolic proof or an error bound for uncertain model inputs.
Frequently asked questions
Why did Newton’s method find a different root?
The starting value determines the attraction basin when several roots exist.
What happens when the derivative is zero?
The tangent update is undefined, so the calculator stops before division.
Does reaching the iteration cap mean no root exists?
No. It means this run did not satisfy the selected stop; another start or method may work.
Why check residual and step?
Either one alone can look small for scaling reasons without certifying both a stable iterate and a near-zero function value.
Can Newton’s method find complex roots?
Not in this real-number interface. Complex iteration needs complex arithmetic and different visualization.
How many decimals are trustworthy?
Use residuals, conditioning, input accuracy, and independent verification rather than the displayed digit count alone.
References
NIST Digital Library of Mathematical Functions — nonlinear equations and iteration
Wolfram MathWorld — Newton’s method
SciPy documentation — Newton, secant, and Halley root finding