Numerical Approximations (Continued)
Two additional methods of integration by numerical approximations, which we shall describe in this section, are the Midpoint Rule and Simpson's Rule. In the Midpoint Rule the approximation to the integral [math]\int_a^b f[/math] is a Riemann sum [math]\sum_{i=1}^{n} f(x_i^*)(x_i - x_{i-1})[/math] in which each [math]x_i^*[/math] is taken to be the midpoint of the subinterval [math][x_{i-1}, x_i][/math]. In more detail: Let [math]f[/math] be a function which is integrable over [math][a, b][/math]. For every positive integer [math]n[/math], let [math]h = \frac{b - a}{n}[/math], and let [math]\sigma_n = \{ x_0, . . ., x_n \}[/math] be the partition defined by
As a result, it follows that
If we take [math]x_i^*[/math] to be the midpoint of the subinterval [math][x_{i-1}, x_i][/math], then
The Riemann sum used as the approximation to the integral in the Midpoint Rule will be denoted by [math]M_n[/math]. It is given by
In studying the Trapezoid Rule, we found it convenient to use the abbreviation [math]y_i = f(x_i)[/math], for [math]i = 0, ... , n.[/math] By analogy, we shall here let
Then
and we express the Midpoint Rule for numerical integration by the formula
If [math]f(x) \geq 0[/math] for every [math]x[/math] in [math][a, b][/math], the Midpoint Rule approximates the integral [math]\int_a^b f[/math], which is the area under the curve, by a sum of areas of rectangles, as illustrated in Figure 6.
An alternative to approximating the integral by a Riemann sum is to use straight-line segments which are tangent to the curve [math]y = f(x)[/math] at the midpoints of the subintervals. An example is shown in Figure 7, in which
[math]\int_a^b f[/math] is approximated by the sum of the areas of the three shaded trapezoids. This method yields the so-called Tangent Formula. It turns out, however, that the Tangent Formula is the same as the Midpoint Rule. The reason can be seen by looking at Figure 8, in which the area of the shaded trapezoid with one side tangent to the curve is the ith term in the approximating sum used in the Tangent Formula. The area of this trapezoid is equal to [math]\frac{h}{2} (y' + y'')[/math], where [math]y'[/math] and [math]y''[/math] are the lengths of the bases. However, by elementary geometry the trapezoid can be seen to have the same area as the rectangle with base [math][x_{i-1}, x_i][/math] and altitude [math]y_{i-1/2}[/math] The area of the rectangle is [math]h \cdot y_{i-1/2}[/math], and so
(Incidentally, note that this equation is true regardless of whether [math]y'[/math], [math]y''[/math], and [math]y_{i-1/2}[/math] are positive, negative, or zero.) Since the product [math]h \cdot y_{i-1/2}[/math] is the ith term in the midpoint approximation [math]M_n[/math], we conclude that the Tangent Formula and the Midpoint Rule, although differently motivated, are in fact the same.
ExampleApproximate [math]\int_{-1}^1 (x^2 + x^3) dx[/math] using the Midpoint Rule. This is the same integral which we evaluated in Section 2 by the Trapezoid Rule. To compare the two methods, we shall again take [math]n = 8[/math] and
In addition, since [math]y_{i-1/2} = f(x_i^{*})[/math], we have a pair of useful formulas:
Table 2 contains the numbers for the computation of [math]M_8[/math].
[math]i[/math] | [math]y_{i - 1/2} = \frac{(2i - 9)^2(2i - 1)}{8^3}[/math] |
1 | [math]y_{1/2} = \frac{49}{8^3}[/math] |
2 | [math]y_{3/2} = \frac{25 \cdot 3}{8^3} = \frac{75}{8^3}[/math] |
3 | [math]y_{5/2} = \frac{9 \cdot 5}{8^3} = \frac{45}{8^3}[/math] |
4 | [math]y_{7/2} = \frac{7}{8^3}[/math] |
5 | [math]y_{9/2} = \frac{9}{8^3}[/math] |
6 | [math]y_{11/2} = \frac{9 \cdot 11}{8^3} = \frac{99}{8^3}[/math] |
7 | [math]y_{13/2} = \frac{25 \cdot 13}{8^3} = \frac{325}{8^3}[/math] |
8 | [math]y_{15/2} = \frac{49 \cdot 15}{8^3} = \frac{735}{8^3}[/math] |
Hence we obtain
as an approximation to the integral [math]\int_{-1}^1 (x^2 + x^3) dx[/math]. The value obtained earlier with the Trapezoid Rule was [math]T_8 = \frac{11}{16}[/math]. Since the true value is given by
In any application of the Midpoint Rule, the error [math]| \int_a^b f - M_n |[/math] can be made arbitrarily small by taking [math]n[/math] sufficiently large. That is, we assert that
This theorem is easier to prove than the corresponding one for the Trapezoid Rule because every approximation [math]M_n[/math] is, as it stands, a Riemann sum of [math]f[/math] relative to the partition [math]\sigma_n[/math] of [math][a, b][/math]. Since [math]|| \sigma_n || \rightarrow 0[/math] as [math]n \rightarrow \infty[/math], it is a direct corollary of the fundamental theorem on the limit of Riemann sums [(2.1), page 414] that [math]\lim_{n \rightarrow \infty} M_n = \int_a^b f[/math]. A means of estimating the error [math]| \int_a^b f - M_n |[/math] in a particular application of the Midpoint Rule is provided by the following theorem:
If the second derivative [math]f''[/math] is continuous at every point of [math][a, b][/math], then there exists a number [math]c[/math] such that [math]a \lt c \lt b[/math] and
As with the analogous theorem for the Trapezoid Rule [(2.4), page 419], this theorem can be proved by first reducing it to the case [math]n = 1[/math]. A discussion of the error term can be found in [math]R[/math]. Courant and F. John, Introduction to Calculus and Analysis, Volume I, Interscience Publishers (Wiley), 1965, pages 486 and 487. Theorem (3.3) can be used to obtain an upper bound on the error [math]|\int_a^b f - M_n|[/math] provided the second derivative [math]f''[/math] is bounded on the interval [math][a, b][/math]. That is, if there exists a real number [math]K[/math] such that
For the one integral we computed by both methods, the Midpoint Rule gave a better approximation than the Trapezoid Rule by a factor of 2. Comparison of Theorem (3.3) with (2.4) shows that in general this ratio can be expected. Geometrically, the different methods of numerical integration described thus far in this and the preceding section are all based on approximating the area under a curve by a sum of areas of rectangles or trapezoids. Analytically, in each method the approximation to [math]\int_a^b f[/math] has been obtained by replacing [math]f[/math] over every subinterval by a linear function. In Simpson's Rule, however, we shall replace [math]f[/math] over each subinterval by a quadratic polynomial [math]Ax^2 + Bx + C[/math]. The corresponding area problem is the simple one of finding the area under a parabola (or a straight line, if [math]A = 0[/math]). For most integrals, Simpson's Rule gives much greater accuracy for the same value of [math]h[/math]. Let [math]f[/math] be a function which is integrable over the interval [math][a, b][/math]. The procedure differs from the others in that we consider only partitions of [math][a, b][/math] into an even number of subintervals. Thus for an arbitrary even integer [math]n \gt 0[/math], we set [math]h = \frac{b - a}{n}[/math], and let
The sum of these integrals, which we shall denote [math]S_n[/math], is the approximation to [math]\int_a^b f[/math] prescribed by Simpson's Rule. Hence
We now prove equation (1). The algebra is significantly simpler if we write [math]q_{i}(x)[/math] in terms of [math]x - x_{2i-1}[/math] instead of [math]x[/math] (see Figure 10). Hence we let
Setting first [math]x = x_{2i-1}[/math] in equation (2), we obtain
Example
Using [math]n = 4[/math], find an approximate value of [math]\int_0^1 \frac{1}{1+ x^2} dx[/math] by Simpson's Rule. We have [math]h = \frac{1 - 0}{4} = \frac{1}{4}[/math],
Table 3 contains the numbers necessary for the computation.
[math]i[/math] | 0 | 1 | 2 | 3 | 4\vspace {1ex} |
[math]y_i = \frac{16}{16 + i^2}[/math] | 1 | [math]\frac{16}{17}[/math] | [math]\frac{16}{20}[/math] | [math]\frac{16}{25}[/math] | [math]\frac{16}{32}[/math] \vspace {1ex} |
Hence
Just as with the other two methods of integration by numerical approximation, the error [math]| \int_a^b f - S_n |[/math] can be made arbitrarily small by taking [math]n[/math] aufficiently large. That is, we have the following theorem, which we state without proof.
In addition, the next theorem can be used to estimate the error in a particular application of Simpson's Rule.
If the fourth derivative [math]f^{(4)}[/math] is continuous at every point of [math][a, b][/math], then there exists a number [math]c[/math] such that [math]a \lt c \lt b[/math] and
For an outline of a proof, see J. M. H. Olmsted, Advanced Calculus, Appleton-Century-Crofts, 1961, page 119. The fourth derivative of every cubic polynomial is identically zero, for if
General references
Doyle, Peter G. (2008). "Crowell and Slesnick's Calculus with Analytic Geometry" (PDF). Retrieved Oct 29, 2024.