Error bound for composite Simpson's rule (source code)

= Error bound for composite Simpson's rule
{title2=$|I-S_n|\leq M(b-a)h^4/180$}

Suppose $f$ has a fourth <derivative> that is a <continuous function> on the <interval> $[a,b]$, and $|f^{(4)}(x)|\leq M$ there. With $I=\int_a^b f(x)\,dx$, the signed <quadrature error> here is $I-S_n$. Then, for some <point> $\xi\in(a,b)$,
$$
I-S_n=-\frac{b-a}{180}h^4 f^{(4)}(\xi),\qquad
|I-S_n|\leq\frac{M(b-a)}{180}h^4.
$$
In particular, a strictly positive fourth <derivative> makes $I-S_n<0$: <composite Simpson's rule> overestimates the <integral>.<NIST Digital Library of Mathematical Functions/3.5 Quadrature, subsection (ii) Simpson’s Rule>[NIST Digital Library of Mathematical Functions; §3.5(ii), equations 3.5.6–3.5.8: continuous fourth derivative, elementary remainder, composite formula and signed error]{ref}

The bound's scale follows by adding the panel errors. A panel of width $2h$ has signed <quadrature error> $-h^5 f^{(4)}(\xi_j)/90$ and <absolute error> at most $Mh^5/90$. There are $(b-a)/(2h)$ panels, so the <triangle inequality> gives $M(b-a)h^4/180$. The <intermediate value theorem> for the continuous fourth <derivative> replaces the average of the panel values $f^{(4)}(\xi_j)$ by a single value $f^{(4)}(\xi)$, giving the signed formula.

The underlying single-panel calculation can be seen through the <Peano kernel theorem>. On the <interval> $[0,2]$, define the raw <Peano kernel> $K(t)=L[(x-t)_+^3]$, where $L$ is <integral> minus <Simpson's rule> and $(x-t)_+=\max(x-t,0)$ is the <positive part>. Then $K(t)=-t^3(4-3t)/12$ for $0\leq t\leq1$ and $K(t)=-(2-t)^3(3t-2)/12$ for $1\leq t\leq2$. It is strictly negative inside the <interval> and has <integral> $-1/15$. Thus
$$
L(f)=\frac1{3!}\int_0^2 K(t)f^{(4)}(t)\,dt,\qquad
|L(f)|\leq\frac{\|f^{(4)}\|_\infty}{90}.
$$
The <uniform norm> $\|f^{(4)}\|_\infty$ bounds the fourth <derivative>. The <polynomial> $f(x)=x^4/24$ attains equality. Scaling to endpoint spacing $h$ multiplies the coefficient by $h^5$, giving the sharp single-panel bound $h^5\|f^{(4)}\|_\infty/90$. The normalized <Peano kernel> is $K/3!$, so the external <factorial> must be omitted when using that normalization.

For the <exponential function> on $[0,1]$, $f^{(4)}(x)=e^x$, so $M=e$ and the bound is $e/(180n^4)$. Its leading actual <absolute error> is $(e-1)/(180n^4)$, smaller than the bound because a uniform upper bound on the fourth <derivative> does not use its variation across the <interval>. The theorem bounds <truncation error> with exact <function evaluations>; sample errors and <roundoff error> are additional contributions, as described by <noise sensitivity of a quadrature rule>.