next up previous
Next: Exercises Up: Labs and Projects for Previous: Labs and Projects for


Area Approximations


The purpose of this lab is to acquaint you with some rectangular approximations to areas under curves.


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.

  > 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);

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

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


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

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

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


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=x from x=0 to x=2 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,x=0..2));


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


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


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


Since, in this trivial example, we knew that the area is exactly 2, it appears that, as the number of subintervals increases, the rectangular approximation becomes more accurate. What would happen with a not so trivial region? The next two sections describe ways of assessing the accuracy of some rectangular approximations.

Upper and lower sums

We introduce two more rectangular approximations.
upper sum approximation
The height of the rectangle is the absolute maximum of f(x) on the subinterval.
lower sum approximation
The height of the rectangle is the absolute minimum of f(x) on the subinterval.

It should be clear that, if the area being approximated has A square units of area, then

lower sum $\leq$ A $\leq$ upper sum

In general, it is rather complicated to compute upper and lower sums. However, if f(x) is monotonic, the situation is much easier. If f(x) is increasing on the interval [a,b], then the upper sum is just the right sum and the lower sum is just the left sum. In the last example with f(x) = x, the right sums (which are upper sums) moved down toward the value of A as the number of subintervals increased. What happens with the left sums (which are lower sums) as n, the number of subintervals, increases? The approximations of the area using these two rules do not generate approximations which are necessarily more or less accurate than the first three rules presented. However, they are informative in that they give lower and upper bounds on what the true area is so that, if the function is not monotonic, at least a range for the true area is available.

Error bounds

The midpoint rule with n subintervals (designated as Mn) usually gives better accuracy than either the left endpoint rule (Ln) or the right endpoint rule (Rn). This means that, for a given n, Mn is generally closer to A than either Ln or Rn. In numericcal analysis texts it is shown that the error, EMn, in using Mn to approximate the area under y = f(x) on [a,b] satisfies

$\vert A-M_n\vert=\vert EM_n\vert\leq \frac{B(b-a)^3}{24n^2}$

where B is the absolute maximum of |f''(x)| on [a,b]. In practice, B is often approximated by a number K that is an upper bound for B, that is B < K. For instance, if $f(x) = \sin{2x}$ on $[0,\frac{\pi}{5}]$, K might be taken as 4. Do you see why? For more complicated functions, Maple can be used to get a value for K that is close to B. Note that the error bound formula gives a worst case estimate, the accuracy achieved for a given number of subintervals n may be much better than the guarantee given by the formula.

next up previous
Next: Exercises Up: Labs and Projects for Previous: Labs and Projects for

Christine M Palmer