Skip to main content
Logo image

APEX Calculus: for University of Lethbridge

Section 5.5 Numerical Integration

The Fundamental Theorem of Calculus gives a concrete technique for finding the exact value of a definite integral. That technique is based on computing antiderivatives. Despite the power of this theorem, there are still situations where we must approximate the value of the definite integral instead of finding its exact value. The first situation we explore is where we cannot compute the antiderivative of the integrand. The second case is when we actually do not know the function in the integrand, but only its value when evaluated at certain points.
An elementary function is any function that is a combination of polynomial, \(n\)th root, rational, exponential, logarithmic and trigonometric functions. We can compute the derivative of any elementary function, but there are many elementary functions of which we cannot compute an antiderivative. For example, the following functions do not have antiderivatives that we can express with elementary functions:
  • \(e^{x^2}\text{,}\)
  • \(\sin(x^3)\text{,}\)
  • \(\frac{\sin(x)}{x}\text{.}\)
The simplest way to refer to the antiderivatives of \(e^{-x^2}\) is to simply write \(\int e^{-x^2}\, dx\text{.}\)
This section outlines three common methods of approximating the value of definite integrals. We describe each as a systematic method of approximating area under a curve. By approximating this area accurately, we find an accurate approximation of the corresponding definite integral.
We will apply the methods we learn in this section to the following definite integrals:
  • \(\int_0^1 e^{-x^2} \, dx\text{,}\)
  • \(\int_{-\frac{\pi}{4}}^{\frac{\pi}{2}} \sin(x^3) \, dx\text{,}\)
  • \(\int_{0.5}^{4\pi} \frac{\sin(x)}{x} \, dx\text{,}\)
as pictured in Figure 5.5.1.
Integral of e^{-x^2} from 0 to 1
This is a graph of \(f(x)=e^{-x^2}\text{.}\)starting at \((0, 1)\) the line slopes down towards the \(x\) axis. The line goes from \((0, 1)\) to close to \((1, 0.75)\text{.}\) We consider the area between \((0, 1)\text{,}\) \((1, 0.75)\text{,}\)\((1, 0)\) and \((0, 0)\text{.}\)
(a)
Graph of the function sin(x^3)
The graph of \(\sin(x^3)\text{.}\) Starting at \((-0.75, -0.5)\) the graph moves upwards to the right. It merges to the \(x\) axis close to \((-0.25, 0)\) and continues along the \(x\) axis. It goes through and continues along the positive \(x\) axis for a short while then rises up until it reaches \((1.25, 1)\) then sharply descends back towards the \(x\) axis. It intersects the \(y\) axis close to \((1.5, 0)\) and continues downwards. We consider the area above the part of the curve that is in the fourth quadrant and below the negative \(x\) axis. Then below the curve that rises up from the positive \(x\) axis and comes down. And the area above the part of the curve that continues downwards after intersecting the \(x\) axis.
(b)
The graph of y=sin(x)/x and its integral from .5 to 4 pi
We consider the area under the graph of \(\sin(x)/x\) starting close to \((0.5, 0.9)\) to \((12.5, 0)\text{.}\) The structure of the graph is similar to that of a wave. The distance between the highest point of the graph in the positive \(y\) axis and the lowest point in the negative \(y\) axis shows a decreasing trend as it continues in the positive \(x\) direction but the wavelength increases in the positive \(x\) direction.The graph starts at \((0.5, 0.9)\) close to the \(x\) axis and curves downwards. It crosses the \(x\) axis close to \((3, 0)\) while travelling downwards. It continues downwards for a short amount and the curves upwards and this time crosses the \(x\) axis at \((6.25, 0)\text{.}\) From \((6.25, 0)\) it travels another wavelength crossing the \(x\) axis once close to \((10,0)\) while traveling upwards and at \((12.5, 0)\) where the graph ends. We consider the area under the graph when it is above the \(x\) axis and above it when it is below the \(x\) axis.
(c)
Figure 5.5.1. Graphically representing three definite integrals that cannot be evaluated using antiderivatives

Subsection 5.5.1 The Left and Right Hand Rule Methods

In Section 5.3 we addressed the problem of evaluating definite integrals by approximating the area under the curve using rectangles. We revisit those ideas here before introducing other methods of approximating definite integrals.
We start with a review of notation. Let \(f\) be a continuous function on the interval \([a,b]\text{.}\) We wish to approximate \(\ds \int_a^b f(x)\, dx\text{.}\) We partition \([a,b]\) into \(n\) equally spaced subintervals, each of length \(\ds\dx = \frac{b-a}{n}\text{.}\) The endpoints of these subintervals are labeled as
\begin{equation*} x_0=a,\,x_1 = a+\dx,\,x_2 = a+ 2\dx,\,\ldots,\,x_i = a+i\dx,\,\ldots,\,x_{n} = b\text{.} \end{equation*}
Key Idea 5.3.20 states that to use the Left Hand Rule we use the summation \(\ds \sum_{i=1}^n f(x_{i-1})\dx\) and to use the Right Hand Rule we use \(\ds \sum_{i=1}^n f(x_{i})\dx\text{.}\) We review the use of these rules in the context of examples.

Example 5.5.2. Approximating definite integrals with rectangles.

Approximate \(\ds \int_0^1e^{-x^2}\, dx\) using the Left and Right Hand Rules with 5 equally spaced subintervals.
Solution.
We begin by partitioning the interval \([0,1]\) into 5 equally spaced intervals. We have \(\dx = \frac{1-0}5 = 1/5=0.2\text{,}\) so
\begin{equation*} x_0 = 0,\,x_1 = 0.2,\,x_2 = 0.4,\,x_3 = 0.6,\,x_4 = 0.8,\,\text{ and } \,x_5 = 1\text{.} \end{equation*}
Using the Left Hand Rule, we have:
\begin{align*} \sum_{i=1}^n f(x_{i-1})\dx \amp = \big(f(x_0)+f(x_1) + f(x_2) + f(x_3) + f(x_4)\big)\dx\\ \amp = \big(f(0) + f(0.2) + f(0.4) + f(0.6) + f(0.8)\big)\dx\\ \amp \approx (1+0.9608 +0.8521 + 0.6977 + 0.5273)(0.2)\\ \amp \approx 0.8076\text{.} \end{align*}
Using the Right Hand Rule, we have:
\begin{align*} \sum_{i=1}^n f(x_{i})\dx \amp = \big(f(x_1) + f(x_2) + f(x_3) + f(x_4)+f(x_5)\big)\dx\\ \amp = \big(f(0.2) + f(0.4) + f(0.6) + f(0.8)+f(1)\big)\dx\\ \amp \approx (0.9608 +0.8521 + 0.6977 + 0.5273 + 0.3678)(0.2)\\ \amp \approx 0.6812\text{.} \end{align*}
Using the Left Hand rule
The graph of \(e^{-x^2}\) starts at \((0, 1)\) and slowly slopes downwards to the right as it slowly gets closer to the positive \(x\) axis. To use the left hand rule we divide the area between \([0, 1]\) five rectangles of equal widhth and decreasing height. As the curve moves closer to the \(x\) axis, the heights of the rectangles gets shorter even thought the widths stay the same. Because the curve is downwards sloping to the right, the top right corners of the rectangles contain a little region which is above the curve. As the curve moves downwards and the height of the rectangles become shorter, the area that is contained by the top right corners of the rectangles and the top of the curve gets larger. We calculate the sum of the areas of these rectangles.
(a) Using the Left Hand Rule
Using the Right Hand rule
For this image we consider the same downwards sloping curve of \(e^{-x^2}\text{.}\) We divide the area between \([0,1]\) into five rectangles of equal width and decreasing height. For the right hand rule the rectangles are drawn in such a way that the top right corners of the rectangles touch the bottom of the curve. There is a small area between the top left of the triangles and the bottom of the curve. This area gets larger as the curve moves downwards and the lengths of the rectangles decrease. For the left hand rule we add up the areas of these rectangles.
(b) Using the Right Hand Rule
Figure 5.5.3. Approximating \(\int_0^1e^{-x^2}\, dx\) in Example 5.5.2
Figure 5.5.3 shows the rectangles used in each method to approximate the definite integral. These graphs show that in this particular case, the Left Hand Rule is an over approximation and the Right Hand Rule is an under approximation. To get a better approximation, we could use more rectangles, as we did in Section 5.3. We could also average the Left and Right Hand Rule results together, giving
\begin{equation*} \frac{0.8076 + 0.6812}{2} = 0.7444\text{.} \end{equation*}
The actual answer, accurate to 4 places after the decimal, is 0.7468, showing our average is a good approximation.

Example 5.5.4. Approximating definite integrals with rectangles.

Approximate \(\ds\int_{-\frac{\pi}4}^{\frac{\pi}2} \sin(x^3)\, dx\) using the Left and Right Hand Rules with 10 equally spaced subintervals.
Solution.
We begin by finding \(\dx\text{:}\)
\begin{equation*} \frac{b-a}{n} = \frac{\pi/2 - (-\pi/4)}{10} = \frac{3\pi}{40}\approx 0.2356\text{.} \end{equation*}
It is useful to write out the endpoints of the subintervals in a table; in Figure 5.5.5, we give the exact values of the endpoints, their decimal approximations, and decimal approximations of \(\sin(x^3)\) evaluated at these points.
\(x_i\) Exact Approx. \(\sin(x_i^3)\)
\(x_0\) \(-\pi/4\) \(-0.7854\) \(-0.4657\)
\(x_1\) \(-7 \pi/40\) \(-0.5498\) \(-0.1654\)
\(x_2\) \(-{\pi }/{10}\) \(-0.3142\) \(-0.0310\)
\(x_3\) \(-{\pi }/{40}\) \(-0.0785\) \(-0.0005\)
\(x_4\) \({\pi }/{20}\) \(0.1571\) \(0.0039\)
\(x_5\) \({\pi }/{8}\) \(0.3927\) \(0.0605\)
\(x_6\) \({\pi }/{5}\) \(0.6283\) \(0.2455\)
\(x_7\) \({11 \pi }/{40}\) \(0.8639\) \(0.6011\)
\(x_8\) \({7 \pi }/{20}\) \(1.0996\) \(0.9710\)
\(x_{9}\) \({17 \pi }/{40}\) \(1.3352\) \(0.6899\)
\(x_{10}\) \({\pi }/{2}\) \(1.5708\) \(-0.6700\)
Figure 5.5.5. Values used to approximate \(\int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx\) in Example 5.5.4
Once this table is created, it is straightforward to approximate the definite integral using the Left and Right Hand Rules. (Note: the table itself is easy to create, especially with a standard spreadsheet program on a computer. The last two columns are all that are needed.) The Left Hand Rule sums the first 10 values of \(\sin(x_i^3)\) and multiplies the sum by \(\dx\text{;}\) the Right Hand Rule sums the last 10 values of \(\sin(x_i^3)\) and multiplies by \(\dx\text{.}\) Therefore we have:
Left Hand Rule: \(\ds \int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx \approx (1.9093)(0.2356) \approx 0.4498\text{.}\)
Right Hand Rule: \(\ds \int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx \approx (1.705)(0.2356) \approx 0.4017\text{.}\)
Average of the Left and Right Hand Rules: 0.4258.
Using the Left Hand rule
We calculate \(\int_{-\frac{\pi}4}^{\frac{\pi}/2}\sin(x^3)\, dx\) using the left hand rule. The graph of \(\sin(x^3)\) starts at \((-0.75, -0.5)\) in the fourth quadrant and curves upwards to the right. It merges with the negative \(x\) axis close to \((-0.25, 0)\) and continues along the \(x\) axis until \((0.25, 0)\) and then slopes upwards to the right. The graph continues upwards until \((1.25, 1)\) in the first quadrant and then descends sharply. It crosses the positive \(x\) axis close to \((1.5, 0)\) and continues downwards. We divide the areas under the curve into boxes of equal width but varying height. The far left side of the graph is divided into three boxes of decreasing length that are below the negative \(x\) axis. THe rectangle farthest to the left is the tallest and the other two get get shorter as the graph moves upwards towards the negative \(x\) axis. The region roughly from \((-0.25, 0)\) to \((0.25, 0)\) where the curve moves along the \(x\) axis there are no boxes since the are of that part is zero. Then the part of the graph in the first quadrant is divided into five rectangles. As the graph rises up, the heights of the rectangles increase. The first one being the shortest and the fourth one being the tallest. The fifth rectangle is shorter than the fourth one but taller than the first three. We add up the areas of the rectangles to approximate the integral.
(a)
Using the Right Hand rule
We calculate \(\int_{-\frac{\pi}4}^{\frac{\pi}/2}\sin(x^3)\, dx\) using the Right hand rule. The far left part of the graph is divided into two rectangles of decreasing height. The region from \((-0.25, 0)\) to \((0.25, 0)\) on the \(x\) axis does not contribute to the area since the curve here continues along the axis and therefore the area is zero. The part in the first quadrant is divided into five adjacent rectangles of increasing height. The upper left side of the first four rectangles contain some area outside of the curve on the left. As the graph moves up, the heights of the rectangles increase, the fourth one being the tallest. The fifth rectangle is below the graph with its upper right corner touching the inside of the graph. The sixth and the last rectangle is below the positive \(x\) axis. It captures the area adjacent to the part of the graph that is below the positive \(x\) axis.
(b)
Figure 5.5.6. Approximating \(\int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx\) in Example 5.5.4
The actual answer, accurate to 4 places after the decimal, is 0.4609. Our approximations were once again fairly good. The rectangles used in each approximation are shown in Figure 5.5.6.(a). It is clear from the graphs that using more rectangles (and hence, narrower rectangles) should result in a more accurate approximation.

