# Ngô Quốc Anh

## January 11, 2009

### Composite Simpson rule

Filed under: Các Bài Tập Nhỏ, Giải tích 9 (MA5265), Nghiên Cứu Khoa Học — Ngô Quốc Anh @ 16:28

In topic composite trapezium rule I have shown you what is the so-called trapezium rule and the so-called composite trapezium rule. Recall that the idea of trapezium rule is the following approximation

$\displaystyle \int_{a}^{b} f(x) dx \approx (b-a)\frac{f(a) + f(b)}{2}$.

The right hand side of the above approximation is nothing but the integration of one-order Lagrange interpolation polynomial of $f$ at the nodes $x_0=a$ and $x_1=b$. If we add one more node, we then obtain a new approximation. This leads to the so-called Simpson rule.

In numerical analysis, Simpson’s rule is a method for numerical integration, the numerical approximation of definite integrals. Specifically, it is the following approximation

$\displaystyle\int_{a}^{b} f(x) \, dx \approx \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right]$.

One derivation replaces the integrand $f(x)$ by the quadratic polynomial $P_2(x)$ which takes the same values as $f(x)$ at the end points $a$ and $b$ and the midpoint $m=\frac{a+b}{2}$. One can use Lagrange polynomial interpolation to find an expression for this polynomial,

$\displaystyle P_2(x) = f(a) \frac{(x-m)(x-b)}{(a-m)(a-b)} + f(m) \frac{(x-a)(x-b)}{(m-a)(m-b)} + f(b) \frac{(x-a)(x-m)}{(b-a)(b-m)}$.

An easy calculation shows that

$\displaystyle\int_{a}^{b} P(x) \, dx =\frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right]$.

Next we will show you the error of Simpson rule. Firstly, we assume that  $f(x)$ is of fourth continuously differentiable. Similarly to the trapezium rule, by considering the following function

$\displaystyle g\left( y \right) = f\left( y \right) - {P_2}\left( y \right) - \frac{4} {{{{\left( {b - a} \right)}^2}}}\left( {f'\left( x \right) - {{P'}_2}\left( x \right)} \right)\left( {y - a} \right)\left( {y - m} \right)\left( {y - b} \right)$.

We firstly see that $g(a)=g(m)=g(b)=g'(m)$, then with the aid of Hermite interpolation, there exists a $\xi \in [a,b]$ such that

$\displaystyle f\left( y \right) - {P_2}\left( y \right) = \frac{{{f^{\left( 4 \right)}}\left( {\xi \left( y \right)} \right)}} {{4!}}\left( {y - a} \right){\left( {y - m} \right)^2}\left( {y - b} \right)$.

Since

$\displaystyle\int_a^b {\frac{{{f^{\left( 4 \right)}}\left( {\xi \left( x \right)} \right)}} {{4!}}\left( {x - a} \right){{\left( {x - m} \right)}^2}\left( {x - b} \right)dx} = \frac{{{f^{\left( 4 \right)}}\left( \xi \right)}} {{4!}}\int_a^b {\left( {x - a} \right){{\left( {x - m} \right)}^2}\left( {x - b} \right)dx}$

and

$\displaystyle\int_a^b {\left( {x - a} \right){{\left( {x - m} \right)}^2}\left( {x - b} \right)dx} = - \frac{{{{\left( {b - a} \right)}^5}}} {{120}}$

then we deduce that

$\displaystyle\int_a^b {f\left( x \right)dx} = \int_a^b {{P_2}\left( x \right)dx} - \frac{{{{\left( {b - a} \right)}^5}}} {{120}}\frac{{{f^{\left( 4 \right)}}\left( \xi \right)}} {{4!}} = \int_a^b {{P_2}\left( x \right)dx} - \frac{{{h^5}}} {{90}}{f^{\left( 4 \right)}}\left( \xi \right)$

where $h = \frac{b-a}{2}$. Regarding to composite Simpson rule, if the interval of integration $[a,b]$ is in some sense “small”, then Simpson’s rule will provide an adequate approximation to the exact integral. By small, what we really mean is that the function being integrated is relatively smooth over the interval $[a,b]$. For such a function, a smooth quadratic interpolant like the one used in Simpson’s rule will give good results.

However, it is often the case that the function we are trying to integrate is not smooth over the interval. Typically, this means that either the function is highly oscillatory, or it lacks derivatives at certain points. In these cases, Simpson’s rule may give very poor results. One common way of handling this problem is by breaking up the interval $[a,b]$ into a number of small subintervals. Simpson’s rule is then applied to each subinterval, with the results being summed to produce an approximation for the integral over the entire interval. This sort of approach is termed the composite Simpson’s rule.

Suppose that the interval $[a,b]$ is split up in $n$ subintervals, with $n$ an even number. Then, the composite Simpson’s rule is given by

$\displaystyle\int_a^b f(x) dx\approx \frac{h}{3}\bigg[f(x_0)+2\sum_{j=1}^{n/2-1}f(x_{2j})+ 4\sum_{j=1}^{n/2}f(x_{2j-1})+f(x_n) \bigg]$,

where $x_i = a + ih$ for $i = 0,1,...,n-1,n$ with $h = \frac{b-a}{n}$; in particular, $x_0 =a$ and $x_n=b$. The above formula can also be written as

$\displaystyle\int_a^b f(x)dx\approx \frac{h}{3}\bigg[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x_{n-1})+f(x_n)\bigg]$.

The error committed by the composite Simpson’s rule is bounded (in absolute value) by

$\displaystyle\frac{h^4}{180}(b-a) \max_{\xi\in[a,b]} |f^{(4)}(\xi)|$,

where $h$ is the “step length”.