Taylor Series Model

S[x_]=Normal[Series[f[x],{x,0,4}]] (*Taylor Series expansion*)

S[((0+h)/2)] (*Example*)

Definite Integral of Taylor Series

Exact=Simplify[Integrate[S[x],{x,0,h}]] (*Exact integral of S(x) on [a,b]*)

Midpoint Integration

Midpoint = Simplify[h S[(h/2)]]

Expand[Simplify[Midpoint-Exact]]

Trapezoid Integration

Trap=Simplify[h((S[0]+S[h])/2)] (*Series expansion of trapezoid rule about c*)

Expand[Simplify[Trap-Exact]]

(*How does this compare to Midpoint??*)

Simpson Rule

Simp=FullSimplify[(h/6)(S[0]+4S[(h/2)]+S[h])]

Expand[Simplify[Simp-Exact]]

Conditioning of Interpolatory Quadrature Schemes

nQ=10;  (* a=1, b=nQ, ... Interval width: b-a = nQ-1 *)

UnitVector[nQ,2]

Clear[poly]

poly[n_,k_]:=InterpolatingPolynomial[UnitVector[n,k],x]

Plot[Table[poly[nQ,k],{k,1,nQ}], {x,1,nQ},PlotRange->{-1,1}]

quadWeights=N[Integrate[Table[poly[nQ,k],{k,1,nQ}],{x,1,nQ}]]

ListPlot[Sort[quadWeights]]

nQ-1

Sum[quadWeights[[i]],{i,nQ}]

Norm[quadWeights,1]

ConditionNumber = Norm[quadWeights,1]/(nQ-1)

quadWeights

Finite Differences

(*Taylor series of f about x=c: *)
S[x_]=Normal[Series[f[x],{x,c,4}]] (*Longer Taylor Series expansion*)

S[c+h]

FwdDiff=Series[((S[c+h]-S[c])/h),{h,0,2}]

BwdDiff=Series[((S[c]-S[c-h])/h),{h,0,2}]

CenteredDiff=Series[((S[c+h]-S[c-h])/(2h)),{h,0,3}]

CenteredDiff2ndDeriv = Series[((S[c+h]-2S[c]+S[c-h])/(h^2)),{h,0,3}]

Solving for Higher-order One-Sided Finite Difference Schemes
   (f^((k)))(0) = (Subscript[(∑^n), i=1])(Subscript[c, i]) f((Subscript[x, i]))

nSamples =10;

iSamples=Table[i, {i,0,nSamples-1}]

Phi=Table[(iSamples^j)/Factorial[j],{j,0,nSamples-1}]; Phi[[1,1]]=1; MatrixForm[Phi]

InvPhi=Inverse[Phi]; MatrixForm[InvPhi]

(* cHat for (f^((1))) *)
MatrixForm[InvPhi[[All,2]]  ]

(* Define a test function *)
testFunc[x_]:=Sin[x]

(* Our finite-diff estimate of (f^((k)))(0) using h-spaced samples *) fk[k_, h_]:=(InvPhi[[All,k+1]]).testFunc[h iSamples]/(h^k)

fkExact[k_]:=(D[testFunc[x],{x,k}])/.{x->0}  (* Exact value of (f^((k)))(0) *)

fkExact[1]  (* First derivative at x=0 is Cos(0)=1 *)

Series[fk[1,H]-fkExact[1],{H,0,nSamples+1}]

Plot[Abs[fk[1,h]-fkExact[1]],{h,0,1}]

Plot[Log10[Abs[fk[1,h]-fkExact[1]]],{h,0,0.1}]

h0=(1/8);

(* Finite difference estimate *)
N[fk[1,h0],60]

(* Relative Error*) 
 N[Abs[(fk[1,h0]-fkExact[1])/fkExact[1]]]

ListPlot[testFunc[h0 iSamples]]

Richardson Extrapolation

S[x_]=Normal[Series[f[x],{x,c,14}]] (*Longer Taylor Series expansion*)

DS[h_]=Simplify[((S[c+h]-S[c-h])/(2h))] (* O((h^2)) Centered-Difference Scheme *)

Expand[DS[h]]

Expand[(3^2)DS[(h/3)]]

DS2[h_]=Expand[((DS[h]-(3^2)DS[(h/3)])/(1-(3^2)))]

See a pattern? :) ... 
Continuing Recursively...

DS4[h_]=Expand[((DS2[h]-(3^4)DS2[(h/3)])/(1-(3^4)))]

DS6[h_]=Expand[((DS4[h]-(3^6)DS4[(h/3)])/(1-(3^6)))]

DS8[h_]=Expand[((DS6[h]-(3^8)DS6[(h/3)])/(1-(3^8)))]

DS10[h_]=Simplify[((DS8[h]-(3^10)DS8[(h/3)])/(1-(3^10)))]  (* An O((h^12)) finite difference approx! *)

Romberg Integration

g[x_]:=4 Sqrt[1-(x^2)]

Integrate[g[x],{x,0,1}]

NIntegrate[g[x],{x,0,1},12]

NIntegrate[g[x],{x,0,1},WorkingPrecision->100]