Subsection 5.5.2 The Trapezoidal Rule

In Example 5.5.2 we approximated the value of \(\ds \int_0^1 e^{-x^2}\, dx\) with 5 rectangles of equal width. Figure 5.5.3 shows the rectangles used in the Left and Right Hand Rules. These graphs clearly show that rectangles do not match the shape of the graph all that well, and that accurate approximations will only come by using lots of rectangles.
Instead of using rectangles to approximate the area, we can instead use trapezoids. In Figure 5.5.7, we show the region under \(f(x) = e^{-x^2}\) on \([0,1]\) approximated with 5 trapezoids of equal width; the top “corners” of each trapezoid lies on the graph of \(f(x)\text{.}\) It is clear from this figure that these trapezoids more accurately approximate the area under \(f\) and hence should give a better approximation of \(\int_0^1 e^{-x^2}\, dx\text{.}\) (In fact, these trapezoids seem to give a great approximation of the area!)
Approximating the integral of e to the power of negative x squared from 0 to 1 using five trapezoids
The graph of \(e^{-x^2}\) starts from \((0,1)\) and slopes downwards to the right in the positive x direction. We consider the are under the curve from \((0,1)\) to \((1, 0.25)\) in the first quadrant. The area is approximated with five adjacent trapezoids of equal width but decreasing heights. The upper arms of the trapezoids are downwar sloping and they follow the graph of \(e^{-x^2}\) very closely which allows for more precise approximation. Both of the upper corners of the trapezoids lie on the curve. The first trapezoid is the tallest one and the fifth one is the shortest.
Figure 5.5.7. Approximating \(\int_0^1 e^{-x^2}\, dx\) using 5 trapezoids of equal widths
The formula for the area of a trapezoid is given in Figure 5.5.8. We approximate \(\int_0^1 e^{-x^2}\, dx\) with these trapezoids in the following example.
The area of a trapezoid.
This is a picture of a trapezoid. The height is \(h\text{.}\) The left arm of the trapezoid is shorter than the right arm. The arm connecting the left and the right arm is thus upward sloping. The left arm is named \(a\) and the right arm is named \(b\text{.}\)
Figure 5.5.8. The area of a trapezoid

Example 5.5.9. Approximating definite integrals using trapezoids.

Use 5 trapezoids of equal width to approximate \(\ds \int_0^1e^{-x^2}\, dx\text{.}\)
Solution.
To compute the areas of the 5 trapezoids in Figure 5.5.7, it will again be useful to create a table of values as shown in Figure 5.5.10.
\(x_i\) \(e^{-x_i^2}\)
\(0\) \(1\)
\(0.2\) \(0.9608\)
\(0.4\) \(0.8521\)
\(0.6\) \(0.6977\)
\(0.8\) \(0.5273\)
\(1\) \(0.3679\)
Figure 5.5.10. A table of values of \(e^{-x^2}\)
The leftmost trapezoid has legs of length \(1\) and \(0.9607\) and a height of 0.2. Thus, by our formula, the area of the leftmost trapezoid is:
\begin{equation*} \frac{1+0.9608}{2}(0.2) = 0.1961\text{.} \end{equation*}
Moving right, the next trapezoid has legs of length \(0.9607\) and \(0.8521\) and a height of 0.2. Thus its area is:
\begin{equation*} \frac{0.9608+0.8521}2(0.2) = 0.1813\text{.} \end{equation*}
The sum of the areas of all 5 trapezoids is:
\begin{align*} \frac{1+0.9608}{2}(0.2) + \frac{0.9608+0.8521}2(0.2)+\frac{0.8521+0.6977}2(0.2)\amp +\\ \frac{0.6977+0.5273}2(0.2)+\frac{0.5273+0.3679}2(0.2)\amp = 0.7444\text{.} \end{align*}
We approximate \(\int_0^1 e^{-x^2}\, dx \approx 0.7444\text{.}\)
There are many things to observe in this example. Note how each term in the final summation was multiplied by both 1/2 and by \(\dx = 0.2\text{.}\) We can factor these coefficients out, leaving a more concise summation as:
\begin{align*} \frac12(0.2)\amp\Big[(1+0.9608) + (0.9608+0.8521) + (0.8521+0.6977)\\ \amp\quad + ( 0.6977+ 0.5273) +(0.5273 + 0.3679)\Big]\text{.} \end{align*}
Now notice that all numbers except for the first and the last are added twice. Therefore we can write the summation even more concisely as
\begin{equation*} \frac{0.2}{2}\Big[1 + 2(0.9608+0.8521+0.6977+0.5273) + 0.3679\Big]\text{.} \end{equation*}
This is the heart of the Trapezoidal Rule, wherein a definite integral \(\int_a^b f(x) \, dx\) is approximated by using trapezoids of equal widths to approximate the corresponding area under \(f\text{.}\) Using \(n\) equally spaced subintervals with endpoints \(x_0\text{,}\) \(x_1\text{,}\) \(\ldots\text{,}\) \(x_{n}\text{,}\) we again have \(\ds \dx = \frac{b-a}n\text{.}\) Thus:
\begin{align*} \int_a^b f(x)\, dx \amp \approx \sum_{i=1}^n \frac{f(x_{i-1})+f(x_{i})}2\dx\\ \amp = \frac{\dx}2 \sum_{i=1}^n \big(f(x_{i-1})+f(x_{i})\big)\\ \amp = \frac{\dx}2\Big[f(x_0)+ \left(2\sum_{i=1}^{n-1} f(x_i)\right) + f(x_{n})\Big]\text{.} \end{align*}

Example 5.5.11. Using the Trapezoidal Rule.

Revisit Example 5.5.4 and approximate \(\ds\int_{-\frac{\pi}{4}}^{\frac{\pi}{2}} \sin(x^3)\, dx\) using the Trapezoidal Rule and 10 equally spaced subintervals.
Solution.
We refer back to Figure 5.5.5 for the table of values of \(\sin(x^3)\text{.}\) Recall that \(\dx = 3\pi/40 \approx 0.236\text{.}\) Thus we have:
\begin{align*} \amp \int_{-\frac{\pi}4}^{\frac{\pi}2} \sin(x^3)\, dx\\ \amp \approx \frac{0.236}{2}\Big[-0.4657 + 2\Big(-0.1654+(-0.031)+\ldots+ 0.68999\Big)+(-0.67)\Big]\\ \amp = 0.4258\text{.} \end{align*}
The actual answer, accurate to 4 decimal places is \(0.4609\text{.}\) So the Trapezoidal Rule with 10 subintervals is an under-approximation by about \(0.0351\text{.}\)
Notice how “quickly” the Trapezoidal Rule can be implemented once the table of values is created. This is true for all the methods explored in this section; the real work is creating a table of \(x_i\) and \(f(x_i)\) values. Once this is completed, approximating the definite integral is not difficult. Again, using technology is wise. Spreadsheets can make quick work of these computations and make using lots of subintervals easy.
Also notice the approximations the Trapezoidal Rule gives. It is the average of the approximations given by the Left and Right Hand Rules! This effectively renders the Left and Right Hand Rules obsolete. They are useful when first learning about definite integrals, but if a real approximation is needed, one is generally better off using the Trapezoidal Rule instead of either the Left or Right Hand Rule. However, there are two other methods that are also generally more accurate than the Left or Right Hand Rule.

Subsection 5.5.3 The Midpoint Rule

Another method that can be more accurate than the Trapezoidal Rule is the Midpoint Rule:
\begin{align*} S_M(n)\amp =\sum_{i=1}^n f\left(\frac{x_{i-1}+x_{i}}{2}\right)\Delta x\\ \amp = \sum_{i=1}^n f\left(\overline{x_i}\right)\Delta x\\ \amp \text{ where } \overline{x_i} \text{ is the midpoint of each subinterval,}\\ \amp \overline{x_i}=a+\dx\left(i-\frac12\right) \end{align*}

Example 5.5.12. Using the Midpoint Rule.

Use the Midpoint Rule with \(n=5\) to approximate \(\ds \int_0^1e^{-x^2}\, dx\text{.}\)
Solution.
We cannot use the table in Figure 5.5.10 that we used for the Trapezoidal, Right and Left Hand Rules when using the Midpoint Rule. The Trapezoidal rule averages the outputs of the function to obtain a more accurate estimate of the definite integral. The Midpoint Rule averages the inputs of each subinterval to create a rectangle with height \(f\left(\frac{x_{i-1}+x_{i}}{2}\right)\text{.}\) Generally \(f\left(\frac{x_{i-1}+x_{i}}{2}\right)\neq \frac{f(x_{i-1})+f(x_{i})}{2}\text{.}\)
So we will create a new table of values as shown in Figure 5.5.13. We have \(\dx=(1-0)/5=0.2\text{.}\) The midpoint of the first subinteval is at \(0+0.2(1/2)=0.1\) and each successive midpoint is \(0.2\) from the last.
\(x_i\) \(e^{-x_i^2}\)
\(0.1\) \(0.9900\)
\(0.3\) \(0.9139\)
\(0.5\) \(0.7788\)
\(0.7\) \(0.6126\)
\(0.9\) \(0.4449\)
Figure 5.5.13. A table of values of \(e^{-x^2}\)
So we have
\begin{align*} \int_0^1 e^{-x^2}\, dx \amp \approx 0.2(0.99+0.9139+0.7788+0.6126+0.4449)\\ \amp \approx 0.7480 \end{align*}
We approximate \(\ds \int_0^1 e^{-x^2}\, dx \approx 0.7480\text{.}\)

Example 5.5.14. Using the Midpoint Rule.

Revisit Example 5.5.11 and approximate \(\ds\int_{-\frac{\pi}{4}}^{\frac{\pi}{2}} \sin(x^3)\, dx\) using the Midpoint Rule and 10 equally spaced subintervals.
Solution.
Again, a table will be useful. Recall that \(\dx = 3\pi/40 \approx 0.2356\text{.}\) The midpoint of the first subinterval is \(\overline{x_1}=a+\dx/2=-\pi/4+3\pi/40(1/2)=-17\pi/80\) (notice that \(\overline{x_1}\) is half of a subinterval width to the right of \(a\)). Each successive midpoint is \(\dx=3 \pi/40=6\pi/80\) to the right of the last. So we have:
\(\overline{x_i}\) Exact Approx. \(\sin(x_i^3)\)
\(\overline{x_1}\) \(-17\pi/80\) \(-0.6676\) \(-0.2932\)
\(\overline{x_2}\) \(-11 \pi/80\) \(-0.4320\) \(-0.0805\)
\(\overline{x_3}\) \(-5{\pi }/{80}\) \(-0.1963\) \(-0.0076\)
\(\overline{x_4}\) \(1{\pi }/{80}\) \(-0.0393\) \(0.0001\)
\(\overline{x_5}\) \(7{\pi }/{80}\) \(0.2749\) \(0.0208\)
\(\overline{x_6}\) \({13\pi }/{80}\) \(0.5105\) \(0.1327\)
\(\overline{x_7}\) \({19\pi }/{80}\) \(0.7461\) \(0.4035\)
\(\overline{x_8}\) \({25 \pi }/{80}\) \(0.9817\) \(0.8112\)
\(\overline{x_9}\) \({31 \pi }/{80}\) \(1.2174\) \(0.9729\)
\(\overline{x_{10}}\) \({37 \pi }/{80}\) \(1.4530\) \(0.0740\)
Figure 5.5.15. Values used to approximate \(\int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx\) in Example 5.5.14
Thus we have:
\begin{align*} \amp \int_{-\frac{\pi}4}^{\frac{\pi}2} \sin(x^3)\, dx\\ \amp \approx 0.2356\Big[-0.2932+(-0.0805)+(-0.0076)+\dots+0.9729+0.0740\Big]\\ \amp=0.2356\cdot 2.0339\\ \amp \approx 0.4792\text{.} \end{align*}
The actual answer, accurate to 4 decimal places is \(0.4609\text{.}\) So the Midpoint Rule with 10 subintervals is an overrapproximation by about \(0.0183 \text{.}\) Notice that this error is about half of the error in using the Trapezoidal Rule.
In many cases, the Midpoint Rule will more accurate than the Trapezoidal Rule. You may wonder though, how can we improve on the Trapezoidal and Midpoint Rules, apart from using more and more subintervals? The answer is clear once we look back and consider what we have really done so far. The Left Hand Rule, Right Hand Rule and Midpoint Rules are not really about using rectangles to approximate area. Instead, they approximate a function \(f\) with constant functions on small subintervals and then compute the definite integral of these constant functions. The Trapezoidal Rule is really approximating a function \(f\) with a linear function on a small subinterval, then computing the definite integral of this linear function. In all of these cases the definite integrals are easy to compute in geometric terms.
So we have a progression: we start by approximating \(f\) with a constant function and then with a linear function. What is next? A quadratic function. By approximating the curve of a function with lots of parabolas, we generally get an even better approximation of the definite integral. We call this process Simpson’s Rule, named after Thomas Simpson (1710-1761), even though others had used this rule as much as 100 years prior.

