The Peano Kernel.

We now want to compare the error estimates that we get from the Peano kernel with the standard error estimate for the Trapezoid rule:

K[t_,a_,b_,n_] := Module[{h},
h = (b-a)/n;
(1/2)*Piecewise[Table[{(t - (a+i*h))(t - (a + (i+1)*h)),
	t ≥ a + i*h && t < a + (i+1)*h},
	  {i,0,n-1}]
]
];
Plot[K[t,0,1,5],{t,0,1},Filling->Axis]

We now consider the actual error estimates derived from the kernel and the usual formula for our standard case of integrating Sin[x] from 0 to pi. First, we define the two error bounds.

PKBound[f_,a_,b_,n_] := Module[{fpp,x,h,u},

fpp = D[f[u],u,u] /. u -> x;
h = (b-a)/n;

(h^2/8)* NIntegrate[Abs[fpp],{x,a,b}]

];

StandardBound[f_,a_,b_,n_,M_] := Module[{fpp,x,h,u},

fpp = D[f[u],u,u] /. u -> x;
h = (b-a)/n;

N[(b-a)(h^2/12)* M]

];

Now we look at some actual numbers. For a function with little variation in the second derivative, such as Sin[x], there's not an impressive advantage to going with the Peano kernel.

Clear[f];
f[x_] := Sin[x];

PKBound[f,0,Pi,7]
StandardBound[f,0,Pi,7,1]

PKTable = Table[PKBound[f,0,Pi,n],{n,20,100}];
STable = Table[StandardBound[f,0,Pi,n,1],{n,20,100}];

Show[
ListLinePlot[{PKTable, STable},Filling->Axis,PlotRange->Full,AxesOrigin->{0,0}],

ListPlot[{PKTable, STable}]
]

On the other hand, the Peano kernel really shines when you consider a function like Sin[x]^17, which has a big spike in its second derivative. Here we have

Clear[f];

f[x_] := (Sin[x])^17;
fpp := D[f[u],u,u] /. u -> x;
fpp 
Plot[fpp,{x,0,Pi}, PlotRange->Full,Filling->Axis]

It turns out that the maximum absolute value for the second derivative is 17 at Pi/2.

NMaximize[{-fpp,x > 0 && x < 2},x]

We now compare the Peano kernel with the regular error estimate.

Clear[f];
f[x_] := (Sin[x])^17;

PKTable = Table[PKBound[f,0,Pi,n],{n,20,100}];
STable = Table[StandardBound[f,0,Pi,n,17],{n,20,100}];

ListLinePlot[{PKTable,STable},Filling->Axis,PlotRange->Full,AxesOrigin->{0,0}, PlotMarkers->Automatic]

PKTable

STable

We can see that the Peano kernel version wins by a significant amount.