Simpson's 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 of 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 the southern border.

>    with(plots):

Warning, the name changecoords has been redefined

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

[Maple Plot]

Do the data points and southern border provide a rough outline of the state of Virginia?

>   

4.  Construction of Approximating Parabolas

For Simpson's Rule, we construct an approximating parabola on each of 5 subintervals by fitting a quadratic function to 3 consecutive data points.  The following "do loop" determines the quadratic function on each of the subintervals 1 through 5.  The loop also creates a plot of each of the parabolas on each of the subintervals from 1 to 5.

>    for i from 1 to 5 do

>    par[i]:=x->a[i]*x^2+b[i]*x+c[i]:

>    s[i]:=solve({par[i](xborder[2*i-1])=yborder[2*i-1],par[i](xborder[2*i])=yborder[2*i],par[i](xborder[2*i+1])=yborder[2*i+1]},{a[i],b[i],c[i]}):

>    assign(s[i]):

>    pplotred[i]:=plot(par[i](x),x=xborder[2*i-1]..xborder[2*i+1],color=red,thickness=2):

>    od:

>   

5.  Visualization of Approximating Parabolas

To see the parabolas, we draw in vertical lines corresponding to our 5 subintervals(each containing 3 consecutive data points)  The following commands create a plot of these partition lines (note that there are 6 partition lines).

>    for i from 1 to 6 do

>    partition[i]:=PLOT(CURVES([[xborder[1+2*(i-1)],0],[xborder[1+2*(i-1)],yborder[1+2*(i-1)]]])):

>    od:

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

Now, we display what we've created so far.

>    display(sborder,partitionlines,pplotred[t] $t=1..5,view=[0..480,0..310]);

[Maple Plot]

>   

Does the red outline look like Virginia?

6.  Area Calculation by Integration

To find the area between the northern red (parabolic) border and the x axis, we determine the area between the approximating parabola and the x axis on each of the 5 subintervals.  We use integrals for this calculation.  The following "do loop" and "sum" commands do these calculations.

>    for j from 1 to 5 do

>    area[j]:=int(a[j]*x^2+b[j]*x+c[j],x=xborder[2*j-1]..xborder[2*j+1]);

>    od:

>    sum(area[k],k=1..5);

88290

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

>    88290-(474-24)*98;

44190

Thus, the Simpson's Rule approximation (using 10 subintervals, 5 parabolas) of the area of Virginia (minus the Eastern Shore) is 44190 square pixels.

>   

7.  Area Calculation by Simpson's Rule Formula

To determine the area between the northern red (parabolic) border and the x axis, we may use the Simpson's Rule formula from the book (using n = 10 subintervals).  We calculate

>    ((474-24)/(3*10))*(yborder[1]+4*yborder[2]+2*yborder[3]+4*yborder[4]+2*yborder[5]+4*yborder[6]+2*yborder[7]+4*yborder[8]+2*yborder[9]+4*yborder[10]+yborder[11]);

88290

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

>    88290-(474-24)*98;

44190

Thus, the Simpson's Rule approximation (using 10 subintervals, 5 parabolas) of the area of Virginia (minus the Eastern Shore) is 44190 square pixels.

>   

8.  Solution

According to the map scale,  80 miles = 87 pixels  so 80/87  miles = 1 pixel    so (80/87)^2  square miles = 1 square pixel

We convert 44190 square pixels to square miles

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

>   

37365.04162

>   

We conclude that the Simpson's Rule approximation (using 10 subintervals) of the area of Virginia (minus the Eastern Shore) is 37365 square miles.

>   

9.  Simpson's Rule Summary

Is your Simpson's Rule approximation an under or over approximation?  Explain.

Answer: