5.1 Areas and Distances

Mathematica script by Chris Parrish,
cparrish@sewanee.edu

Sources and references for some of these problems include
James Stewart, "Calculus: Concepts and Contexts," Second Edition, Brooks/Cole, 2001
Deborah Hughes-Hallett, Andrew M. Gleason, et. al., "Calculus," Second Edition, John Wiley & Sons, 1998
Robert Fraga, ed., "Calculus Problems for a New Century," The Mathematical Association of America, 1993

Code for the Mathematica procedures AreaR, AreaL, and AreaM is modified slightly from programs developed in
Finch and Lehmann, "Exploring Calculus with

Calculating Riemann Sums

Generic Formulas for Riemann Sums

We first create the formulas for three types of Riemann Sums defined for a generic function f over an interval [a,b] using a uniform subdivision of [a,b] into n equal subintervals.
The three formulas correspond to the choice of lefthand endpoint rule, midpoint rule, and righthand endpoint rule for determining the heights of the rectangles to be constructed.

In[57]:=

Calculating Riemann Sums for Specific Functions
and Specific Values of n

Now apply these formulas to the task of calculating Riemann Sums for a specific function f over a specific interval [a,b] and with a specified number of subdivisions n.

In[61]:=

Out[67]//TableForm=

 n 10 50 100 500 RiemannSumL(n) 0.610509 0.656095 0.661463 0.665648 RiemannSumM(n) 0.668384 0.666831 0.666725 0.666672 RiemannSumR(n) 0.710509 0.676095 0.671463 0.667648

Taking the Limit of Riemann Sums
as n Goes to Infinity

In[68]:=

Out[72]=

In[73]:=

Out[73]=

In[74]:=

Out[74]=

Illustrating Riemann Sums

AreaR,  AreaL,  AreaM -- contains Mathematica code only, not worked exercises

Using Rectangles to Estimate the Area of the Region
under the Graph of  f(x) = and over the interval [0,].

Hughes-Hallett, Gleason, et al, Second Edition, Exercise 7.2.25, page 332

The Mathematica procedure called AreaRVerbose was designed to produce illustrations such as those to be found in Section 5.1 of Stewart and Section 7.2 of Hughes-Hallett, Gleason, et al. It takes four arguments: the function f, the right- and left-hand endpoints of the interval to be taken as the domain of f, and the number n of rectangles to use in the construction. The "R" in the procedure's name indicates that we will use the righthand endpoint of each subinterval along the x-axis to determine the height of the associated rectangle built on top of that subinterval. The"Verbose" in the name of the procedure indicates that it will print out a statement following the graph reporting the area of the approximating rectangles.

In[95]:=

Clear[f,x];

f[x_] := x/Sqrt[1 - x^4];

a = 0;            (* a = lefthand endpoint *)
b = 1/Sqrt[2];    (* b = righthand endpoint *)
n = 10;           (* n = number of rectangles *)

AreaRVerbose[f,a,b,n];

The Mathematica procedure called AreaLVerbose uses lefthand endpoints of the subintervals to determine the heights of the rectangles used in the construction.

In[101]:=

AreaLVerbose[f,a,b,n];

The Mathematica procedure called AreaMVerbose uses the midpoints of the subintervals to determine the heights of the rectangles used in the construction.

In[102]:=

AreaMVerbose[f,a,b,n];

Let's see what Mathematica's built-in numerical procedures produce as an estimate of the area we have been working with.

In[103]:=

NIntegrate[f[x],{x,a,b}]

Out[103]=

Which of the procedures AreaLVerbose, AreaMVerbose, AreaRVerbose produced the most accurate approximation to the true value of the integral?
How can you explain its relative accuracy?

Using Rectangles to Estimate the Area of the Region
under the Graph of  f(t) = Sin( and over the interval [, 1].

Hughes-Hallett, Gleason, et al, Second Edition, Exercise 7.2.26, page 332

First, use righthand endpoints for the construction.

In[104]:=

Clear[f,t];

f[t_] := Sin[1/t]

a = 1/4;  (* a = lefthand endpoint *)
b = 1;    (* b = righthand endpoint *)
n = 10;    (* n = number of rectangles *)

AreaRVerbose[f,a,b,n];

Then use use lefthand endpoints.

In[110]:=

AreaLVerbose[f,a,b,n];

And finally, let's use midpoints.

In[111]:=

AreaMVerbose[f,a,b,n];

Here is what Mathematica's built-in numerical procedures produce as its approximation to the (signed) area of the region.

In[112]:=

NIntegrate[f[t],{t,a,b}]

Out[112]=

Created by Mathematica  (April 6, 2004)