Calculator · Engineering Mathematics
Secant Method Calculator
Root of a single-variable function from two starting guesses, approximating the derivative with the secant through the last two iterates instead of requiring one 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.521 |
|---|---|
| Residual f(x*) | -1.843e-14 |
| Iterations | 7 |
| Function evaluations | 9 |
| Final step |Δx| | 1.180e-9 |
| Status | Converged |
| Last secant slope [f(xₙ) − f(xₙ₋₁)] / (xₙ − xₙ₋₁) | 5.944 |
Function plot
Iteration history
| n | xₙ₋₁ | xₙ | f(xₙ₋₁) | f(xₙ) | Step Δx | xₙ₊₁ |
|---|---|---|---|---|---|---|
| 1 | 1 | 2 | -2 | 4 | -0.6667 | 1.333 |
| 2 | 2 | 1.333 | 4 | -0.963 | 0.1294 | 1.463 |
| 3 | 1.333 | 1.463 | -0.963 | -0.3333 | 0.06848 | 1.531 |
| 4 | 1.463 | 1.531 | -0.3333 | 0.05863 | -0.01024 | 1.521 |
| 5 | 1.531 | 1.521 | 0.05863 | -0.002693 | 4.499e-4 | 1.521 |
| 6 | 1.521 | 1.521 | -0.002693 | -2.015e-5 | 3.391e-6 | 1.521 |
| 7 | 1.521 | 1.521 | -2.015e-5 | 7.015e-9 | -1.180e-9 | 1.521 |
Continue
f(x), both starting values, the tolerance and the iteration limit continue into the Lab, with the secant method enabled.
Assumptions & validity
- · f is continuous near the root.
- · x₀ and x₁ are distinct starting values.
- · The root is simple, which is what gives the stated order of convergence.
- · No bracket is required or maintained: x₀ and x₁ need not straddle the root, and the iterates may leave the starting interval.
Technical reference
xₙ₊₁ = xₙ − f(xₙ)·(xₙ − xₙ₋₁) / [f(xₙ) − f(xₙ₋₁)]
Secant slope: sₙ = [f(xₙ) − f(xₙ₋₁)] / (xₙ − xₙ₋₁)
Local order of convergence: p = (1 + √5)/2 ≈ 1.618
- xₙ₋₁, xₙ
- the last two iterates
- f
- the function whose root is sought
- sₙ
- the secant slope used in place of f′(xₙ)
- x*
- the root estimate returned by the method
This is Newton with the tangent replaced by the secant through the last two points, so no derivative is needed and one new function evaluation is spent per iteration.
Convergence is superlinear (order ≈ 1.618) locally, for a simple root.
x₀ and x₁ need NOT bracket the root, and the iterates may leave the starting interval — this is not a bracketing method and offers no guarantee of convergence.
A vanishing denominator — two equal function values — stops the method instead of producing an infinite step.
The stopping rule is the normalised residual test |f(x)|/fScale ≤ atol + rtol; a negligible step alongside a large residual is reported as stalled rather than converged.
The secant step is algebraically unchanged by f → c·f, and normalising the residual makes the stopping decision unchanged too.