Subsection 5.5.4 Simpson’s Rule

Given one point, we can create a constant function that goes through that point. Given two points, we can create a linear function that goes through those points. Given three points, we can create a quadratic function that goes through those three points (given that no two have the same \(x\)-value).
Consider three points \((x_0,y_0)\text{,}\) \((x_1,y_1)\) and \((x_2,y_2)\) whose \(x\)-values are equally spaced and \(x_0\lt x_1\lt x_2\text{.}\) Let \(f\) be the quadratic function that goes through these three points. It is not hard to show that
\begin{equation} \int_{x_0}^{x_2} f(x)\, dx = \frac{x_2-x_0}{6}\big(y_0+4y_1+y_2\big)\text{.}\tag{5.5.1} \end{equation}
Consider Figure 5.5.16. A function \(f\) goes through the 3 points shown and the parabola \(g\) that also goes through those points is graphed with a dashed line. Using our equation from above, we know exactly that
\begin{equation*} \int_1^3 g(x) \, dx = \frac{3-1}{6}\big(3+4(1)+2\big)= 3\text{.} \end{equation*}
Since \(g\) is a good approximation for \(f\) on \([1,3]\text{,}\) we can state that
\begin{equation*} \int_1^3 f(x)\, dx \approx 3\text{.} \end{equation*}
A parabola approximating the function f on [1, 3].
The graph of the function \(f\) starts close to \((1, 4)\) in the first quadrant and then slopes downwards to the right towards the \(x\) axis. Once it reaches the point \((2, 1)\text{,}\) the graph starts sloping upwards to the right and continues upwards. It ends close to \((3, 2)\text{.}\) The shape of the graph resembles the shape of a parabola. We approximate the graph of \(f\) using a parabola whose path follows \(f\) very closely. The parabola intersects \(f\) three times, once at \((1, 3)\) then at \((2, 1)\) and at \((3, 2)\text{.}\)
Figure 5.5.16. A graph of a function \(f\) and a parabola that approximates it well on \([1,3]\)
Notice how the interval \([1,3]\) was split into two subintervals as we needed 3 points. Because of this, whenever we use Simpson’s Rule, we need to break the interval into an even number of subintervals.
In general, to approximate \(\ds \int_a^b f(x)\, dx\) using Simpson’s Rule, subdivide \([a,b]\) into \(n\) subintervals, where \(n\) is even and each subinterval has width \(\dx = (b-a)/n\text{.}\) We approximate \(f\) with \(n/2\) parabolic curves, using Equation (5.5.1) to compute the area under these parabolas. Adding up these areas gives the formula:
\begin{equation*} \int_a^b f(x) \, dx \approx \frac{\dx}3\Big[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+\ldots+2f(x_{n-2})+4f(x_{n-1})+f(x_{n})\Big]\text{.} \end{equation*}
Note how the coefficients of the terms in the summation have the pattern 1, 4, 2, 4, 2, 4, \(\ldots\text{,}\) 2, 4, 1.
Figure 5.5.17 illustrates how the area calculated by Simpson’s Rule approximates \(\int_0^5 f(x)\, dx\) for the function \(f(x)=\sin(\pi x)\text{.}\) In this case, \(8\) subintervals were used, resulting in \(4\) quadratic curves (dashed lines) being fitted to each pair of subintervals. The actual answer (accurate to \(4\) decimal places) is about \(10.6366\text{,}\) while Simpson’s rule gives \(10.7294\text{.}\) Of course more subintervals would result in better accuracy. However \(8\) intervals were chosen specifically so that you could see how the parabolas compare to the original function. With larger values of \(n\text{,}\) it becomes difficult to distinguish the function and its quadratic approximations on each subinterval.
Approximating f(x)=sin(pi x)+2 using simpson’s rule.
The graph of \(f(x)=\sin(\pi x)+2\) is shaped like wave that oscillates between \(y=3\) and \(y=1\) as it moves in the positive x direction. We consider the area under the curve from \(x=0\) to \(x=5\text{.}\) THe area is subdivided into eight intervals and each interval is approximated by quadratic curves. The first quadratic curve is a downward parabola with its vertex at \((3,0.5)\) which approximates the first two subintervals. The second quadratic curve is also a parabola whose vertex is located at \((1.5,1)\text{.}\) This parabola approximates the second two subintervals between \(x=1.25\) and \(x=2.5\text{.}\) The next two subintervals are are approximated by the left half of a parabola whose vertex is at \((3.75,1.25)\text{.}\) The area under the last two subintervals are approximated by a downwards parabola whose vertex is at \((3,4.5)\text{.}\)
Figure 5.5.17. An illustration of Simpson’s rule on \(f(x)=\sin(\pi x)+2\) over \([0,5]\) using \(8\) subintervals, resulting in \(4\) quadratic approximations
Let’s demonstrate Simpson’s Rule with a concrete example.

