Trapezoidal Rule

1. Getting Started

First we clear all variables in Maple.

 > restart;

2. Collection of Data

Next we enter the data points from the border of Virginia.  We have identified 11 data points (and consequently a regular partition of 10 subintervals)

 > xborder:=[24,69,114,159,204,249,294,339,384,429,474]:

 > yborder:=[98,122,160,152,160,217,243,298,282,211,98]:

3.  Visualization of Data

We create a plot of the data points

 > borderdata:=PLOT(POINTS([xborder[t],yborder[t]] \$t=1..11)):

and also a plot a horizontal line for the southern border

 > sborder:=plot(98,x=xborder[1]..xborder[11],color=red,thickness=2):

And now display the data points and southern border as a check.

 > with(plots):

```Warning, the name changecoords has been redefined
```

 > display(borderdata,sborder,view=[0..480,0..300]);

Do the data points and southern border roughly outline the state of Virginia?

 >

4. Construction of Approximating Trapezoids

For the trapezoidal rule, we construct an approximating linear function on each of the 10 subintervals by connecting the right and left hand endpoint of each subinterval.  The following "do loop" finds a linear function on each of the subintervals from 1 to 10.  The "do loop" also creates a plot of each of the linear functions on each of the subintervals from 1 to 10.

 > for i from 1 to 10 do

 > line[i]:=x->b[i]*x+c[i]:

 > s[i]:=solve({line[i](xborder[i])=yborder[i],line[i](xborder[i+1])=yborder[i+1]},{b[i],c[i]}):

 > assign(s[i]):

 > lplot[i]:=plot(line[i](x),x=xborder[i]..xborder[i+1],color=red,thickness=2):

 > od:

5. Visualization of Approximating Trapezoids

To see the trapezoids, we draw in vertical lines corresponding to our regular partition.  The following commands create a plot of these partition lines.  Note there are 11 partition lines because there are 11 partition points.

 > For i from 1 to 11 do

 > partition[i]:=PLOT(CURVES([[xborder[i],0],[xborder[i],yborder[i]]])):

 > OD:

 > partitionlines:=display(partition[k] \$k=1..11):

Now we display what we've created so far.

 > display(borderdata,sborder,partitionlines,lplot[t] \$t=1..10,view=[0..480,0..310]);

 >

Does the red outline look like Virginia?

Note that the trapezoids extend from the northern red border of Virginia to the x axis.

6. Area Calculation using Geometric Formula

To find the area between the northern red border and the x axis, we use a geometric formula to determine the area of each of the trapezoids on the 10 subintervals and then sum these areas.  Note that this sum includes the area of the red region [state of Virginia] as well as the area of the rectangular region between the southern boundary of Virginia and the x-axis.  So, this approximation must be adjusted.

 > 45*sum((yborder[j]+yborder[j+1])/2,j=1..10);

To calculate the area of the red outlined Virginia, we must subtract the area of the rectangle with  top edge defined by the southern border of Virginia.

 > 87435-98*(472-24);

Thus, the trapezoidal approximation(using 10 subintervals) of the area of Virginia (minus the Eastern Shore) is 43531 square pixels.

7.  Area Calculation using Integrals

To find the area between the northern red border and the x axis, we determine the area between the approximating linear function and the x axis on each subinterval.  We use integrals for this calculation (Note:  Integration is not necessary when using trapezoids, but is necessary when using parabolas in Simpson's rule).  The following commands do the integral calculation on each subinterval and then sum those results.

 > For i from 1 to 10 do

 > area[i]:=int(b[i]*x+c[i],x=xborder[i]..xborder[i+1]);

 > OD:

 > sum(area[j],j=1..10);

To calculate the area of the red outlined Virginia, we must subtract the area of the rectangle with top edge defined by the southern border of Virginia.

 > 87435-98*(472-24);

Thus, the trapezoidal approximation(using 10 subintervals) of the area of Virginia(minus the Eastern Shore) is 43531 square pixels.

 >

8. Solution

According to the map scale,  80 miles = 87 pixels  so  miles = 1 pixel    so  square miles = 1 square pixel

We convert 43531 square pixels to square miles

 > 43531.*(80/87)^2;

 >

 >

We conclude that the trapezoidal approximation (using 10 subintervals) of the area of Virginia (minus the Eastern Shore) is 36808 square miles.

9.  Trapezoidal Summary

Is the your trapezoidal approximation an under or over approximation?  Explain.