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.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://maa.org/sites/default/files/images/upload_library/4/vol3/virginia/trapsolution10.html", "fetch_time": 1701515309000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2023-50/segments/1700679100399.81/warc/CC-MAIN-20231202105028-20231202135028-00278.warc.gz", "warc_record_offset": 448340544, "warc_record_length": 3185, "token_count": 1210, "char_count": 4457, "score": 3.734375, "int_score": 4, "crawl": "CC-MAIN-2023-50", "snapshot_type": "latest", "language": "en", "language_score": 0.6819209456443787, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00057-of-00064.parquet"}