6.12 Numerical Methods: Root Finding, Integration & ODE Solvers
Key Takeaways
- The Newton-Raphson method converges quadratically but fails when the derivative at the current estimate is near zero, whereas bisection always converges though only linearly.
- The trapezoidal rule needs any number of intervals and is exact for linear functions, while Simpson's one-third rule requires an even number of intervals and is exact up to cubics.
- Simpson's one-third rule weights ordinates in the pattern 1, 4, 2, 4, ..., 4, 1 and the multiplier outside the bracket is h divided by 3.
- Euler's method is a single-step first-order ODE solver, while the fourth-order Runge-Kutta method achieves far higher accuracy for the same step size at the cost of four function evaluations.
Why Numerical Methods Appear on a PSU Paper
Closed-form solutions run out quickly in engineering practice: the Colebrook equation for pipe friction, the transcendental frequency equation for a continuous beam, and most fin and radiation problems admit no algebraic solution. The syllabus therefore lists three numerical topics, and objective items on them are highly formulaic — recall the iteration formula, do two rounds of arithmetic.
Root Finding: Bisection Method
If $f(a)$ and $f(b)$ have opposite signs, a root lies between them. Repeatedly halve the interval, keeping the half in which the sign change persists:
Bisection is always convergent but only linearly so: each iteration gains exactly one bit of accuracy, and after $n$ steps the error bound is $(b-a)/2^{n}$. It cannot find roots of even multiplicity, where the function touches but does not cross the axis.
Root Finding: Newton-Raphson Method
The workhorse method, derived from a first-order Taylor expansion:
Convergence is quadratic near a simple root — the number of correct digits roughly doubles each iteration. The failure modes are equally examinable:
- $f'(x_n) \approx 0$ sends the next iterate far away (a near-horizontal tangent).
- A poor initial guess can diverge or cycle between two values.
- At a root of multiplicity greater than one, convergence degrades to linear.
Worked example. Find $\sqrt{10}$ by solving $f(x) = x^2 - 10 = 0$ with $x_0 = 3$.
Two iterations already give six-figure accuracy against the true value 3.162278. Note the special case: applying Newton-Raphson to $x^2 - N$ gives the classical square-root iteration $x_{n+1} = \tfrac{1}{2}\left(x_n + N/x_n\right)$.
Root Finding: Secant and Regula Falsi
The secant method replaces the derivative by a finite difference:
It needs two starting points and no derivative, converging at order about 1.618. Regula falsi (false position) uses the same formula but always retains a bracketing pair, trading some speed for guaranteed convergence.
Numerical Integration
Both rules divide $[a,b]$ into $n$ strips of width $h = (b-a)/n$ with ordinates $y_0, y_1, \ldots, y_n$.
Trapezoidal rule
Any number of intervals is allowed. The rule fits straight lines between points, so it is exact for linear integrands and its error is proportional to $h^2$.
Simpson's one-third rule
The weighting pattern is $1, 4, 2, 4, 2, \ldots, 4, 1$ — odd-indexed ordinates get 4, even-indexed interior ordinates get 2. It requires an even number of intervals (an odd number of ordinates) because it fits a parabola through each group of three points. It is exact up to cubic integrands and its error goes as $h^4$.
Simpson's three-eighths rule
This requires the number of intervals to be a multiple of 3.
| Rule | Intervals required | Exact for | Error order |
|---|---|---|---|
| Trapezoidal | Any $n$ | Degree 1 | $h^2$ |
| Simpson 1/3 | Even $n$ | Degree 3 | $h^4$ |
| Simpson 3/8 | Multiple of 3 | Degree 3 | $h^4$ |
Worked example. Evaluate $\int_0^2 x^3 dx$ with $n = 2$, so $h = 1$ and ordinates $y_0 = 0$, $y_1 = 1$, $y_2 = 8$.
Simpson: $\dfrac{1}{3}\left[(0 + 8) + 4(1)\right] = \dfrac{12}{3} = 4$ — the exact answer, since Simpson is exact for cubics.
Trapezoidal: $\dfrac{1}{2}\left[(0+8) + 2(1)\right] = 5$, an error of 25%. This contrast is a favourite examination point.
Numerical Solution of Differential Equations
For $\dfrac{dy}{dx} = f(x,y)$ with $y(x_0) = y_0$:
Euler's method (single-step, first order):
Simple but crude; the error per step is proportional to $h^2$ and accumulates.
Modified Euler / Heun (predictor-corrector, second order):
Fourth-order Runge-Kutta, the standard multi-stage method:
Four function evaluations per step buy fourth-order accuracy, which is why RK4 is the default in almost every engineering solver. Euler's method is the special case obtained by keeping only $k_1$.
Simpson's one-third rule requires that the number of sub-intervals be:
The Newton-Raphson method may fail to converge when:
Using Simpson's one-third rule with two sub-intervals to evaluate the integral of x^3 from 0 to 2 gives:
Compared with Euler's method, the fourth-order Runge-Kutta method for solving an ordinary differential equation: