next up previous
Next: About this document ... Up: lab_template Previous: lab_template


Rectangular Approximations to Integrals


The purpose of this lab is to acquaint you with some rectangular approximations to integrals.

Rectangular Approximations

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 approximate the area under the curve of interest. Not all ``area finding'' problems can be solved using analytical techniques. The Riemann sum definition of area under a curve gives rise to several numerical methods which can 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.

In these simple rectangular approximation methods, 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 left, right and midpoint rules.

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 to help you understand the differences between the three different rectangular approximations. Note that the different rules choose rectangles which in each case will either underestimate or overestimate the area. Each of these comands has an optional third parameter that lets you specigy the number of subintervals. The last command in the group below shows this.

> with(student):
> rightbox(x^2,x=0..4);
> leftbox(x^2,x=0..4);
> middlebox(x^2,x=0..4);
> middlebox(x^2,x=0..4,8);
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 the desired numerical answers.
> rightsum(x^2,x=0..4);
> evalf(rightsum(x^2,x=0..4));
> evalf(leftsum(x^2,x=0..4));
> 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 improved. One way to measure how good the approximation is is the absolute error, which is the difference between the actual answer and the estimated answer. Later on in the course, you will learn techniques for finding the exact answer. Approximations, however, are important because exact answers cannot always be found.

All of the Maple commands described so far in this lab can include a third argument to specify the number of subintervals. The default is 4 subintervals. The example below approximates the area under $y=x^2$ from $x=0$ to $x=4$ using the rightsum command with 50, 100, 320 and 321 subintervals. As the number of subintervals increases, the approximation gets closer and closer to the exact answer. You can see this by assigning a label to the approximation, assigning a label to the exact answer $(4^3/3)$ and taking their difference. The closer you are to the actual answer, the smaller the difference. The example below shows how we can use Maple to approximate this area with an absolute error no greater than 0.1.

> exact := 4^3/3;
> estimate := evalf(rightsum(x^2,x=0..4,50));
> evalf(abs(exact-estimate));
> estimate := evalf(rightsum(x^2,x=0..4,100));
> evalf(abs(exact-estimate));
> estimate := evalf(rightsum(x^2,x=0..4,320));
> evalf(abs(exact-estimate));
> estimate := evalf(rightsum(x^2,x=0..4,321));
> evalf(abs(exact-estimate));


  1. Consider the function $f(x) = -x^3+3x^2-7x+44$ on the interval $[1,4]$. Use the command leftsum to approximate the definite integral

    \begin{displaymath}\int_{1}^{4} f(x) \, dx = \frac{315}{4} \end{displaymath}

    so that the absolute error is less than $0.5$. Looking at the graph of $f$, can you explain why the value given by the leftsum command is always greater than the value of the integral?
  2. Suppose that the the velocity of an object traveling in one dimension is given by $v(t) = 5-t+\cos(t)$ for $0 \leq t \leq 5$. Let $s(t)$ be the position of the object at time $t$, assuming that $s(0)=0$.
    1. As explained in your textbook, the position of the object at $t=5$ is equal to the area under the velocity curve from $t=0$ to $t=5$. Use the midpoint rule with $20$ subdivision to approximate the position of the object at $t=5$.
    2. Let $R_n$ be the right endpoint rule and $L_n$ the left endpoint rule approximations with $n$ subdivisions to the position of the object at $t=5$. Explain why the following relation holds for any value of $n$.

      \begin{displaymath}R_n < s(5) < L_n \end{displaymath}

      (Hint - look at the results of leftbox and rightbox commands for values of $n$ from about 4 to 10.)
    3. Evaluate $R_{500}$ and $L_{500}$. Based on your results, do you think your approximation using the midpoint rule with $20$ subintervals was within $0.1$ of the exact value for the area? Explain why or why not.

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
William W. Farr