Subject: Civil Engineering Chapter: Engineering Mathematics Topic: 1.8 Numerical Methods
Numerical methods are the techniques by which mathematical problems that cannot be solved exactly, or can be solved only with great difficulty, are approximated by systematic arithmetic procedures. In civil engineering, numerical methods are used wherever exact analytical solutions are unavailable: the roots of the polynomial equations that arise in buckling analysis, the solution of the large systems of simultaneous equations of frame analysis, the numerical integration of the settlement of a soil stratum, and the solution of the differential equations that govern groundwater flow and beam deflection. Competitive examinations in civil engineering test the standard numerical methods directly, with questions that expect the candidate to carry out one or two iterations of a prescribed algorithm.
The need for numerical methods arises because most real engineering problems are too complex for closed-form solutions. The transcendental equation that describes the critical depth in a channel, for example, has no simple algebraic solution, so its root must be located numerically. Similarly, the deflection of a beam under a complicated load distribution may require numerical integration of the bending moment function, and the analysis of a large frame involves solving hundreds of simultaneous linear equations that are handled numerically on computers. Every practising civil engineer uses numerical methods, either directly or through the software packages that implement them, so a conceptual understanding of the algorithms is part of the professional's mathematical toolkit.
In this chapter we will study the principal numerical methods under four headings: the solution of algebraic and transcendental equations by the bisection method, the false position method, the Newton-Raphson method and fixed-point iteration; the solution of simultaneous linear equations by Gaussian elimination, Gauss-Seidel iteration and matrix inversion; numerical interpolation and numerical integration by the trapezoidal rule and Simpson's rules; and the numerical solution of ordinary differential equations by Euler's method and the Runge-Kutta methods. Each method is presented with its formula, its convergence properties and a fully worked numerical example in the examination style.
An algebraic equation is one that involves only integer powers of the unknown, such as x cubed - 2x - 5 = 0, while a transcendental equation involves exponential, logarithmic or trigonometric functions, such as x log x - 1.2 = 0. The bisection method locates a root by repeatedly halving an interval in which the function changes sign. If a function is continuous and f(a) and f(b) have opposite signs, a root lies between a and b; the midpoint is evaluated, and the half-interval containing the sign change is kept. Each iteration halves the interval, so ten iterations reduce the interval by a factor of about one thousand. The bisection method always converges, but it is relatively slow.
The false position method, also called the regula falsi method, is an improvement on bisection in which the next approximation is the intersection of the chord joining the two endpoints with the x-axis. The formula for the next point is x = [a f(b) - b f(a)] divided by [f(b) - f(a)]. The method usually converges faster than bisection because it uses the values of the function, not merely their signs, to choose the next point. It preserves the sign-change property, so convergence is guaranteed for a continuous function with opposite signs at the endpoints.
The Newton-Raphson method is the most powerful of the root-finding methods and the one most frequently examined. If x0 is an approximation to a root of f(x) = 0, then the next approximation is x1 = x0 - f(x0) divided by f prime(x0), where f prime is the derivative. Geometrically, each iteration extends the tangent to the curve at the current point to the x-axis. The Newton-Raphson method converges very rapidly, doubling the number of correct digits at each step, provided the initial guess is reasonably close to the root and the derivative is not zero at the root. Fixed-point iteration rewrites the equation as x = g(x) and iterates x(n+1) = g(xn), which converges when the absolute value of g prime is less than 1 near the root.
Example 1: Using the Newton-Raphson method with an initial guess of 2, find the root of x cubed - 2x - 5 = 0 correct to one iteration. Solution: f(x) = x cubed - 2x - 5, so f prime(x) = 3x squared - 2. At x = 2, f(2) = 8 - 4 - 5 = -1 and f prime(2) = 12 - 2 = 10. Hence x1 = 2 - (-1)/10 = 2 + 0.1 = 2.1.
Example 2: A function f is continuous with f(1) = -2 and f(2) = 3. Using the bisection method, find the first approximation to the root. Solution: Since f(1) and f(2) have opposite signs, a root lies between 1 and 2. The midpoint is 1.5, which is the first approximation to the root.
The direct methods for solving simultaneous linear equations eliminate unknowns in a systematic way. Gaussian elimination transforms the augmented matrix into an upper triangular matrix by elementary row operations, after which the solution is obtained by back-substitution, starting from the last equation and working upward. Partial pivoting, in which the largest coefficient in the column is brought to the diagonal position, improves numerical stability by avoiding division by small numbers. Gaussian elimination is the standard direct method and is used for systems of any size.
The Gauss-Seidel method is an iterative method in which each unknown is updated using the most recently computed values of the other unknowns. The method starts from an initial guess, and each iteration sweeps through the equations, substituting the latest approximations. The iterations continue until the changes between successive approximations become smaller than a prescribed tolerance. The Gauss-Seidel method converges when the coefficient matrix is diagonally dominant, that is, when the diagonal element in each row is larger in magnitude than the sum of the magnitudes of the off-diagonal elements, a condition satisfied by many structural stiffness matrices. The iterative methods are preferred for very large systems because they require less memory than elimination.
The choice between direct and iterative methods depends on the problem. For small systems and when a very accurate answer is required, Gaussian elimination is preferred. For large sparse systems, such as those arising in finite element analysis of a dam or a bridge deck, iterative methods such as the Gauss-Seidel method are faster. The rate of convergence of the iterative methods depends on the condition of the matrix, and convergence can be accelerated by relaxation techniques. In examination questions, two to three iterations of the Gauss-Seidel method are typically sufficient to demonstrate the procedure.
Example 3: Solve the system x + y = 5, x - y = 1 by Gaussian elimination. Solution: From the second equation, x = 1 + y. Substituting into the first, (1 + y) + y = 5, so 2y = 4 and y = 2. Then x = 1 + 2 = 3. Hence x = 3 and y = 2.
Example 4: Perform one Gauss-Seidel iteration for the system 10x + y = 11, x + 10y = 12, starting from x = y = 0. Solution: From the first equation, x = (11 - y)/10 = 11/10 = 1.1 using y = 0. From the second equation, y = (12 - x)/10 = (12 - 1.1)/10 = 10.9/10 = 1.09. After one iteration, x = 1.1 and y = 1.09.
Interpolation constructs an approximate value of a function at a point lying between tabulated values. The simplest form is linear interpolation, which joins two known points by a straight line and reads off the intermediate value. Newton's forward and backward difference formulas use finite differences of a data table to build polynomial approximations, and Lagrange's interpolation formula constructs the interpolating polynomial without using differences. In civil engineering, interpolation is used to extract values from survey tables, from the tabulated properties of sections, and from soil classification charts, where intermediate values must be read accurately.
Numerical integration approximates a definite integral by summing contributions over subintervals. The trapezoidal rule divides the interval into n equal strips and approximates the integrand by a straight line on each strip, giving the result h/2 times [f(x0) + 2(f(x1) + f(x2) + ... + f(x(n-1))) + f(xn)], where h is the width of each strip. Simpson's one-third rule approximates the integrand by a parabola on pairs of strips, giving h/3 times [f(x0) + 4(f(x1) + f(x3) + ...) + 2(f(x2) + f(x4) + ...) + f(xn)], and it requires an even number of strips. Simpson's three-eighth rule uses cubics on triples of strips. Simpson's rules are substantially more accurate than the trapezoidal rule for smooth functions and are therefore preferred when the function is well behaved.
Numerical integration is used in civil engineering to compute the area of irregular sections in quantity surveying, the volume of earthworks by the prismoidal formula, the discharge through a channel from a velocity profile, and the settlement of soil layers from compressibility data. In examination questions, the function values are given at equally spaced points, the strip width h is read from the table, and the appropriate formula is applied directly. It is important to check that the number of strips matches the requirement of the rule before applying it.
Example 5: Evaluate the integral of x cubed from 1 to 2 using the trapezoidal rule with strip width h = 0.5. Solution: The points are x = 1, 1.5, 2 with f(x) = x cubed, giving f(1) = 1, f(1.5) = 3.375, f(2) = 8. The trapezoidal rule gives (0.5/2)[1 + 2(3.375) + 8] = 0.25(1 + 6.75 + 8) = 0.25 x 15.75 = 3.9375. The exact value is 3.75, so the approximation is close.
Example 6: Evaluate the integral of x from 0 to 2 using Simpson's one-third rule with h = 0.5. Solution: Points x = 0, 0.5, 1, 1.5, 2 with values 0, 0.5, 1, 1.5, 2. Simpson's rule gives (0.5/3)[0 + 4(0.5 + 1.5) + 2(1) + 2] = (1/6)[0 + 8 + 2 + 2] = 12/6 = 2. The exact value of the integral of x from 0 to 2 is 2, so Simpson's rule is exact for a linear function.
Many civil engineering problems are governed by ordinary differential equations, such as the equation for beam deflection, dy/dx = M/(E I), where M is the bending moment, E is the modulus of elasticity and I is the moment of inertia. When the differential equation cannot be solved analytically, numerical methods step through the domain computing the value of y at each point. Euler's method is the simplest: starting from the initial condition, each step advances y by h times the derivative evaluated at the current point, so y(n+1) = y(n) + h f(x(n), y(n)). Euler's method is easy to apply but has limited accuracy, since it uses only the first term of the Taylor expansion.
The Runge-Kutta methods improve accuracy by evaluating the derivative at several intermediate points within each step. The classical fourth-order Runge-Kutta method, known as RK4, computes four slope estimates k1, k2, k3 and k4 at each step and combines them in a weighted average to advance the solution. The formula for y(n+1) is y(n) + (h/6)(k1 + 2k2 + 2k3 + k4), where the k values are defined in terms of the function at the current and predicted points. The RK4 method is far more accurate than Euler's method for the same step size and is the workhorse of numerical differential equation solvers in engineering software.
The choice of step size h is critical in numerical solution of differential equations. A smaller step gives better accuracy but requires more computations, while a larger step may give unstable or inaccurate results. The error of Euler's method is proportional to h, while the error of RK4 is proportional to h to the power 4, so halving the step reduces the Euler error by half but the RK4 error by sixteen. In examination questions, the candidate is usually asked to perform one or two steps of Euler's or RK4, and the correct procedure is to follow the formulas step by step with careful arithmetic.
Example 7: Using Euler's method with h = 0.5, find y(1) given dy/dx = x + y, y(0) = 1. Solution: At x = 0, y = 1, the derivative is 0 + 1 = 1. Then y(0.5) = y(0) + h(1) = 1 + 0.5 = 1.5. At x = 0.5, the derivative is 0.5 + 1.5 = 2. Then y(1) = 1.5 + 0.5(2) = 2.5.
| Method | Iteration Formula | Convergence |
|---|---|---|
| Bisection | midpoint of sign-change interval | slow, guaranteed |
| False position | x = [a f(b) - b f(a)]/[f(b) - f(a)] | faster, guaranteed |
| Newton-Raphson | x(n+1) = x(n) - f(x(n))/f prime(x(n)) | very fast, quadratic |
| Fixed point | x(n+1) = g(x(n)) | linear, conditional |
| Method | Formula | Order / Strips |
|---|---|---|
| Trapezoidal | (h/2)[f0 + 2(f1+...+f(n-1)) + fn] | any number of strips |
| Simpson one-third | (h/3)[f0 + 4(odd) + 2(even) + fn] | even strips |
| Simpson three-eighth | (3h/8)[f0 + 3(sum) + 2(others) + fn] | multiple of three |
| Euler's method | y(n+1) = y(n) + h f(x(n), y(n)) | error ~ h |
| Runge-Kutta fourth | y(n+1) = y(n) + (h/6)(k1+2k2+2k3+k4) | error ~ h4 |
flowchart TD
A[Numerical Methods] --> B[Root finding]
A --> C[Linear equations]
A --> D[Interpolation]
A --> E[Numerical integration]
A --> F[Differential equations]
B --> B1[Bisection]
B --> B2[False position]
B --> B3[Newton-Raphson]
C --> C1[Gaussian elimination]
C --> C2[Gauss-Seidel iteration]
D --> D1[Linear interpolation]
D --> D2[Newton forward and backward]
E --> E1[Trapezoidal rule]
E --> E2[Simpson one-third rule]
F --> F1[Euler method]
F --> F2[Runge-Kutta fourth order]
The following diagrams illustrate the geometric idea of the Newton-Raphson method and the Simpson's one-third rule for numerical integration.
Numerical methods are the practical arithmetic of engineering mathematics, converting the continuous equations of physics and mechanics into the finite computations that a civil engineer, a calculator or a computer can perform. In this chapter we have studied the bisection, false position, Newton-Raphson and fixed-point methods for finding roots, the Gaussian elimination and Gauss-Seidel methods for simultaneous linear equations, interpolation and the trapezoidal and Simpson's rules for numerical integration, and Euler's and the Runge-Kutta methods for ordinary differential equations. Worked numerical examples have demonstrated each algorithm step by step, and the quick revision tables and mind map summarise every formula and convergence property. Because so many civil engineering analyses, from the buckling of a column to the flow of groundwater, rest on equations that lack exact solutions, these numerical techniques are not an optional extra but an essential professional skill. A candidate who masters the standard algorithms, their conditions of applicability and their rates of convergence will handle the numerical questions in competitive examinations with confidence and will carry the ability to solve real engineering problems into professional practice.