Skip to content
Math 221 · Prince Sultan University

Three ways to solve f(x) = 0

Most nonlinear equations have no closed-form answer, so we iterate towards one. This project implements the Bisection, Newton–Raphson and Secant methods in GNU Octave and compares how fast, how accurately and how reliably each one converges on f(x) = x² − 4.

SA SH MA Three-person team · Math 221 Numerical Analysis
Root found x* = 2.000000
~/math221/Project.m iterating
Fastest in general Newton · quadratic
scroll
3
Root-finding methods implemented in GNU Octave
x* = 2
The root every method converged to
10−6
Stopping tolerance on each iteration
1·5·6
Iterations to converge: bisection · Newton · secant
§ 00 · Abstract

When algebra runs out, you iterate.

Problem \[ \text{find } x^{*} \text{ such that } f(x^{*}) = 0, \quad f(x) = x^{2} - 4 \]

Root-finding sits underneath engineering models, optimisation, finance and simulation. When an equation can't be solved exactly, a numerical method starts from a guess and improves it step by step until the change falls below a tolerance.

We studied the three classical approaches, a bracketing method and two open methods, and ran each on the same function with the same tolerance of 10⁻⁶.

All three reached the exact root x = 2. Newton–Raphson showed the quadratic convergence the theory predicts, Secant came close without needing a derivative, and Bisection remained the most dependable.

§ 01 · Methods

One equation, three iteration rules.

Each method trades reliability against speed differently, and that trade-off shows up in the iteration formula itself.

§ 02 · Convergence

How quickly the error disappears.

Absolute error |xn − 2| at every iteration, on a log scale, using the same starting points as the Octave code. On this scale, a steeper downward curve means faster convergence.

Bisection · [a, b] = [1, 3] 1 iter
Newton–Raphson · x₀ = 3 5 iter
Secant · x₀ = 1, x₁ = 3 6 iter

Bisection's single step is a special case: the midpoint of [1, 3] is exactly the root. In general it gains only one binary digit per step. Newton–Raphson roughly doubles the number of correct digits with every iteration.

See the full results
§ 03 · The paper

From the problem to the proof of concept.

  1. 01 Introduction Why nonlinear equations need numerical methods, and what we set out to compare. abstract · objectives →
  2. 02 Methods Derivations, procedures and stopping criteria for all three iteration rules. 3 algorithms →
  3. 03 Results Octave output, iteration tables and plots of each method converging to x = 2. tables · figures →
  4. 04 Comparison & conclusion Speed, accuracy and stability side by side, plus real-world applications. verdict →
§ 04 · Team

Derived by hand, verified in code.

Math 221 · Numerical Analysis · Dr. Nahid Fatima · submitted 16 November 2025.

SA

Shoug Fawaz Alomran

Implementation, documentation and the digital report.

Octave · MkDocs · publishing
SH

Shahad Abunayan

Handwritten derivations and the theoretical explanation.

theory · derivations
MA

Manar Altuwaim

Handwritten calculations and verification of numerical results.

calculation · verification
∎ Q.E.D.

The full write-up, every step shown.

Read the complete report online or download the PDF, with the method derivations, Octave listings, figures and references.