Homework, p. 540: #2, 28, 30

#2, p. 540:

LRR=.9540 
RRR=.7811
Trap=(LRR+RRR)/2
Mid=.8632
Simp=(2*Mid+Trap)/3

#28, p. 541

f[x_]:=1/Sqrt[x]

MidpointRule[a0_,b0_,m0_]:=
Module[{a=N[a0],b=N[b0],m=m0,k},
h=(b-a)/m;
sum=0;
For[k=1,k≤m,k++,
sum=sum+f[a+(k-1/2)h];
];
Return[h sum]; 
];
LeftRectangleRule[a0_,b0_,m0_]:=
Module[{a=N[a0],b=N[b0],m=m0,k},
h=(b-a)/m;
sum=0;
For[k=1,k≤m,k++,
sum=sum+f[a+(k-1)h];
];
Return[h sum]; 
];
RightRectangleRule[a0_,b0_,m0_]:=
Module[{a=N[a0],b=N[b0],m=m0,k},
h=(b-a)/m;
sum=0;
For[k=1,k≤m,k++,
sum=sum+f[a+k h];
];
Return[h sum]; 
];
TrapezoidalRule[a0_,b0_,m0_]:=
(RightRectangleRule[a0,b0,m0]+LeftRectangleRule[a0,b0,m0])/2;
SimpsonsRule[a0_,b0_,m0_]:=
(2*MidpointRule[a0,b0,m0/2]+TrapezoidalRule[a0,b0,m0/2])/3;

L6=LeftRectangleRule[1,4,6]
R6=RightRectangleRule[1,4,6]
T6=TrapezoidalRule[1,4,6]
M6=MidpointRule[1,4,6]
S12=SimpsonsRule[1,4,12]

L12=LeftRectangleRule[1,4,12]
R12=RightRectangleRule[1,4,12]
T12=TrapezoidalRule[1,4,12]
M12=MidpointRule[1,4,12]
S24=SimpsonsRule[1,4,24]

Int=Integrate[f[x],{x,1,4}]

Int-{R6,L6,T6,M6,S12}

Int-{R12,L12,T12,M12,S24}

Clear[fpp,fpppp]
fpp[x_]=D[f[x],{x,2}]
fpppp[x_]=D[f[x],{x,4}]
fpp[1]
fpppp[1]

ET6=fpp[1]*(4-1)^3/(12*6^2)
EM6=fpp[1]*(4-1)^3/(24*6^2)
ES6=fpppp[1]*(4-1)^5/(180*6^4)

ET12=fpp[1]*(4-1)^3/(12*12^2)
EM12=fpp[1]*(4-1)^3/(24*12^2)
ES12=fpppp[1]*(4-1)^5/(180*12^4)

#30, p. 541

S8=2/3*Total[{1,4,2,4,2,4,2,4,1}*{0,6.2,7.2,6.8,5.6,5.0,4.8,4.8,0}]