next up previous
Next: Decimal Place Accuracy Up: Labs and Projects for Previous: Purpose

Subsections


Background

Integration, the second major theme of calculus, deals with areas, volumes, masses, and averages such as centers of mass and gyration. In lecture you have learned that the area under a curve between two points a and b can be found as a limit of a sum of areas of rectangles which are in some sense ``under'' the curve of interest. As these sums, and their limits, are often tedious to calculate, there is clear motivation for the analytical techniques which will be introduced shortly in class. However, not all ``area finding'' problems can be solved using analytical techniques, and the Riemann sum definition of area under a curve gives rise to several numerical methods which can often approximate the area of interest with great accuracy.

Suppose f(x) is a non-negative, continuous function defined on some interval [a,b]. Then by the area under the curve y=f(x) between x=a and x=b we mean the area of the region bounded above by the graph of f(x), below by the x axis, on the left by the vertical line x=a, and on the right by the vertical line x=b.

All of the numerical methods in this lab depend on subdividing the interval [a,b] into subintervals of uniform length. For example, dividing the interval [0,4] into four uniform pieces produces the subintervals [0,1], [1,2], [2,3], and [3,4].

Rectangular approximations

In these simple approximation schemes, the area above each subinterval is approximated by the area of a rectangle, with the height of the rectangle being chosen according to some rule. In particular, we will consider the following rules:
left endpoint rule
The height of the rectangle is the value of the function f(x) at the left-hand endpoint of the subinterval.
right endpoint rule
The height of the rectangle is the value of the function f(x) at the right-hand endpoint of the subinterval.

midpoint rule
The height of the rectangle is the value of the function f(x) at the midpoint of the subinterval.

The Maple student package has commands for visualizing these three rectangular area approximations. To use them, you first must load the package via the with command. Then try the three commands given below. Make sure you understand the differences between the three different rectangular approximations. Take a moment to see that the different rules choose rectangles which in each case will either underestimate or overestimate the area. Even the midpoint rule, whose rectangles usually have heights more appropriate than those for the left endpoint and right endpoint rules, will produce an approximation which is not exact.

  > with(student):

  > rightbox(x^2,x=0..4);

  > leftbox(x^2,x=0..4);

  > middlebox(x^2,x=0..4);

There are also Maple commands leftsum, rightsum, and middlesum to sum the areas of the rectangles, see the examples below. Note the use of evalf to obtain numerical answers.

  > rightsum(x^2,x=0..4);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \sum_{{i}=1}^{4}} \,{i}^{2}\end{displaymath}\end{maplelatex}

  > evalf(rightsum(x^2,x=0..4));

\begin{maplelatex}
\begin{displaymath}
30.\end{displaymath}\end{maplelatex}

  > middlesum(x^2,x=0..4);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \sum_{{i}=0}^{3}} \, \left...
 ...
{\displaystyle \frac {1}{2}}\, \! \right) ^{2}\end{displaymath}\end{maplelatex}

  > evalf(middlesum(x^2,x=0..4));

\begin{maplelatex}
\begin{displaymath}
21.00000000\end{displaymath}\end{maplelatex}

The Maple commands above use the short-hand summation notation. Notice that Maple uses ``i'' as the index of summation. The variable ``k'' could have been used here as in the book. Since there are only four terms in the sums above, it isn't hard to write them out explicitly, as follows.

However, if the number of terms in the sum is large, summation notation saves a lot of time and space.

It should be clear from the graphs that adding up the areas of the rectangles only approximates the area under the curve. However, by increasing the number of subintervals the accuracy of the approximation can be increased. All of the Maple commands described so far in this lab permit a third argument to specify the number of subintervals. The default is 4 subintervals. See the example below for the area under y=x2 +1 from x=1 to x=5 using the rightsum command with 4, 10, 20 and 100 subintervals. (As this region describes a right triangle with height 2 and base 2, this area can be easily calculated to be exactly 2.) Try it yourself with the leftsum and middlesum commands.

  > evalf(rightsum(x^2+1,x=1..5));

\begin{maplelatex}
\begin{displaymath}
58.\end{displaymath}\end{maplelatex}

  > evalf(rightsum(x^2+1,x=1..5,10));

\begin{maplelatex}
\begin{displaymath}
50.24000000\end{displaymath}\end{maplelatex}

  > evalf(rightsum(x^2+1,x=1..5,20));

\begin{maplelatex}
\begin{displaymath}
47.76000000\end{displaymath}\end{maplelatex}

  > evalf(rightsum(x^2+1,x=1..5,100));

\begin{maplelatex}
\begin{displaymath}
45.81440000\end{displaymath}\end{maplelatex}

We can find the exact area to be 45.33333333, it appears that, as the number of subintervals increases, the rectangular approximation becomes more accurate.


next up previous
Next: Decimal Place Accuracy Up: Labs and Projects for Previous: Purpose

Christine M Palmer
3/24/1998