f[x_]:=Sqrt[1+Cos[x]^2];m=70;
it[f_,a_,b_,n_]:=(h=(b-a)/n;
cc=Join[{1},Table[2,n-1],{1}];
yy=Table[f[a+i*h],{i,0,n}];
h/2*(cc.yy)
)
is[f_,a_,b_,n_]:=(h=(b-a)/n;
cc=Join[{1},Table[{4,2},n/2-1],{4,1}]//Flatten;
yy=Table[f[a+i*h],{i,0,n}];
h/3*(cc.yy)
)
job[f_,a_,b_]:=(
i0=Integrate[f[x],{x,a,b}]//N;
tt=Table[{n,Abs[it[f,a,b,n]-i0]},{n,2,m,2}];
ts=Table[{n,Abs[is[f,a,b,n]-i0]},{n,2,m,2}];
ListLogLogPlot[{tt,ts},Joined->True,PlotLegends->{"trapezoid","Simpson"}]
);
p1=job[f,0.0,Pi/3]
p2=job[f,0.0,Pi/2]
Show[p1,p2,PlotRange->All]