Example 5.5.18. Using Simpson’s Rule.

Approximate \(\ds\int_0^1 e^{-x^2}\, dx\) using Simpson’s Rule and 4 equally spaced subintervals.
Solution.
We begin by making a table of values as we have in the past, as shown in Figure 5.5.19.(a).
\(x_i\) \(e^{-x_i^2}\)
\(0\) \(1\)
\(0.25\) \(0.939\)
\(0.5\) \(0.779\)
\(0.75\) \(0.570\)
\(1\) \(0.368\)
(a)
Approximating the integral of e^{-x^2} using Simpson’s rule
The graph of \(e^{-x^2}\) starts from \((0, 1)\) and slopes downwards to the right in the positive \(x\) direction. We consider the are under the curve from \((0, 1)\) to \((1, 0.25)\) in the first quadrant. The area is subdivided into four equally spaced intervals. The top of the intervals are parts of parabolas that track the curve of \(e^{-x^2}\text{.}\) These approximating curves are almost identical to the parts of the graph they are tracking thus resulting in a much more accurate approximation.
(b)
Figure 5.5.19. A table of values to approximate \(\int_0^1e^{-x^2}\, dx\text{,}\) along with a graph of the function
Simpson’s Rule states that
\begin{equation*} \int_0^1e^{-x^2}\, dx \approx \frac{0.25}{3}\Big[1+4(0.939)+2(0.779)+4(0.570) + 0.368\Big] = 0.7468\overline{3}\text{.} \end{equation*}
Recall in Example 5.5.2 we stated that the correct answer, accurate to 4 places after the decimal, was 0.7468. Our approximation with Simpson’s Rule, with 4 subintervals, is better than our approximation with the Trapezoidal Rule using 5!
Figure 5.5.19.(b) shows \(f(x) = e^{-x^2}\) along with its approximating parabolas, demonstrating how good our approximation is. The approximating curves are nearly indistinguishable from the actual function.

Example 5.5.20. Using Simpson’s Rule.

Approximate \(\ds\int_{-\frac{\pi}4}^{\frac{\pi}2} \sin(x^3)\, dx\) using Simpson’s Rule and 10 equally spaced intervals.
Solution.
Figure 5.5.21 shows the table of values that we used in the past for this problem, shown here again for convenience. Again, \(\dx = (\pi/2+\pi/4)/10 \approx 0.236\text{.}\)
\(x_i\) \(\sin(x_i^3)\)
\(-0.7854\) \(-0.4657\)
\(-0.5498\) \(-0.1654\)
\(-0.3142\) \(-0.0310\)
\(-0.0785\) \(-0.0005\)
\(0.1571\) \(0.0039\)
\(0.3927\) \(0.0605\)
\(0.6283\) \(0.2455\)
\(0.8639\) \(0.6011\)
\(1.0996\) \(0.9710\)
\(1.3352\) \(0.6899\)
\(1.5708\) \(-0.6700\)
Figure 5.5.21. Values used to approximate \(\int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx\) in Example 5.5.20
Simpson’s Rule states that
\begin{align*} \int_{-\frac{\pi}4}^{\frac{\pi}2} \sin(x^3)\, dx \amp \approx \frac{0.2356}3\Big[(-0.4657)+4(-0.1654)+2(-0.0310) + \ldots\\ \amp \ldots + 2(0.9710) + 4(0.6899) + (-0.6700)\big]\\ \amp \approx 0.4701 \end{align*}
Approximating the integral of sin(x^3) using Simpson’s rule
The area under the graph of \(\sin(x^3)\) is subdivided into ten equally spaced subintervals. The leftmost part of the graph that is below the negative \(x\) axis is approximated by a straight line and the upper left part of a downward parabola on its right. The part of the graph on the first quadrant is subdivided into six subintervals. These are approximated by parabolas that are almost identical to the parts of the graphs they are approximating. The last part of the graph that is below the positive \(x\) axis, is approximated with the descending part of a downward parabola and a straight line.
Figure 5.5.22. Approximating \(\int_{-\frac{\pi}4}^{\frac{\pi}2}\sin(x^3)\, dx\) in Example 5.5.20 with Simpson’s Rule and 10 equally spaced intervals
Recall that the actual value, accurate to 3 decimal places, is 0.4609. Our approximation is within one \(1/100\)th of the correct value. The graph in Figure 5.5.22 shows how closely the parabolas match the shape of the graph.

Subsection 5.5.5 Summary and Error Analysis

We summarize the key concepts of this section thus far in the following Key Idea.

Key Idea 5.5.23. Numerical Integration.

Let \(f\) be a continuous function on \([a,b]\text{,}\) let \(n\) be a positive integer, and let \(\ds\dx = \frac{b-a}{n}\text{.}\)
Set \(x_0=a\text{,}\) \(x_1 = a+\dx\text{,}\) \(\ldots\text{,}\) \(x_i = a+i\dx\text{,}\) \(x_{n}=b\text{.}\)
Consider \(\ds\int_a^b f(x)\, dx\text{.}\)
Left Hand Rule: \(\ds\int_a^b f(x)\, dx \approx \dx\big[f(x_0) + f(x_1) + \ldots + f(x_{n-1})\big]\text{.}\)
Right Hand Rule: \(\ds\int_a^b f(x)\, dx \approx \dx\big[f(x_1) + f(x_2) + \ldots + f(x_{n})\big]\text{.}\)
Trapezoidal Rule: \(\ds\int_a^b f(x)\, dx \approx \frac{\dx}2\big[f(x_0) + 2f(x_1) + 2f(x_2) +\ldots + 2f(x_{n-1})+ f(x_{n})\big]\text{.}\)
Midpoint Rule: \(\ds \int_a^b f(x)\, dx \approx \sum_{i=1}^n f\left(\frac{x_{i-1}+x_{i}}{2}\right)\Delta x\text{.}\)
Simpson’s Rule: \(\ds\int_a^b f(x)\, dx \approx \frac{\dx}3\big[f(x_0) + 4f(x_1) + 2f(x_2) +\ldots + 4f(x_{n-1})+ f(x_{n})\big] \text{ for } n \text{ even}\text{.}\)
In our examples, we approximated the value of a definite integral using a given method then compared it to the “right” answer. This should have raised several questions in the reader’s mind, such as:
  1. How was the “right” answer computed?
  2. If the right answer can be found, what is the point of approximating?
  3. If there is value to approximating, how are we supposed to know if the approximation is any good?
These are good questions, and their answers are educational. In the examples, the right answer was never computed. Rather, an approximation accurate to a certain number of places after the decimal was given. In Example 5.5.2, we do not know the exact answer, but we know it starts with \(0.7468\text{.}\) These more accurate approximations were computed using numerical integration but with more precision (i.e., more subintervals and the help of a computer).
Since the exact answer cannot be found, approximation still has its place. How are we to tell if the approximation is any good?
“Trial and error” provides one way. Using technology, make an approximation with, say, 10, 100, and 200 subintervals. This likely will not take much time at all, and a trend should emerge. If a trend does not emerge, try using yet more subintervals. Keep in mind that trial and error is never foolproof; you might stumble upon a problem in which a trend will not emerge.
A second method is to use Error Analysis. While the details are beyond the scope of this text, there are some formulas that give bounds for how good your approximation will be. For instance, the formula might state that the approximation is within 0.1 of the correct answer. If the approximation is 1.58, then one knows that the correct answer is between 1.48 and 1.68. By using lots of subintervals, one can get an approximation as accurate as one likes. Theorem 5.5.24 states what these bounds are.
There are some key things to note about this theorem.
  1. The larger the interval, the larger the error. This should make sense intuitively.
  2. The error shrinks as more subintervals are used (i.e., as \(n\) gets larger).
  3. The maximum error in the Midpoint Rule is half of the maximum error in the Trapezoidal Rule. (Usually the errors in these two rules have opposite signs as well, that is one will be an under approximation and the other will be an over approximation).
  4. The error in Simpson’s Rule has a term relating to the \(4\)th derivative of \(f\text{.}\) Consider a cubic polynomial: its \(4\)th derivative is 0. Therefore, the error in approximating the definite integral of a cubic polynomial with Simpson’s Rule is \(0\) — Simpson’s Rule computes the exact answer!
We revisit Examples 5.5.9 and 5.5.18 and compute the error bounds using Theorem 5.5.24 in the following example.

Example 5.5.25. Computing error bounds.

Find the error bounds when approximating \(\ds \int_0^1 e^{-x^2}\, dx\) using the Trapezoidal and Midpoint Rules and 5 subintervals, and using Simpson’s Rule with 4 subintervals.
Solution.
Trapezoidal and Midpoints Rules with \(n=5\text{:}\)
We start by computing the \(2\)nd derivative of \(f(x) = e^{-x^2}\text{:}\)
\begin{equation*} \fpp(x) = e^{-x^2}(4x^2-2)\text{.} \end{equation*}
Figure 5.5.26 shows a graph of \(\fpp(x)\) on \([0,1]\text{.}\) It is clear that the largest value of \(\fpp\text{,}\) in absolute value, is 2.
Shows the double derivative of f.
The graph of \(\fpp(x)\) starts at \((0, -2)\) and curves upwards to the left towards the positive \(x\) axis. It intersects the \(x\) axis at \((0.7, 0)\text{.}\) Then it moves futher to the right in the positive \(x\) direction while moving upwards and ends at \((1, 0.5)\text{.}\)
Figure 5.5.26. Graphing \(\fpp(x)\) in Example 5.5.25 to help establish error bounds
Thus we let \(K=2\) and apply the error formula from Theorem 5.5.24.
\begin{equation*} E_T \leq \frac{(1-0)^3}{12\cdot 5^2}\cdot 2 = 0.00\overline{6}\text{.} \end{equation*}
Since the maximum error in the Midpoint rule is half the error in the Trapezoidal Rule, we can say: \(E_M \leq 0.00\overline{3}\)
Our error estimation formula states that our approximation of 0.7444 found in Example 5.5.9 is within 0.0067 of the correct answer. Hence we know that the actual value is within \([0.7444-0.0067, 0.7444+0.0067]=[0.7377,0.7511].\) So:
\begin{equation*} 0.7377 \leq \int_0^1e^{-x^2}\, dx \leq 0.7511 \end{equation*}
But we can do better than this with the Midpoint Rule since its error is at most half of the error of the Trapezoidal Rule. Our error estimate formula state that our approximate of \(0.7480\) found in Example 5.5.12 is within \(0.0034\) of the correct answer. Hence Hence we know that the actual value is within \([0.7480-0.0034, 0.7480+0.0033]=[0.7447,0.7513]\text{.}\)
We had earlier stated the actual answer, correct to 4 decimal places, to be 0.7468, affirming the validity of Theorem 5.5.24.
Simpson’s Rule with \(n=4\text{:}\)
We start by computing the \(4\)th derivative of \(f(x) = e^{-x^2}\text{:}\)
\begin{equation*} f^{(4)}(x) = e^{-x^2}(16x^4-48x^2+12)\text{.} \end{equation*}
Figure 5.5.27 shows a graph of \(f^{(4)}(x)\) on \([0,1]\text{.}\) It is clear that the largest value of \(f^{(4)}\text{,}\) in absolute value, is 12. Thus we let \(K=12\) and apply the error formula from Theorem 5.5.24.
\begin{equation*} E_s =\leq \frac{(1-0)^5}{180\cdot 4^4}\cdot 12 = 0.00026\text{.} \end{equation*}
Graphing the fourth derivative of f to help establish error bounds.
The graph of \(f^{(4)}(x)\) starts from \((12,0)\) in the positive \(y\)-axis and curves downwards to the right towards the positive \(x\) axis. It intersects the \(x\) axis close to \(x=0.5\) and continues moving downwards while also moving to the right in the positive x direction. It stops at the point \((1, -8)\text{.}\)
Figure 5.5.27. Graphing \(f^{(4)}(x)\) in Example 5.5.25 to help establish error bounds
Our error estimation formula states that our approximation of \(0.7468\overline{3}\) found in Example 5.5.18 is within \(0.00026\) of the correct answer, hence we know that the correct answer is in the interval \([0.74683-0.00026 , 0.74683 + 0.00026]=[0.74657,0.74709].\) So:
\begin{equation*} 0.74657 \leq \int_0^1e^{-x^2}\, dx \leq 0.74709\text{.} \end{equation*}
Once again we affirm the validity of Theorem 5.5.24 since the answer to 4 decimal places is actually \(0.7468\text{.}\)
At the beginning of this section we mentioned two main situations where numerical integration was desirable. We have considered the case where an antiderivative of the integrand cannot be computed. We now investigate the situation where the integrand is not known. This is, in fact, the most widely used application of Numerical Integration methods. “Most of the time” we observe behavior but do not know “the” function that describes it. We instead collect data about the behavior and make approximations based on this data. We demonstrate this in an example.

