Numerical integration

Consider a differential equation of the form:

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.

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) is the curve shown in Figure 11.1a, for example, y is the area under the curve between 0 and X. If the function f (x) can be integrated analytically, y is easily obtained. However, iff (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, Ax, and then evaluate the sum:

This sum can be obtained by evaluating f (x) at the midpoint of every interval Ax, multiplying by Ax, and adding the results. The shaded area in Figure 11.1a would be one such product f (x) Ax. This procedure makes use of the fact that an integral is the limit as Ax ^ 0 of the summation in Equation (11.2).

A common alternative to this is to evaluate f (x) at the beginning and end of every interval, Ax, and then multiply Ax by the average of these two values. Because this approximates the shaded area as a trapezoid, it is called trapezoidal integration.

Neither solution for y 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" is f (x) at the midpoint of the interval Ax. The productf (x) Ax overestimates the area under the curve in the interval Ax 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. In this 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 Ax, 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 n v = f (Xi )Ax

accurate results with fewer calculations, but the details are beyond the scope of this chapter.

0 0

Post a comment