In this laboratory we will explore Simpson’s rule.

The midpoint rule is given by the formula 


MP =   (Underoverscript[ ∑, (i=1), n])f((Subscript[x, i*]))   Δx = (∑_(i=1)^n)f(a + (i -1/2)(b-a)/n) ((b-a)/n)

The trapezoidal rule is given by 

TR   =   (Underoverscript[ ∑, (i=1), n])(((f((Subscript[x, i-1])) + f((Subscript[x, i]))))/2)Δx
See the notes  at simpsons.pdf in the calc2 directory.
Simpson’sRule is given by

SR =  (Underoverscript[ ∑, (i=0), n])(((f((Subscript[x, 2i])) + 4f((Subscript[x, 1+2i])) + f((Subscript[x, 2+2i])) ))/3)h 


Each line of code in a notebook must be executed by either using the Evaluate cell tab under the 
heading of Evaluation in the Mast  or by selecting -shift-return on the keyboard.

F1[x_]:=Sqrt[Sin[x]]
F1[x]

We may force the aspect ratio by using the following:

Plot[F1[x],{x,0,Pi}, PlotRange-> 1,AspectRatio -> Automatic]

We wish to now consider the problem of using numerical methods such as the Riemann midpoint sum which is 
ultimately the definition of the definte integral in the limit.  Below we have started Simpson’s Rule you must complete the formula 
and test for n=2,4,8, 16

n:=2
ns:= n/2
a:=0.0
b:=Pi
h:=(b-a)/n
IF1:= Re[Integrate[F1[x],{x,a,b}]]
MPA:=Sum[F1[a+ (i-0.5)*(b-a)/n]*(b-a)/n,{i,1,n}]
SRA :=(h/3)*Sum[F1[a+2*(i-1)*h]+4*F1[a+h+2*(i-1)*h] + F1[a+2h+2*(i-1)*h],{i,1,ns}]
Print["...IA.......MPA........SRA"]
Print[IF1,"....",MPA,"....",SRA]

Write Code below for the percent error of MPA and SRA

MPE:=Abs[(MPA-IF1)/IF1]*100
SRPE:=1
Print[IF1,"....",MPE,"....",SRPE]

fill in the chart below  for a= 0, b= Pi,  and  F(x)=Sqrt[Sin[x]]
n...................IA...............MPE................SRPE...........
2             2.39628                                          
4
8
16


Write here a short analysis of the various results above.


when finished email this completed file  to 

prcoulton@eiu.edu