ClearAll[f,x,trueAns,t,m,g2,g3,s,sm,n,w1,w2,w3,x1,x2,x3]

f[x_]:=1/Sqrt[1+Exp[Sin[x]]];     (* Define your function here *)

Integrate[f[x],{x,-1,1}]

trueAns=N[Integrate[f[x],{x,-1,1}],15]                 (* The true answer *)

Plot[f[x],{x,-1.1,1.1}]               (* Plot the function *)

t:=f[-1]+f[1];               (* The trapezoid rule *)
m:=2 f[0];                         (* The midpoint rule (also known as 1-pt Gauss)  *)
g2=f[-Sqrt[1/3]]+f[Sqrt[1/3]];             (* The 2-pt Gauss formula *)
g3=(5/9)f[-Sqrt[(3/5)]]+(8/9)f[0]+(5/9)f[Sqrt[(3/5)]];  (* The 3-pt Gauss formula *)

N[t,15]-trueAns             (* The error for the Trapezoid Rule on the above problem *)

N[m,15]-trueAns           (* The error for the MidPoint Rule on the above problem *)

N[g2,15]-trueAns           (* The error for the 2-pt Gauss Formula on the above problem *)

N[g3,15]-trueAns          (* The error for the 3-pt Gauss Formula on the above problem *)

N[g2-g3]                           (* An estimate for the error for the 2-pt Gauss Formula on the above problem *)

(* Now, pick some "random" nodes in the interval (-1,1)   *)                    
x1=-23/40;x2=1/3;x3=4/5;

Solve[{w1+w2+w3==2,w1 x1+w2 x2 +w3 x3==0,w1 (x1^2)+w2 (x2^2) +w3 (x3^2)==2/3}]  (* Get the weights  *)

s=(1152/1199)f[-23/40]+(456/763)f[1/3]+(34/77)f[4/5]-trueAns   (* The error for the new formula on the above problem *)

x1=-1;x2=0;x3=1;  (* Now these are the nodes for Simpson's Rule  *)

Solve[{w1+w2+w3==2,w1 x1+w2 x2 +w3 x3==0,w1 (x1^2)+w2 (x2^2) +w3 (x3^2)==2/3}]  (* Now solve for the weights for Simpson's Rule  *)

(w1 (x1^3)+w2 (x2^3) +w3 (x3^3)==0)/.{x1->-1,x2->0,x3->1,w1->(1/3),w3->(1/3),w2->(4/3)}  (* Shows Simpson's Rule is at least degree 3 *)

sm=(1/3)f[-1]+(4/3)f[0]+(1/3)f[1]-trueAns                  (* The error for the Simpson's Rule on the above problem *)

boole=(14/90)f[-1]+(64/90)f[-(1/2)]+(24/90)f[0]+(64/90)f[(1/2)]+(14/90)f[1]-trueAns   (* The error for the Boole's Rule (5-point Closed Newton-Cotes) on the above problem *)

myplot=Plot[{Log[n],n-1,3n/2,2n-1},{n,2,30},PlotStyle->{Hue[0.0],Hue[0.3],Hue[0.5],Hue[0.8]}] ; (* How the degree grows with the number of points *)

Show[myplot,Graphics[{Text["Gauss",{13,30}],Text["Patterson",{22,30}],Text["Most Methods",{24,18}],Text["Romberg",{25,5}]},PlotRange->All],Frame->True,FrameLabel->{"n, the number of nodes","degree"," "," "}]