University of Florida/Egm6341/s10.team3.aks/HW3

Problem Statement
Use Error estimate for Taylor series, composite trapezoidal and composite Simpson's rule to find n such that $$ E_n = I - I_n = O(10^{-6}) $$ and compare to numerical results.

Solution

 * $$I=\int_{0}^{1}\frac{e^{x}-1}{x}dx$$

Taylor Series


 * $$e^{x}=\sum _{j=0}^{\infty }\frac{x^j}{j!}\Rightarrow \frac{e^{x}-1}{x}=\sum _{j=1}^{\infty }\frac{x^{j-1}}{j!}$$
 * $$I_n=\int_{0}^{1}f_n(x)dx=\int_{0}^{1}\sum _{j=1}^{\infty} \frac{x^{j-1}}{j!}dx=\sum _{j=1}^{n}\frac{x^j}{j!j}|_0^1=\sum _{j=1}^n \frac{1}{j!j}$$
 * $$f(x)-f_n(x)=R_n(x)=\frac{(x-x_0)^n}{(n+1)!}f^{(n+1)}(\xi)$$ with $$\xi \in [0,x] \,$$ and $$x_0=0 \,$$
 * $$\Rightarrow f(x)-f_n(x)=\frac{x^n}{(n+1)!}f^{(n+1)}(\xi)$$
 * $$E_n=I-I_n=\int_{0}^{1}\left [ f(x)-f_n(x) \right ]dx=\int_{0}^{1}\underbrace{\frac{x^n}{(n+1)!}}_{w(x)}\underbrace{f^{(n+1)}\left (\xi(x) \right )}_{g(x)}dx$$
 * $$\Rightarrow g(\alpha)\int_{0}^{1}w(x)dx$$ for $$\alpha \in [0,1]$$
 * $$E_n =\,$$
 * $$\Rightarrow max = \frac{g(\alpha)}{(n+1)!(n+1)}$$, $$\alpha= \frac{e}{(n+1)!(n+1)} \,$$
 * $$\Rightarrow min = \frac{g(\alpha)}{(n+1)!(n+1)}$$, $$\alpha= \frac{1}{(n+1)!(n+1)}\,$$
 * $$n=2, E_2 \leq .151016 \,$$
 * $$n=4, E_5 \leq .00453 \,$$
 * $$ n=6, E_6 \leq 6.2792 X 10^{-4} \,$$
 * $$ n=8, E_8 \leq 8.42 X 10^{-6} \,$$

Below are the values from Numerical Analysis of Taylor series from HW_1


 * $$n=2, E_2 \leq .151016 \,$$
 * $$n=4, E_5 \leq .00453 \,$$
 * $$ n=6, E_6 \leq 6.2792 X 10^{-4} \,$$
 * $$ n=8, E_8 \leq 8.42 X 10^{-6} \,$$

We are getting same values from both analysis for Taylor series

Trapazoidal Rule

Error for Composite Trapazoidal rule is given by

$$  \displaystyle \left | E_n^1 \right |\leq \frac{(b-a)^3}{12n^2}M_2 $$

where $$M_2 = max \left | f^{(2)} (\zeta )\right |$$ for $$\zeta \varepsilon [a,b]$$

For the given function $$f(x)= \frac{e^x - 1}{x}$$, we have

$$  \displaystyle f^{(2)}(x)= \frac{e^x [x^2-2x+2]-2}{x^3} $$

For the given interval [0,1] the maximum value of function $$f^{(2)}(x)$$ is achieved at $$x=1$$

$$  \displaystyle M_2= f^{(2)}(x=1)=\frac{e[1+2-2]-2}{1}=0.71828182 $$

$$ E_n^1 \leq \frac{(1-0)^3}{12n^2}X 0.71828182 $$

$$ E_2^1 \leq .014964204 $$

$$ E_4^1 \leq 3.74105 X 10^{-3} $$

$$ E_6^1 \leq 1.662689 X 10^{-3} $$

$$ E_8^1 \leq 9.3526278 X 10^{-4}$$

$$ E_{16}^1 \leq 2.3381569 X 10 ^{-4}$$

$$ E_{32}^1 \leq 5.845392 X 10 ^{-5}$$

$$ E_{64}^1 \leq 1.4613481 X 10^{-5}$$

$$ E_{128}^1 \leq 3.65337026 X 10^{-6} $$

$$ E_{256}^1 \leq 9.1334256 X 10^{-7}$$

Below are the results from Numerical analysis from HW 1

$$ E_2^1 \leq 0.010389576$$

$$ E_4^1 \leq 0.002602468 $$

$$ E_8^1 \leq 0.650935 X 10^{-3}$$

$$ E_{16}^1 \leq 162753 X 10^{-4}$$

$$ E_{32}^1 \leq 4.06892 X 10 ^{-5}$$

$$ E_{64}^1 \leq 1.0172 X 10^{-5}$$

$$ E_{128}^1 \leq 2.54263 X 10^{-6} $$

$$ E_{256}^1 \leq 6.3528 X 10^{-7}$$

We can see that we are getting order $$ 10^{-6}$$ at n=128 from both the analysis.

Composite Simpsons Rule

The error estimate of the Composite Simpson's rule is given as

$$   E_n^2 \leq \frac{(b-a)^5}{2880n^4}M_4 $$

where $$M_4 = max \left | f^{(4)} (\zeta )\right |$$ for $$\zeta \varepsilon [a,b]$$

For the given function $$f(x)= \frac{e^x - 1}{x}$$, we have

$$  \displaystyle f^{(4)}(x)= \frac{e^x [x^4-4x^3+12x^2-24x]-24}{x^5} $$

The function $$f^{4}(x)$$ has maximum value at $$x=1$$

$$  \displaystyle M_4= \frac{e[1-4+12-24+24]-24}{1}=0.46453645

$$

$$ E_n^1 \leq \frac{(1-0)^5}{2880n^4}X 0.46453645 $$

$$ E_2^2 \leq 1.00810 X 10^{-5} $$

$$ E_4^2 \leq 6.300678 X 10^{-7} $$

Below are the results from Numerical analysis from HW 1

$$ E_2^2 \leq 1.06514 X 10^{-4} $$

$$ E_4^2 \leq 6.76473 X 10^{-6} $$

We can see that we are getting order $$ 10^{-6}$$ at n=4 from both the analysis.