Error of Analysis of Newton-Cotes formulas

=Error Analysis of Newton-Cotes formulas=

The Newton-Cotes formulas are a group of formulas for evaluating numeric integration at equally spaced points.

==The Methods == Let $$x_i$$, $$i=0,\ldots,n$$, be $$n+1$$ equally spaced points, and $$f_i$$ be the corresponding values. Let $$h$$ be the space $$h=x_{i+1}-x_i$$, and let $$s$$ be the interpolation variable $$s=\frac{x-x_0}{h}$$. Thus to interpolate at x,
 * $$\begin{align}x-x_0&=sh\,,\\x-x_1&=x-(x_0+h)=(s-1)h\,,\\\vdots\\x-x_n&=(s-n)h\,.\end{align}$$

A polynomial $$P_n(x)$$ of degree $$n$$ can be derived to pass through these points and approximate the function $$f(x)$$. Using divided differences and Newton polynomial, $$P_n(x)$$ can be obtained as
 * $$\begin{align}P_n(x)&=[f_0]+[f_0,f_1](x-x_0)+\cdots+[f_0,\ldots,f_n](x-x_0)(x_1)\ldots(x-x_{n-1})\\

&=[f_0]+[f_0,f_1]sh+\cdots+[f_0,\ldots,f_n]s(s-1)\ldots(s-n+1)h^n\,.\end{align}$$ From the general form of polynomial interpolation error, the error of using $$P_n(x)$$ to interpolate $$f(x)$$ can be obtained as
 * $$\begin{align}E_{\text{interpolate}}(x) &=f(x)-P_n(x)\\&=\frac{1}{(n+1)!}(x-x_0)(x-x_1)\cdots (x-x_n)f^{(n+1)}(\xi)\\&=\frac{1}{(n+1)!}s(s-1)(s-2)\ldots (s-n)h^{n+1}f^{(n+1)}(\xi)\end{align}$$

where $$x_0\leqslant\xi\leqslant x_n$$.

Since $$ dx=d(x_0+sh)=hds$$, the error term of numerical integration is

The Trapezoid Rule
Let's consider the trapezoid rule in a single interval. In each interval, the integration uses two end points. Thus $$n+1=2$$. Then $$n=1$$. Applying ($$), we get
 * $$E_{\text{integrate}}=h\int\limits_{0}^{1}\frac{s(s-1)}{2}h^2f(\xi)ds=-\frac{1}{12}h^3f(\xi)=O(h^3)$$

where $$x_0 \leqslant \xi \leqslant x_1 $$. Thus the local error is $$O(h^3)$$. Consider the composite trapezoid rule. Given that $$n=\frac{x_n-x_0}{h}$$, the global error is

where $$x_i \leqslant \xi_i \leqslant x_{i+1}$$, $$x_0 \leqslant \bar{\xi} \leqslant x_n$$.

To justify ($$), we can need the theorem below in page 345: If $$g(x)$$ is continuous and the $$c_i\ge 0$$, then for some value $$\theta $$ in the interval of all the arguments $$ g(\theta) \sum c_i=\sum\limits_{i=1}^N c_ig(\theta_i)\,.$$

The Simpson's 1/3 Rule
Consider Simpson's 1/3 rule. In this case, three equally spaced points are used for integration. Thus $$n+1=3$$. Applying ($$), we get
 * $$E_{\text{integrate}}=h\int\limits_{0}^{2}\frac{s(s-1)(s-2)}{6}h^3f'''(\xi)ds=0$$

where $$x_0 \leqslant \xi \leqslant x_2 $$.

This doesn't mean that the error is zero. It simply means that the cubic term is identically zero. The error term can be obtained from the next term in the Newton polynomial, obtaining
 * $$E_{\text{integrate}}=h\int\limits_{0}^{2}\frac{s(s-1)(s-2)(s-3)}{24}h^4f^{(4)}(\xi)ds=-\frac{1}{90}h^{5}f^{(4)}(\xi)=O(h^5)\,.$$

Thus the local error is $$O(h^5)$$ and the global error is $$O(h^4)$$.

The Simpson's 3/8 Rule
Consider Simpson's 3/8 rule. In this case, $$n+1=4$$ since four equally spaced points are used. Applying ($$), we get
 * $$E_{\text{integrate}}=h\int\limits_{0}^{3}\frac{s(s-1)(s-2)(s-3)}{24}h^4f^{(4)}(\xi)ds=-\frac{3}{80}h^5f^{(4)}(\xi)=O(h^5)$$

where $$x_0 \leqslant \xi \leqslant x_3 $$.

Both the Simpon's 1/3 rule and the 3/8 rule have error terms of order $$h^5$$. With smaller coefficient, the 1/3 rule seems more accurate. Then why do we need the 3/8 rule? The 3/8 rule is useful when the total number of increments $$n$$ is odd. Three increments can be used with the 3/8 rule, and then the rest even number of increments can be used with 1/3 rule.

A Numerical Example
Given the set of data points, solve the numerical integration $$I=\int\limits_{3.1}^{3.9}f(x)dx$$

Solution
Use the trapezoid rule. First try $$h=0.8$$. That is, use only the two end points. We can get
 * $$I(h=0.8)=\frac{0.8}{2}(-0.32258065-0.25641026)=-0.23159636$$

Compared with the exact solution $$I=-0.22957444$$ we have
 * $$E_{\text{integrate}}=0.00202192\,.$$

Using all three points with $$h=0.4$$ we can get
 * $$I(h=0.4)=\frac{0.4}{2}(-0.32258065-2\times 0.28571429-0.25641026)=-0.23008389$$

and so
 * $$E_{\text{integrate}}=0.00050945\,.$$

Thus the error ratio is $$ \frac{E_{\text{integrate}}(h=0.8)}{E_{\text{integrate}}(h=0.4)}=3.97$$. This is close to what we can get by inspecting
 * $$\frac{E_{\text{integrate}}(h)}{E_{\text{integrate}}(h/2)}=\frac{O(h^2)}{O(h/2)^2}=2^2=4$$.

Exercises
===Exercise 1 === Using the data given below, find the maximum error incurred in using Newton's forward interpolation formula to approximate $$x=0.14$$.

Solution: According the general error formula of polynomial interpolation
 * $$|E_{\text{interpolate}}| \leqslant \left|\frac{1}{(n+1)!}(x-x_0)(x-x_1)\cdots (x-x_n)\right|[\max| f^{(n+1)}(x)|]$$

where $$x \in [0.1,0.5]$$.

Given that $$h=0.1, n=4, x=0.14$$, and $$ \max| f^{(n+1)}(x)|=e^{0.5}$$, we can get
 * $$|E_{\text{interpolate}}| \leqslant \left|\frac{1}{5!}(0.14-0.1)(0.14-0.2)\cdots (0.14-0.5) e^{0.5}\right| <0.0000005$$.

Exercise 2
When using Simpson's 1/3, what is the error ratio supposed to be? Solution: $$\frac{E_{\text{integrate}}(h)}{E_{\text{integrate}}(h/2)}=\frac{O(h)^4}{O(h/2)^4}=2^4=16\,.$$