Active Calculus · 5: Finding Antiderivatives and Evaluating Integrals

5.6: Numerical Integration

Motivating Questions
  • How do we accurately evaluate a definite integral such as ∫01e−x2 dx\int_0^1 e^{-x^2} \, dx when we cannot use the First Fundamental Theorem of Calculus because the integrand lacks an elementary algebraic antiderivative? Are there ways to generate accurate estimates without using extremely large values of nn in Riemann sums?
  • What is the Trapezoid Rule, and how is it related to left, right, and middle Riemann sums?
  • How are the errors in the Trapezoid Rule and Midpoint Rule related, and how can they be used to develop an even more accurate rule?

When we first explored finding the net signed area bounded by a curve, we developed the concept of a Riemann sum as a helpful estimation tool and a key step in the definition of the definite integral. Recall that the left, right, and middle Riemann sums of a function ff on an interval [a,b][a,b] are given by

Ln=f(x0)Δx+f(x1)Δx+⋯+f(xn−1)Δx=∑i=0n−1f(xi)Δx,Rn=f(x1)Δx+f(x2)Δx+⋯+f(xn)Δx=∑i=1nf(xi)Δx,Mn=f(x‾1)Δx+f(x‾2)Δx+⋯+f(x‾n)Δx=∑i=1nf(x‾i)Δx, \begin{align} L_n = f(x_0) \Delta x + f(x_1) \Delta x + \cdots + f(x_{n-1}) \Delta x &= \sum_{i = 0}^{n-1} f(x_i) \Delta x,\\[4pt] R_n = f(x_1) \Delta x + f(x_2) \Delta x + \cdots + f(x_{n}) \Delta x &= \sum_{i = 1}^{n} f(x_i) \Delta x,\\[4pt] M_n = f(\overline{x}_1) \Delta x + f(\overline{x}_2) \Delta x + \cdots + f(\overline{x}_{n}) \Delta x &= \sum_{i = 1}^{n} f(\overline{x}_i) \Delta x\text{,} \end{align}

where x0=a,x_0 = a\text{,} xi=a+iΔx,x_i = a + i\Delta x\text{,} xn=b,x_n = b\text{,} and Δx=b−an.\Delta x = \frac{b-a}{n}\text{.} For the middle sum, we defined x‾i=(xi−1+xi)/2.\overline{x}_{i} = (x_{i-1} + x_i)/2\text{.}

A Riemann sum is a sum of (possibly signed) areas of rectangles. The value of nn determines the number of rectangles, and our choice of left endpoints, right endpoints, or midpoints determines the heights of the rectangles. We can see the similarities and differences among these three options in Figure 5.6.15.6.1, where we consider the function f(x)=120(x−4)3+7f(x) = \frac{1}{20}(x-4)^3 + 7 on the interval [1,8],[1,8]\text{,} and use 5 rectangles for each of the Riemann sums.

5_6_LRMsum.svg

Figure 5.6.15.6.1: Left, right, and middle Riemann sums for y=f(x)y = f(x) on [1,8][1,8] with 5 subintervals.

While it is a good exercise to compute a few Riemann sums by hand, just to ensure that we understand how they work and how varying the function, the number of subintervals, and the choice of endpoints or midpoints affects the result, using computing technology is the best way to determine Ln,L_n\text{,} Rn,R_n\text{,} and Mn.M_n\text{.} Any computer algebra system will offer this capability; as we saw in Preview Activity 4.3.1, a straightforward option that is freely available online is the applet 1  at http://gvsu.edu/s/a9. Note that we can adjust the formula for f(x),f(x)\text{,} the window of xx- and yy-values of interest, the number of subintervals, and the method. (See Preview Activity 4.3.1 for any needed reminders on how the applet works.)

Marc Renault, Shippensburg University

In this section we explore several different alternatives for estimating definite integrals. Our main goal is to develop formulas to estimate definite integrals accurately without using a large numbers of rectangles.

Preview Activity 5.6.15.6.1

As we begin to investigate ways to approximate definite integrals, it will be insightful to compare results to integrals whose exact values we know. To that end, the following sequence of questions centers on ∫03x2 dx.\int_0^3 x^2 \, dx\text{.}

  1. Use the applet at http://gvsu.edu/s/a9 with the function f(x)=x2f(x) = x^2 on the window of xx values from 00 to 33 to compute L3,L_3\text{,} the left Riemann sum with three subintervals.
  2. Likewise, use the applet to compute R3R_3 and M3,M_3\text{,} the right and middle Riemann sums with three subintervals, respectively.
  3. Use the Fundamental Theorem of Calculus to compute the exact value of I=∫03x2 dx.I = \int_0^3 x^2 \, dx\text{.}
  4. We define the error that results from an approximation of a definite integral to be the approximation's value minus the integral's exact value. What is the error that results from using L3?L_3\text{?} From R3?R_3\text{?} From M3?M_3\text{?}
  5. In what follows in this section, we will learn a new approach to estimating the value of a definite integral known as the Trapezoid Rule. The basic idea is to use trapezoids, rather than rectangles, to estimate the area under a curve. What is the formula for the area of a trapezoid with bases of length b1b_1 and b2b_2 and height h?h\text{?}
  6. Working by hand, estimate the area under f(x)=x2f(x) = x^2 on [0,3][0,3] using three subintervals and three corresponding trapezoids. What is the error in this approximation? How does it compare to the errors you calculated in (d)?

The Trapezoid Rule

So far, we have used the simplest possible quadrilaterals (that is, rectangles) to estimate areas. It is natural, however, to wonder if other familiar shapes might serve us even better.

An alternative to Ln,L_n\text{,} Rn,R_n\text{,} and MnM_n is called the Trapezoid Rule. Rather than using a rectangle to estimate the (signed) area bounded by y=f(x)y = f(x) on a small interval, we use a trapezoid. For example, in Figure 5.6.25.6.2, we estimate the area under the curve using three subintervals and the trapezoids that result from connecting the corresponding points on the curve with straight lines.

5_6_TRAP.svg

Figure 5.6.25.6.2: Estimating ∫abf(x) dx\int_a^b f(x) \ dx using three subintervals and trapezoids, rather than rectangles, where a=x0a = x_0 and b=x3.b = x_3\text{.}

The biggest difference between the Trapezoid Rule and a Riemann sum is that on each subinterval, the Trapezoid Rule uses two function values, rather than one, to estimate the (signed) area bounded by the curve. For instance, to compute D1,D_1\text{,} the area of the trapezoid on [x0,x1],[x_0, x_1]\text{,} we observe that the left base has length f(x0),f(x_0)\text{,} while the right base has length f(x1).f(x_1)\text{.} The height of the trapezoid is x1−x0=Δx=b−a3.x_1 - x_0 = \Delta x = \frac{b-a}{3}\text{.} The area of a trapezoid is the average of the bases times the height, so we have

D1=12(f(x0)+f(x1))⋅Δx. D_1 = \frac{1}{2}(f(x_0) + f(x_1)) \cdot \Delta x\text{.}

Using similar computations for D2D_2 and D3,D_3\text{,} we find that T3,T_3\text{,} the trapezoidal approximation to ∫abf(x) dx\int_a^b f(x) \, dx is given by

T3=D1+D2+D3=12(f(x0)+f(x1))⋅Δx+12(f(x1)+f(x2))⋅Δx+12(f(x2)+f(x3))⋅Δx.\begin{align*} T_3 &= D_1 + D_2 + D_3\\[4pt] &= \frac{1}{2}(f(x_0) + f(x_1)) \cdot \Delta x + \frac{1}{2}(f(x_1) + f(x_2)) \cdot \Delta x + \frac{1}{2}(f(x_2) + f(x_3)) \cdot \Delta x\text{.} \end{align*}

Because both left and right endpoints are being used, we recognize within the trapezoidal approximation the use of both left and right Riemann sums. Rearranging the expression for T3T_3 by removing factors of 12\frac{1}{2} and Δx,\Delta x \text{,} grouping the left endpoint and right endpoint evaluations of f,f\text{,} we see that

T3=12[f(x0)+f(x1)+f(x2)]Δx+12[f(x1)+f(x2)+f(x3)]Δx.  T_3 = \frac{1}{2} \left[ f(x_0) + f(x_1) + f(x_2) \right] \Delta x + \frac{1}{2} \left[ f(x_1) + f(x_2) + f(x_3) \right] \Delta x\text{.} 

We now observe that two familiar sums have arisen. The left Riemann sum L3L_3 is L3=f(x0)Δx+f(x1)Δx+f(x2)Δx,L_3 = f(x_0) \Delta x + f(x_1) \Delta x + f(x_2) \Delta x\text{,} and the right Riemann sum is R3=f(x1)Δx+f(x2)Δx+f(x3)Δx.R_3 = f(x_1) \Delta x + f(x_2) \Delta x + f(x_3) \Delta x\text{.} Substituting L3L_3 and R3R_3 for the corresponding expressions in Equation \ref{xGO}, it follows that T3=12[L3+R3].T_3 = \frac{1}{2} \left[ L_3 + R_3 \right]\text{.} We have thus seen a very important result: using trapezoids to estimate the (signed) area bounded by a curve is the same as averaging the estimates generated by using left and right endpoints.

The Trapezoid Rule

The trapezoidal approximation, Tn,T_n\text{,} of the definite integral ∫abf(x) dx\int_a^b f(x) \, dx using nn subintervals is given by the rule

Tn=([12(f(x0)+f(x1))+12(f(x1)+f(x2))+⋯+12(f(xn−1)+f(xn))]Δx.=(∑i=0n−112(f(xi)+f(xi+1))Δx.\begin{align*} T_n =\mathstrut & \left[\frac{1}{2}(f(x_0) + f(x_1)) + \frac{1}{2}(f(x_1) + f(x_2)) + \cdots + \frac{1}{2}(f(x_{n-1}) + f(x_n)) \right] \Delta x.\\[4pt] =\mathstrut & \sum_{i=0}^{n-1} \frac{1}{2}(f(x_i) + f(x_{i+1})) \Delta x\text{.} \end{align*}

Moreover, Tn=12[Ln+Rn].T_n = \frac{1}{2} \left[ L_n + R_n \right]\text{.}

Activity 5.6.25.6.2

In this activity, we explore the relationships among the errors generated by left, right, midpoint, and trapezoid approximations to the definite integral ∫121x2 dx.\int_1^2 \frac{1}{x^2} \, dx\text{.}

  1. Use the First FTC to evaluate ∫121x2 dx\int_1^2 \frac{1}{x^2} \, dx exactly.
  2. Use appropriate computing technology to compute the following approximations for ∫121x2 dx:\int_1^2 \frac{1}{x^2} \, dx\text{:} T4,T_4\text{,} M4,M_4\text{,} T8,T_8\text{,} and M8.M_8\text{.}
  3. Let the error that results from an approximation be the approximation's value minus the exact value of the definite integral. For instance, if we let ET,4E_{T,4} represent the error that results from using the trapezoid rule with 4 subintervals to estimate the integral, we have
    ET,4=T4−∫121x2 dx. E_{T,4} = T_4 - \int_1^2 \frac{1}{x^2} \, dx \text{.}

    Similarly, we compute the error of the midpoint rule approximation with 8 subintervals by the formula

    EM,8=M8−∫121x2 dx. E_{M,8} = M_8 - \int_1^2 \frac{1}{x^2} \, dx\text{.}

    Based on your work in (a) and (b) above, compute ET,4,E_{T,4}\text{,} ET,8,E_{T,8}\text{,} EM,4,E_{M,4}\text{,} EM,8.E_{M,8}\text{.}

  4. Which rule consistently over-estimates the exact value of the definite integral? Which rule consistently under-estimates the definite integral?
  5. What behavior(s) of the function f(x)=1x2f(x) = \frac{1}{x^2} lead to your observations in (d)?

Comparing the Midpoint and Trapezoid Rules

We know from the definition of the definite integral that if we let nn be large enough, we can make any of the approximations Ln,L_n\text{,} Rn,R_n\text{,} and MnM_n as close as we'd like (in theory) to the exact value of ∫abf(x) dx.\int_a^b f(x) \, dx\text{.} Thus, it may be natural to wonder why we ever use any rule other than LnL_n or RnR_n (with a sufficiently large nn value) to estimate a definite integral. One of the primary reasons is that as n→∞,n \to \infty\text{,} Δx=b−an→0,\Delta x = \frac{b-a}{n} \to 0\text{,} and thus in a Riemann sum calculation with a large nn value, we end up multiplying by a number that is very close to zero. Doing so often generates roundoff error, because representing numbers close to zero accurately is a persistent challenge for computers.

Hence, we explore ways to estimate definite integrals to high levels of precision, but without using extremely large values of n.n\text{.} Paying close attention to patterns in errors, such as those observed in Activity 5.6.25.6.2, is one way to begin to see some alternate approaches.

To begin, we compare the errors in the Midpoint and Trapezoid rules. First, consider a function that is concave up on a given interval, and picture approximating the area bounded on that interval by both the Midpoint and Trapezoid rules using a single subinterval.

5_6_MidVTrap.svg

Figure 5.6.35.6.3: Estimating ∫abf(x) dx\int_a^b f(x) \ dx using a single subinterval: at left, the trapezoid rule; in the middle, the midpoint rule; at right, a modified way to think about the midpoint rule.

As seen in Figure 5.6.35.6.3, it is evident that whenever the function is concave up on an interval, the Trapezoid Rule with one subinterval, T1,T_1\text{,} will overestimate the exact value of the definite integral on that interval. From a careful analysis of the line that bounds the top of the rectangle for the Midpoint Rule (shown in magenta), we see that if we rotate this line segment until it is tangent to the curve at the midpoint of the interval (as shown at right in Figure 5.6.35.6.3), the resulting trapezoid has the same area as M1,M_1\text{,} and this value is less than the exact value of the definite integral. Thus, when the function is concave up on the interval, M1M_1 underestimates the integral's true value.

5_6_MidTrapError.svg

Figure 5.6.45.6.4: Comparing the error in estimating ∫abf(x) dx\int_a^b f(x) \ dx using a single subinterval: in red, the error from the Trapezoid rule; in light red, the error from the Midpoint rule.

These observations extend easily to the situation where the function's concavity remains consistent but we use larger values of nn in the Midpoint and Trapezoid Rules. Hence, whenever ff is concave up on [a,b],[a,b]\text{,} TnT_n will overestimate the value of ∫abf(x) dx,\int_a^b f(x) \, dx\text{,} while MnM_n will underestimate ∫abf(x) dx.\int_a^b f(x) \, dx\text{.} The reverse observations are true in the situation where ff is concave down.

Next, we compare the size of the errors between MnM_n and Tn.T_n\text{.} Again, we focus on M1M_1 and T1T_1 on an interval where the concavity of ff is consistent. In Figure 5.6.45.6.4, where the error of the Trapezoid Rule is shaded in red, while the error of the Midpoint Rule is shaded lighter red, it is visually apparent that the error in the Trapezoid Rule is more significant. To see how much more significant, let's consider two examples and some particular computations.

If we let f(x)=1−x2f(x) = 1-x^2 and consider ∫01f(x) dx,\int_0^1 f(x) \,dx\text{,} we know by the First FTC that the exact value of the integral is

∫01(1−x2) dx=x−x33∣01=23. \int_0^1 (1-x^2) \, dx = x - \frac{x^3}{3} \bigg\vert_0^1 = \frac{2}{3}\text{.}

Using appropriate technology to compute M4,M_4\text{,} M8,M_8\text{,} T4,T_4\text{,} and T8,T_8\text{,} as well as the corresponding errors EM,4,E_{M,4}\text{,} EM,8,E_{M,8}\text{,} ET,4,E_{T,4}\text{,} and ET,8,E_{T,8}\text{,} as we did in Activity 5.6.25.6.2, we find the results summarized in Table 5.6.55.6.5. We also include the approximations and their errors for the example ∫121x2 dx\int_1^2 \frac{1}{x^2} \, dx from Activity 5.6.25.6.2.

Table 5.6.55.6.5: Calculations of T4,T_4\text{,} M4,M_4\text{,} T8,T_8\text{,} and M8,M_8\text{,} along with corresponding errors, for the definite integrals ∫01(1−x2) dx\int_0^1 (1-x^2) \ dx and ∫121x2 dx.\int_1^2 \frac{1}{x^2} \ dx\text{.}
Rule ∫01(1−x2) dx=0.6‾\int_0^1 (1-x^2) \,dx = 0.\overline{6} error ∫121x2 dx=0.5\int_1^2 \frac{1}{x^2} \, dx = 0.5 error
T4T_4 0.656250.65625 −0.0104166667-0.0104166667 0.50899376420.5089937642 0.00899376420.0089937642
M4M_4 0.6718750.671875 0.00520833330.0052083333 0.49554793650.4955479365 −0.0044520635-0.0044520635
T8T_8 0.66406250.6640625 −0.0026041667-0.0026041667 0.50227085020.5022708502 0.00227085020.0022708502
M8M_8 0.667968750.66796875 0.00130208330.0013020833 0.49886748990.4988674899 −0.0011325101-0.0011325101

For a given function ff and interval [a,b],[a,b]\text{,} ET,4=T4−∫abf(x) dxE_{T,4} = T_4 - \int_a^b f(x) \,dx calculates the difference between the approximation generated by the Trapezoid Rule with n=4n = 4 and the exact value of the definite integral. If we look at not only ET,4,E_{T,4}\text{,} but also the other errors generated by using TnT_n and MnM_n with n=4n = 4 and n=8n = 8 in the two examples noted in Table 5.6.55.6.5, we see an evident pattern. Not only is the sign of the error (which measures whether the rule generates an over- or under-estimate) tied to the rule used and the function's concavity, but the magnitude of the errors generated by TnT_n and MnM_n seems closely connected. In particular, the errors generated by the Midpoint Rule seem to be about half the size (in absolute value) of those generated by the Trapezoid Rule.

That is, we can observe in both examples that EM,4≈−12ET,4E_{M,4} \approx -\frac{1}{2} E_{T,4} and EM,8≈−12ET,8.E_{M,8} \approx -\frac{1}{2}E_{T,8}\text{.} This property of the Midpoint and Trapezoid Rules turns out to hold in general: for a function of consistent concavity, the error in the Midpoint Rule has the opposite sign and approximately half the magnitude of the error of the Trapezoid Rule. Written symbolically,

EM,n≈−12ET,n. E_{M,n} \approx -\frac{1}{2} E_{T,n}\text{.}

This important relationship suggests a way to combine the Midpoint and Trapezoid Rules to create an even more accurate approximation to a definite integral.

Simpson's Rule

When we first developed the Trapezoid Rule, we observed that it is an average of the Left and Right Riemann sums:

Tn=12(Ln+Rn). T_n = \frac{1}{2}(L_n + R_n)\text{.}

If a function is always increasing or always decreasing on the interval [a,b],[a,b]\text{,} one of LnL_n and RnR_n will over-estimate the true value of ∫abf(x) dx,\int_a^b f(x) \, dx\text{,} while the other will under-estimate the integral. Thus, the errors that result from LnL_n and RnR_n will have opposite signs; so averaging LnL_n and RnR_n eliminates a considerable amount of the error present in the respective approximations. In a similar way, it makes sense to think about averaging MnM_n and TnT_n in order to generate a still more accurate approximation.

We've just observed that MnM_n is typically about twice as accurate as Tn.T_n\text{.} So we use the weighted average

S2n=2Mn+Tn3.  S_{2n} = \frac{2M_n + T_n}{3}\text{.} 

The rule for S2nS_{2n} giving by Equation \ref{CqH} is usually known as Simpson's Rule. 2  Note that we use “S2nS_{2n}” rather that “SnS_n” since the nn points the Midpoint Rule uses are different from the nn points the Trapezoid Rule uses, and thus Simpson's Rule is using 2n2n points at which to evaluate the function. We build upon the results in Table 5.6.55.6.5 to see the approximations generated by Simpson's Rule. In particular, in Table 5.6.65.6.6, we include all of the results in Table 5.6.55.6.5, but include additional results for S8=2M4+T43S_8 = \frac{2M_4 + T_4}{3} and S16=2M8+T83.S_{16} = \frac{2M_8 + T_8}{3}\text{.}

Thomas Simpson was an 18th century mathematician; his idea was to extend the Trapezoid rule, but rather than using straight lines to build trapezoids, to use quadratic functions to build regions whose area was bounded by parabolas (whose areas he could find exactly). Simpson's Rule is often developed from the more sophisticated perspective of using interpolation by quadratic functions.
Table 5.6.65.6.6: Table 5.6.55.6.5 updated to include S8,S_8\text{,} S16,S_{16}\text{,} and the corresponding errors.
Rule ∫01(1−x2) dx=0.6‾\int_0^1 (1-x^2) \,dx = 0.\overline{6} error ∫121x2 dx=0.5\int_1^2 \frac{1}{x^2} \, dx = 0.5 error
T4T_4 0.656250.65625 −0.0104166667-0.0104166667 0.50899376420.5089937642 0.00899376420.0089937642
M4M_4 0.6718750.671875 0.00520833330.0052083333 0.49554793650.4955479365 −0.0044520635-0.0044520635
S8S_8 0.66666666670.6666666667 00 0.50002987920.5000298792 0.00002987920.0000298792
T8T_8 0.66406250.6640625 −0.0026041667-0.0026041667 0.50227085020.5022708502 0.00227085020.0022708502
M8M_8 0.667968750.66796875 0.00130208330.0013020833 0.49886748990.4988674899 −0.0011325101-0.0011325101
S16S_{16} 0.66666666670.6666666667 00 0.50000194340.5000019434 0.00000194340.0000019434

The results seen in Table 5.6.65.6.6 are striking. If we consider the S16S_{16} approximation of ∫121x2 dx,\int_1^2 \frac{1}{x^2} \, dx\text{,} the error is only ES,16=0.0000019434.E_{S,16} = 0.0000019434\text{.} By contrast, L8=0.5491458502,L_8 = 0.5491458502\text{,} so the error of that estimate is EL,8=0.0491458502.E_{L,8} = 0.0491458502\text{.} Moreover, we observe that generating the approximations for Simpson's Rule is almost no additional work: once we have Ln,L_n\text{,} Rn,R_n\text{,} and MnM_n for a given value of n,n\text{,} it is a simple exercise to generate Tn,T_n\text{,} and from there to calculate S2n.S_{2n}\text{.} Finally, note that the error in the Simpson's Rule approximations of ∫01(1−x2) dx\int_0^1 (1-x^2) \, dx is zero! 3 

Similar to how the Midpoint and Trapezoid approximations are exact for linear functions, Simpson's Rule approximations are exact for quadratic and cubic functions. See additional discussion on this issue later in the section and in the exercises.

These rules are not only useful for approximating definite integrals such as ∫01e−x2 dx,\int_0^1 e^{-x^2} \, dx\text{,} for which we cannot find an elementary antiderivative of e−x2,e^{-x^2}\text{,} but also for approximating definite integrals when we are given a function through a table of data.

Activity 5.6.35.6.3

A car traveling along a straight road is braking and its velocity is measured at several different points in time, as given in the following table. Assume that vv is continuous, always decreasing, and always decreasing at a decreasing rate, as is suggested by the data.

Table 5.6.75.6.7 Data for the braking car.
seconds, tt Velocity in ft/sec, v(t)v(t)
00 100100
0.30.3 9999
0.60.6 9696
0.90.9 9090
1.21.2 8080
1.51.5 5050
1.81.8 00
5_6_Act2.svg
Figure 5.6.85.6.8: Axes for plotting the data in Activity 5.6.35.6.3.
  1. Plot the given data on the set of axes provided in Figure 5.6.85.6.8 with time on the horizontal axis and the velocity on the vertical axis.
  2. What definite integral will give you the exact distance the car traveled on [0,1.8]?[0,1.8]\text{?}
  3. Estimate the total distance traveled on [0,1.8][0,1.8] by computing L3,L_3\text{,} R3,R_3\text{,} and T3.T_3\text{.} Which of these under-estimates the true distance traveled?
  4. Estimate the total distance traveled on [0,1.8][0,1.8] by computing M3.M_3\text{.} Is this an over- or under-estimate? Why?
  5. Using your results from (c) and (d), improve your estimate further by using Simpson's Rule.
  6. What is your best estimate of the average velocity of the car on [0,1.8]?[0,1.8]\text{?} Why? What are the units on this quantity?

Overall observations regarding Ln,L_n\text{,} Rn,R_n\text{,} Tn,T_n\text{,} Mn,M_n\text{,} and S2n.S_{2n}\text{.}

As we conclude our discussion of numerical approximation of definite integrals, it is important to summarize general trends in how the various rules over- or under-estimate the true value of a definite integral, and by how much. To revisit some past observations and see some new ones, we consider the following activity.

Activity 5.6.45.6.4

Consider the functions f(x)=2−x2,f(x) = 2-x^2\text{,} g(x)=2−x3,g(x) = 2-x^3\text{,} and h(x)=2−x4,h(x) = 2-x^4\text{,} all on the interval [0,1].[0,1]\text{.} For each of the questions that require a numerical answer in what follows, write your answer exactly in fraction form.

  1. On the three sets of axes provided in Figure 5.6.95.6.9, sketch a graph of each function on the interval [0,1],[0,1]\text{,} and compute L1L_1 and R1R_1 for each. What do you observe?
  2. Compute M1M_1 for each function to approximate ∫01f(x) dx,\int_0^1 f(x) \,dx\text{,} ∫01g(x) dx,\int_0^1 g(x) \,dx\text{,} and ∫01h(x) dx,\int_0^1 h(x) \,dx\text{,} respectively.
  3. Compute T1T_1 for each of the three functions, and hence compute S2S_2 for each of the three functions.
  4. Evaluate each of the integrals ∫01f(x) dx,\int_0^1 f(x) \,dx\text{,} ∫01g(x) dx,\int_0^1 g(x) \,dx\text{,} and ∫01h(x) dx\int_0^1 h(x) \,dx exactly using the First FTC.
  5. For each of the three functions f,f\text{,} g,g\text{,} and h,h\text{,} compare the results of L1,L_1\text{,} R1,R_1\text{,} M1,M_1\text{,} T1,T_1\text{,} and S2S_2 to the true value of the corresponding definite integral. What patterns do you observe?

5_6_Act3.svg

Figure 5.6.95.6.9: Axes for plotting the functions in Activity 5.6.45.6.4.

The results seen in Activity 5.6.45.6.4 generalize nicely. For instance, if ff is decreasing on [a,b],[a,b]\text{,} LnL_n will over-estimate the exact value of ∫abf(x) dx,\int_a^b f(x) \,dx\text{,} and if ff is concave down on [a,b],[a,b]\text{,} MnM_n will over-estimate the exact value of the integral. An excellent exercise is to write a collection of scenarios of possible function behavior, and then categorize whether each of Ln,L_n\text{,} Rn,R_n\text{,} Tn,T_n\text{,} and MnM_n is an over- or under-estimate.

Finally, we make two important notes about Simpson's Rule. When T. Simpson first developed this rule, his idea was to replace the function ff on a given interval with a quadratic function that shared three values with the function f.f\text{.} In so doing, he guaranteed that this new approximation rule would be exact for the definite integral of any quadratic polynomial. In one of the pleasant surprises of numerical analysis, it turns out that even though it was designed to be exact for quadratic polynomials, Simpson's Rule is exact for any cubic polynomial: that is, if we are interested in an integral such as ∫25(5x3−2x2+7x−4) dx,\int_2^5 (5x^3 - 2x^2 + 7x - 4)\, dx\text{,} S2nS_{2n} will always be exact, regardless of the value of n.n\text{.} This is just one more piece of evidence that shows how effective Simpson's Rule is as an approximation tool for estimating definite integrals. 4 

One reason that Simpson's Rule is so effective is that S2nS_{2n} benefits from using 2n+12n+1 points of data. Because it combines Mn,M_n\text{,} which uses nn midpoints, and Tn,T_n\text{,} which uses the n+1n+1 endpoints of the chosen subintervals, S2nS_{2n} takes advantage of the maximum amount of information we have when we know function values at the endpoints and midpoints of nn subintervals.

Summary

  • For a definite integral such as ∫01e−x2 dx\int_0^1 e^{-x^2} \, dx when we cannot use the First Fundamental Theorem of Calculus because the integrand lacks an elementary algebraic antiderivative, we can estimate the integral's value by using a sequence of Riemann sum approximations. Typically, we start by computing Ln,L_n\text{,} Rn,R_n\text{,} and MnM_n for one or more chosen values of n.n\text{.}
  • The Trapezoid Rule, which estimates ∫abf(x) dx\int_a^b f(x) \, dx by using trapezoids, rather than rectangles, can also be viewed as the average of Left and Right Riemann sums. That is, Tn=12(Ln+Rn).T_n = \frac{1}{2}(L_n + R_n)\text{.}
  • The Midpoint Rule is typically twice as accurate as the Trapezoid Rule, and the signs of the respective errors of these rules are opposites. Hence, by taking the weighted average S2n=2Mn+Tn3,S_{2n} = \frac{2M_n + T_n}{3}\text{,} we can build a much more accurate approximation to ∫abf(x) dx\int_a^b f(x) \, dx by using approximations we have already computed. The rule for S2nS_{2n} is known as Simpson's Rule, which can also be developed by approximating a given continuous function with pieces of quadratic polynomials.

Credit and licence

This page titled 5.6: Numerical Integration was last modified on Thu, 28 Sep 2023 23:43:07 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew Boelkins, David Austin, and Steven Schlicker ( ScholarWorks @Grand Valley State University ) via source content that was edited to the style and standards of the LibreTexts platform.

Source: https://math.libretexts.org/Bookshelves/Calculus/Active_Calculus_(Boelkins_et_al.)/05%3A_Finding_Antiderivatives_and_Evaluating_Integrals/5.06%3A_Numerical_Integration

Licence: CC BY-SA 4.0 (creativecommons.org/licenses/by-sa/4.0/). You may share and adapt it under the same licence, with this credit. WorldClass adapted the formatting only: the text is the authors', with interactive parts and links to other sites left out.

Build status · Flash Infinity AI™ is a trademark of AI-Flash Inc.. WorldClass is not affiliated with, approved or accredited by any exam board, curriculum provider or university unless a page says so.