next up previous
Next: Upper and lower sums Up: Background Previous: Background

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

displaymath203

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

displaymath204

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

displaymath205

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

displaymath206

The Maple commands above use the short-hand summation notation. Since there are only four terms in the sums above, it isn't hard to write them out explicitly, as follows.

eqnarray83

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

displaymath207

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

displaymath208

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

displaymath209

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

displaymath210

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.


next up previous
Next: Upper and lower sums Up: Background Previous: Background

Sean O Anderson
Tue Nov 5 14:24:02 EST 1996