Example 5.5.28. Approximating distance traveled.

One of the authors drove his daughter home from school while she recorded their speed every 30 seconds. The data is given in Figure 5.5.29. Approximate the distance they traveled.
Time Speed
(min) (mph)
\(0\) \(0\)
\(1\) \(25\)
\(2\) \(22\)
\(3\) \(19\)
\(4\) \(39\)
\(5\) \(0\)
\(6\) \(43\)
\(7\) \(59\)
\(8\) \(54\)
\(9\) \(51\)
\(10\) \(43\)
\(11\) \(35\)
\(12\) \(40\)
\(13\) \(43\)
\(14\) \(30\)
\(15\) \(0\)
\(16\) \(0\)
\(17\) \(28\)
\(18\) \(40\)
\(19\) \(42\)
\(20\) \(40\)
\(21\) \(39\)
\(22\) \(40\)
\(23\) \(23\)
\(24\) \(0\)
Figure 5.5.29. Speed data collected at 30 second intervals for Example 5.5.28
Solution.
Recall that by integrating a speed function we get distance traveled. We have information about \(v(t)\text{;}\) we will use Simpson’s Rule to approximate \(\ds \int_a^b v(t)\, dt\text{.}\)
The most difficult aspect of this problem is converting the given data into the form we need it to be in. The speed is measured in miles per hour, whereas the time is measured in minutes.
We need to compute \(\dx = (b-a)/n\text{.}\) With 25 data points collected, there are \(n=24\) subintervals. What are \(a\) and \(b\text{?}\) Since we start at time \(t=0\text{,}\) we have \(a=0\text{.}\) The final recorded time was \(t=12\) minutes, which is 1/5 of an hour. Thus we have
\begin{equation*} \dx = \frac{b-a}{n} = \frac{1/5-0}{24} = \frac1{120}; \frac{\dx}{3} = \frac{1}{360}\text{.} \end{equation*}
Thus the distance traveled is approximately:
\begin{align*} \int_0^{0.2}v(t)\, dt \amp \approx \frac{1}{360}\Big[f(x_0)+4f(x_1) + 2f(x_2) + \cdots + 4f(x_{n-1})+f(x_{n})\Big]\\ \amp = \frac{1}{360}\Big[0+4\cdot25+2\cdot 22 + \cdots + 2\cdot40+4\cdot 23 + 0\Big]\\ \amp \approx 6.2167 \,\text{ miles. } \end{align*}
We approximate the author drove 6.2 miles. (Because we are sure the reader wants to know, the author’s odometer recorded the distance as about 6.05 miles.)

Exercises 5.5.6 Exercises

Terms and Concepts

1.
T/F: Simpson’s Rule is a method of approximating antiderivatives.
  • True
  • False
2.
What are the two basic situations where approximating the value of a definite integral is necessary?
3.
Why are the Left and Right Hand Rules rarely used?
4.
Simpson’s Rule is based on approximating portions of a function with what type of function?

Problems

Exercise Group.
In the following exercises, approximate the definite integral with the Trapezoidal Rule and Simpson’s Rule, with \(n=4\text{.}\) Then find the exact value.
5.
For the integral \(\int_{-1}^1 x^2\, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
6.
For the integral \(\int_{0}^{10} 5x\, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
7.
For the integral \(\int_{0}^{\pi} \sin(x) \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
8.
For the integral \(\int_{0}^{4} \sqrt x\, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
9.
For the integral \(\int_{0}^{3} (x^3+2x^2-5x+7)\, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
10.
For the integral \(\int_{0}^{1} x^4\, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
11.
For the integral \(\int_{0}^{2\pi} \cos(x) \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
12.
For the integral \(\int_{-3}^{3} \sqrt{9-x^2} \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
(c)
Find the exact value.
Exercise Group.
In the following exercises, approximate the definite integral with the Trapezoidal Rule and Simpson’s Rule, with \(n=6\text{.}\)
13.
For the integral \(\int_{0}^{1} \cos\big(x^2\big) \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
14.
For the integral \(\int_{-1}^{1} e^{x^2} \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
15.
For the integral \(\int_{0}^{5} \sqrt{x^2+1} \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
16.
For the integral \(\int_{0}^{\pi} x\sin(x) \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
17.
For the integral \(\int_{0}^{\pi/2} \sqrt{\cos(x) } \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
18.
For the integral \(\int_{1}^{4} \ln(x) \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
19.
For the integral \(\int_{-1}^{1} \frac{1}{\sin(x) +2} \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
20.
For the integral \(\int_{0}^{6} \frac{1}{\sin(x) +2} \, dx\text{:}\)
(a)
Approximate using the trapezoidal rule.
(b)
Approximate using Simpson’s rule.
Exercise Group.
In the following exercises, find \(n\) such that the error in approximating the given definite integral is less than \(0.0001\) when using the Trapezoidal Rule and Simpson’s Rule.
21.
For the integral \(\int_{0}^{\pi} \sin(x) \, dx\text{:}\)
(a)
Using the trapezoid rule.
(b)
Using Simpson’s rule.
22.
For the integral \(\int_{1}^{4} \frac{1}{\sqrt x} \, dx\text{:}\)
(a)
Using the trapezoid rule.
(b)
Using Simpson’s rule.
23.
For the integral \(\int_{0}^{\pi} \cos\big(x^2\big) \, dx\text{:}\)
(a)
Using the trapezoid rule.
(b)
Using Simpson’s rule.
24.
For the integral \(\int_{0}^{5} x^4 \, dx\text{:}\)
(a)
Using the trapezoid rule.
(b)
Using Simpson’s rule.
Exercise Group.
In the following exercises, a region is given. Find the area of the region using Simpson’s Rule:
  1. where the measurements are in centimeters, taken in 1 cm increments, and
  2. where the measurements are in hundreds of feet, taken in 100 ft increments.
25.
Finding area using Simpson’s rule.
26.
Finding area using Simpson’s rule.