Next:Difference Notations Up:Main Previous: Numerical Differentiation

7. Numerical Integration:

The problem of numerical integration is that of determining an approximate value of the integral

$\displaystyle I=\int\limits_{a}^{b}f(x)dx$

If $ p(x)$ is the interpolating polynomial of degree n which approximate $ f(x)$ on $ [a,b]$ then for the error

$\displaystyle E=\int\limits_{a}^{b}f(x)dx-\int\limits_{a}^{b}p(x)dx$

we have the following theorem:
Theorem: Let $ x_i \,(i=0,1,íŽ,n)$ be $ n+1$ points on the interval $ [a,b]$. Let $ f(x_i)$ be the corresponding values of $ f$ at $ x=x_i$. Let $ p(x)$ be the polynomial of degree n which interpolates at the n+1 points $ (x_i,f_i)\,(i=0,1,...n).$ Then if

Ψ(x)=(x-x0)(x-x1).....(x-xn)

does not change sign on the interval $ [a,b]$, the error of numerical integration is given by

$\displaystyle \int\limits_{a}^{b}f(x)dx-\int\limits_{a}^{b}p(x)dx=\frac{f^{(n+1)}(\eta)}{(n+1)!}\int\limits_{a}^{b}\psi(x)dx$ ,

for some point $ \eta$ in $ [a,b]$.
Proof: We have from the error formula for the interpolating polynomial

$\displaystyle f(x)-p(x)=\frac{\psi(x)f^{(n+1)}(\xi)}{(n+1)!}$

Integrating, we get

$\displaystyle \int\limits_{a}^{b}f(x)dx-\int\limits_{a}^{b}p(x)dx=\int\limits_{a}^b\frac{\psi(x)f^{(n+1)}(\xi)dx}{(n+1)!}$

If $ \psi(x)$ does not change sign on the interval $ [a,b]$, then we can apply the second mean value theorem of integral calculus, we obtain the desired result. Let us assume that the function $ f(x)$ can be computed at a set of n+1 equally spaced points $ x_0,
x_1,...,x_n$. Then $ f(x)$ can be approximated by the Newton forward difference interpolating polynomial

where $ S=(x-x_0)/h$. Thus we have

Let us take n=0, we get

This is known as rectangular rule and we denote it as

$\displaystyle R_1=h
f_0$

The error of this approximation is

To find the integral of f(x) over an extended interval $ [a,b]$ we subdivide $ [a,b]$, into N equal subdivision, setting . Now

$\displaystyle \int\limits_{a}^{b}f(x)dx=\int\limits_{a}^{x_1}f(x)dx+\int\limits_{x_1}^{x_2}f(x)dx+...+\int\limits_{x_{N-1}}^{b}f(x)dx$

Applying the above formula to each integral yields the rectangular rule for the integral of $ f(x)$ over an interval $ [a,b]$:

$\displaystyle R_N=h(f_0+f_1+...+f_{N-1})$

and the error is given by

$\displaystyle E^R_N=\frac{ h^2}{2}[f'(\eta_0)+f'(\eta_1)+...+f'(\eta_{N-1})]$

and if is continuous over $ [a,b]$ , then

$\displaystyle E^R_N=\frac{(b-a)}{2}hf'(\eta)\qquad a < \eta < b$

A more accurate formula can be obtained by taking n=1, and we find that

which is known as Trapezoidal rule denoted by

$\displaystyle T_1=\frac{h}{2}(f_0+f_1)$

with the error given by

To obtain the integral over the interval $ [a,b]$, we subdivide $ [a,b]$ into N equal parts and use the above formula to each integral, this yields

$\displaystyle T_N=h(\frac{f_0}{2}+f_1+f_2+...+f_{N-1}+\frac{f_N}{2})$

The error of this formula is given by

Simpson's Rule
We integrate $ f(x)$ over the double interval $ [x_0, x_2]$ of width $ 2h$ and get

By direct integration, we find that

\begin{displaymath}\int\limits_{0}^{2}dS=2,\, \int\limits_{0}^{2}SdS=2,\,\int\li...
...array}{c}
S \\
4 \\
\end{array}%
\right)dS=\frac{1}{90}\end{displaymath}

If we retain difference through the third order, we obtain an approximation

$\displaystyle S_2=h(2f_0+2\Delta f_0+\frac{1}{2}\Delta ^2 f_0+0.\Delta^3f_0)$

This formula is called Simpson's rule.
The error of this formula is given by

To extend Simpson's rule for integration over an interval $ [a,b]$, we now divide $ [a,b]$ into an even number 2N of sub intervals of width h so that

$\displaystyle x_0=a\qquad x_{2N}=b \qquad (b-a)=2Nh$

and

$\displaystyle x_i-x_{i-1}=h\qquad i=1,2,...2N$

Using Simpson's rule over the interval $ [x_i,x_{i+2}]\,(i=0,2,...,2N-2)$,we have

If we now sum over the N subgroups of two intervals each, we obtain

and thus Simpson's rule for integration over an interval $ [a,b]$ which has been subdivided into 2N subintervals of length h is

$\displaystyle S_{2N}=\frac{h}{3}(f_0+4f_1+2f_2+4f_3+...+4f_{2N-1}+f_{2N})$

and since $ N=\frac{b-a}{2h}$, the error term is

Exercises



Next: Difference Notations Up: Main Previous: Numerical Differentiation