Lab · Engineering Mathematics

Root Finding Lab

One equation, four methods. Each method keeps its own starting data and its own stopping rule, and reports what it cost and where it failed.

Shared problem

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

Problems

The classical benchmark: the positive root is √2 ≈ 1.414214. The rearrangement g(x) = (x + 2/x)/2 is Newton's method written as a fixed-point iteration.

Methods

Bisection

Requires a sign change across [a, b].

Endpoint values
a = 0f(a) = -2[negative]
b = 2f(b) = 2[positive]

Opposite endpoint signs: the bracket contains at least one root if f is continuous on [a, b]. f(x) and [a, b] are independent inputs, so editing the equation can invalidate an existing bracket.

Newton–Raphson

f′(x) by central difference in this Lab.

Secant

Two starting values; no sign change required.

Fixed point

Needs its own rearrangement x = g(x); f(x) above is used only as the residual check.

Method comparison

MethodRoot estimate|f(x*)|IterationsEvaluationsVerdict
Bisection1.4143.154e-113032Converged
Newton–Raphson1.4144.511e-12413Converged
Secant1.4148.882e-1668Converged

Function and root estimates

f(x) over the requested window [0, 2.5]

Convergence history

absolute residual |f(xₙ)| against iteration · logarithmic vertical axis · exact zeros are omitted

A steeper curve is faster convergence per iteration, not per unit of work: compare it against the evaluation counts above, where bisection spends one evaluation per iteration and Newton with a numerical derivative spends three.

Bracket and step history

MethodFinal step |Δx|Bracket widthTermination
Bisection1.863e-93.725e-9converged
Newton–Raphson2.124e-6not a bracketing methodconverged
Secant3.158e-10not a bracketing methodconverged

What this Lab models

One scalar equation f(x) = 0 solved four ways on the same problem: bracketed bisection, Newton–Raphson with a central-difference derivative, the derivative-free secant method, and fixed-point iteration on a rearrangement x = g(x) you supply. Each method keeps its own starting data, its own stopping rule and its own evaluation budget, and the comparison reports iterations, function evaluations, residuals and the exact termination reason.

Model scope

  • · One real variable and one real root at a time; systems of equations and complex roots are outside this Lab.
  • · Bisection needs a genuine sign change across [a, b]; the other three are open methods with no such guarantee.
  • · Fixed-point iteration needs a rearrangement x = g(x) that you choose — no transformation of f(x) into g(x) is invented for you.
  • · Convergence is judged per method: a negligible step with a large residual is reported as stalled, never as success.
  • · Expressions are read by the platform's own safe parser; implicit multiplication is not supported, so write 2*x.

Related calculations