
290 Numerical modeling
(x)
x
f (x)
∆x
x
i
X0
(a)
∆x
A
.
(b)
Figure 11.1. (a) Illustration
of a numerical integration to
obtain the area under a curve.
(b) Detail of the circled area in
(a). See text for discussion.
If f (x)isthe curve shown in Figure 11.1a, for example, ϕ is the area
under the curve between 0 and X.Ifthe function f (x) can be integrated
analytically, ϕ is easily obtained. However, if f (x) cannot be integrated
analytically we can still carry out the integration numerically. (Numerical
integration is sometimes called quadrature.) To do this, first divide the
interval 0 → X into n segments of equal length, x, and then evaluate
the sum:
ϕ =
n
i=1
f (x
i
)x (11.2)
This sum can be obtained by evaluating f (x)atthe midpoint of every
interval x, multiplying by x, and adding the results. The shaded area
in Figure 11.1a would be one such product f (x)x. This procedure makes
use of the fact that an integral is the limit as x → 0ofthe summation
in Equation (11.2).
A common alternative to this is to evaluate f (x)atthe beginning and
end of every interval, x, and then multiply x by the average of these
two values. Because this approximates the shaded area as a trapezoid, it
is called trapezoidal integration.
Neither solution for ϕ is exact. To see why this is the case, consider
Figure 11.1b,which is an enlargement of the circled area in Figure 11.1a.
The point labeled “A”isf (x)atthe midpoint of the interval x. The
product f (x)x overestimates the area under the curve in the interval x
by the size of the shaded area to the left of A and underestimates it by
the size of the shaded area to the right of A.Inthis particular instance,
the latter is larger, so the area under the curve is underestimated. The
magnitude of the final error will depend upon the sum of these individual
errors. The smaller the intervals x, the closer the numerical solution
will be to the exact solution.
More sophisticated techniques for numerical integration are also
available. For example, the shape of a curve between two points may
be approximated by a polynomial (Irons and Shrive, 1987, pp. 64–67).
This technique, sometimes called Gaussian quadrature, produces highly