User:Egm6341.s10.team4.anandankala/HW1-8

=Problem 1.8=

Given
$$I=\int^1_0 \dfrac{e^x -1}{x}\,dx$$

Find
Using the below three methods, find the value of In, for n=2,4,6,8,... until the error(En) is of order 10-6.
 * 1) Taylor series expansion.
 * 2) Composite Trapezoidal rule.
 * 3) Composite Simpsons rule.

Solution
From Taylor series expansion we have,

$$e^x= \displaystyle\sum_{j=0}^{\infty}\frac{x^j}{j!}= 1+ \displaystyle\sum_{j=1}^{\infty}\frac{x^j}{j!}$$

$$\Rightarrow \dfrac{e^x -1}{x}= \displaystyle\sum_{j=1}^{\infty}\frac{x^{j-1}}{j!} $$

$$I_n= \displaystyle\int^1_0 f_n(x)\,dx$$

$$= \displaystyle\int^1_0 \displaystyle\sum_{j=1}^{n}\frac{x^{j-1}}{j!}\,dx$$= $$\displaystyle\sum_{j=1}^{n}\frac{1}{j!j}$$

$$f(x)-f_n(x)= R_n(x)=\dfrac{(x-0)^n}{(n+1)!} e^\xi$$,    $$\xi \in [0,x]$$

$$E_n= I-I_n$$

Where I= Exact Integral; In= Numerical Integration

$$\Rightarrow E_n= \displaystyle\int^1_0 [f(x)-f_n(x)]\,dx$$$$= \displaystyle\int^1_0 \dfrac{x^n}{(n+1)!}e^{\xi(x)}\,dx$$

Applying Integral Mean Value Theorem,

$$E_n=e^{\xi(x)}\displaystyle\int^1_0 \dfrac{x^n}{(n+1)!} \,dx$$,   $$\xi\in[0,1]$$

$$\Rightarrow E_n=e^{\xi(x)} \dfrac{1}{(n+1)!(n+1)}$$

Minimum of $$e^{\xi(x)}$$ =1 and maximum of $$e^{\xi(x)}$$= e.

From this, we get that $$\dfrac{1}{(n+1)!(n+1)} \leq E_n \leq \dfrac{e}{(n+1)!(n+1)}$$.

The value of the numerical Integral and the error are listed below for different values of n.
 * 1) n=2 $$E_n$$=0.0555          $$I_n$$=1.25000000.
 * 2) n=4 $$E_n$$=0.001667       $$I_n$$=1.31590000.
 * 3) n=6 $$E_n$$=0.000028       $$I_n$$=1.31779800.
 * 4) n=8 $$E_n$$=0.000000306  $$I_n$$=1.31783144.

According to composite Trapezoidal rule,let f(x) be a function continuous on [a,b]

$$I_n=h[\dfrac{f_0}{2}+f_1+f_2+f_3+f_4+.........+\dfrac{f_n}{2}]$$

where n= number of intervals;h= width of each interval= $$\dfrac{n}$$

In the present case a=0 and b=1. Hence $$h= \dfrac{1}{n}$$.

According to composite Simpson's rule,let f(x) be a function continuous on [a,b]

$$I_n= \dfrac{h}{3}[f_0+4f_1+2f_2+4f_3+2f_4+.........+2f_{n-2}+4f_{n-1}+f_n]$$

where n= number of intervals and n is an even number;h= width of each interval= $$\dfrac{n}$$