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].
| a = 0 | f(a) = -2 | [negative] |
|---|---|---|
| b = 2 | f(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
| Method | Root estimate | |f(x*)| | Iterations | Evaluations | Verdict |
|---|---|---|---|---|---|
| Bisection | 1.414 | 3.154e-11 | 30 | 32 | Converged |
| Newton–Raphson | 1.414 | 4.511e-12 | 4 | 13 | Converged |
| Secant | 1.414 | 8.882e-16 | 6 | 8 | Converged |
Function and root estimates
Convergence history
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
| Method | Final step |Δx| | Bracket width | Termination |
|---|---|---|---|
| Bisection | 1.863e-9 | 3.725e-9 | converged |
| Newton–Raphson | 2.124e-6 | not a bracketing method | converged |
| Secant | 3.158e-10 | not a bracketing method | converged |
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.