User:Egm6341.s10.Team4.yunseok/HW1

= Problem 7: Taylor series extension =

Given

 * {| style="width:70%" border="0" align="center"

f(x)= \sin(x),  x \in [0,\pi] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (1)


 * }
 * }

Find
1. Construct Taylor series of $$\displaystyle f(x)$$ around $$x_o=\dfrac{\pi}{4}$$  for n = 0, 1,..., 10

2. Plot these series (for each n)

3. Find (estimate of max)of R(x) at $$x=\dfrac{\pi}{2}$$

Solution
1. Construct Taylor series of $$\displaystyle f(x)$$ around $$x_o=\dfrac{\pi}{4}$$  for n = 0, 1,..., 10

when n=0,


 * {| style="width:70%" border="0" align="center"



P_0(x)= \sin(\dfrac{\pi}{4}) = \dfrac{1}{\sqrt{2}} $$
 * $$\displaystyle


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



R_0(x) = \sin(x)-\sin(\dfrac{\pi}{4}) $$
 * $$\displaystyle


 * }.
 * }.

when n=1,


 * {| style="width:70%" border="0" align="center"



P_1(x)= \sin(\dfrac{\pi}{4}) + (x-\dfrac{\pi}{4})\cos(\dfrac{\pi}{4}) = \dfrac{1}{\sqrt{2}} + \dfrac{1}{\sqrt{2}}(x-\dfrac{\pi}{4}) $$
 * $$\displaystyle


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



R_1(x) = -\sin(\xi)\dfrac{(x-\dfrac{\pi}{4})^2}{2!}, \xi \in [0,\pi] $$
 * $$\displaystyle


 * }.
 * }.

when n=2,
 * {| style="width:70%" border="0" align="center"



P_2(x)= \sin(\dfrac{\pi}{4}) + (x-\dfrac{\pi}{4})\cos(\dfrac{\pi}{4}) - \dfrac{(x-\dfrac{\pi}{4})^2}{2!}\sin(\dfrac{\pi}{4}) = \dfrac{1}{\sqrt{2}} + \dfrac{1}{\sqrt{2}}(x-\dfrac{\pi}{4})- \dfrac{1}{\sqrt{2}}\dfrac{(x-\dfrac{\pi}{4})^2}{2} $$
 * $$\displaystyle


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



R_2(x) = -\cos(\xi)\dfrac{(x-\dfrac{\pi}{4})^3}{3!}, \xi \in [0,\pi] $$
 * $$\displaystyle


 * }.
 * }.

when n=3,


 * {| style="width:70%" border="0" align="center"



P_3(x)= \sin(\dfrac{\pi}{4}) + (x-\dfrac{\pi}{4})\cos(\dfrac{\pi}{4}) - \dfrac{(x-\dfrac{\pi}{4})^2}{2!}\sin(\dfrac{\pi}{4}) - \dfrac{(x-\dfrac{\pi}{4})^3}{3!}\cos(\dfrac{\pi}{4}) = \dfrac{1}{\sqrt{2}} + \dfrac{1}{\sqrt{2}}(x-\dfrac{\pi}{4})- \dfrac{1}{2\sqrt{2}}(x-\dfrac{\pi}{4})^2 - \dfrac{1}{6\sqrt{2}}(x-\dfrac{\pi}{4})^3 $$
 * $$\displaystyle


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



R_3(x) = \sin(\xi)\dfrac{(x-\dfrac{\pi}{4})^4}{4!}, \xi \in [0,\pi] $$
 * $$\displaystyle


 * }.
 * }.

when n=4,


 * {| style="width:70%" border="0" align="center"



P_4(x)= P_3(x) + \dfrac{(x-\dfrac{\pi}{4})^4}{4!}\sin(\dfrac{\pi}{4}) $$
 * $$\displaystyle


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



R_4(x) = \cos(\xi)\dfrac{(x-\dfrac{\pi}{4})^5}{5!}, \xi \in [0,\pi] $$
 * $$\displaystyle


 * }.
 * }.

when n=5 ~ 10,


 * {| style="width:70%" border="0" align="center"



P_n(x)= P_{n-1}(x) + \dfrac{(x-\dfrac{\pi}{4})^n}{n!}f^{(n)}(\dfrac{\pi}{4}) $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (2)


 * }.
 * {| style="width:70%" border="0" align="center"
 * {| style="width:70%" border="0" align="center"



R_n(x) = f^{(n+1)}(\xi)\dfrac{(x-\dfrac{\pi}{4})^{n+1}}{(n+1)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (3)


 * }.
 * }.

where,
 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle f^{(n)}(x) = \sin(x)$$ n=4k,   (k=0,1,2,.......)

$$\displaystyle f^{(n)}(x) = \cos(x)$$ n=4k+1,   (k=0,1,2,.......)

$$\displaystyle f^{(n)}(x) = -\sin(x)$$ n=4k+2,   (k=0,1,2,.......)

$$\displaystyle f^{(n)}(x) = -\cos(x)$$ n=4k+3,   (k=0,1,2,.......)


 * }.
 * }.

2. plot $$\displaystyle P_n(x)$$ for n=0, 1, 2, ... 10

 Matlab Code: 

 Plots:  The plots for $$\displaystyle P_n(x)$$ with $$\displaystyle n= 0, 1, 2,. . . 10 $$ are shown below.

3. Find (estimate of max)of R(x) at $$x=\dfrac{\pi}{2}$$

from the equation $$\displaystyle (3)$$
 * {| style="width:70%" border="0" align="center"



R_n(x) = f^{(n+1)}(\xi)\dfrac{(x-\dfrac{\pi}{4})^{n+1}}{(n+1)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (4)


 * }.
 * }.


 * {| style="width:70%" border="0" align="center"



\left | R_n(\dfrac{\pi}{2}) \right |\leqslant \dfrac{(\dfrac{\pi}{2}-\dfrac{\pi}{4})^{n+1}}{(n+1)!} \underbrace{\max \left | f^{(n+1)}(\xi)\right |, \xi \in [0,\dfrac{\pi}{2}]}_{\leqslant 1} = \dfrac{(\dfrac{\pi}{4})^{n+1}}{(n+1)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (5)


 * }.
 * }.

$$\begin{array}{|c||c|c|c|c|c|c|c|c|c|c|c|}\hline n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline R_n(\dfrac{\pi}{2})&\dfrac{(\pi/4)^{1}}{1!}&\dfrac{(\pi/4)^{2}}{2!}&\dfrac{(\pi/4)^{3}}{3!}&\dfrac{(\pi/4)^{4}}{4!}&\dfrac{(\pi/4)^{5}}{5!}&\dfrac{(\pi/4)^{6}}{6!}&\dfrac{(\pi/4)^{7}}{7!}&\dfrac{(\pi/4)^{8}}{8!}&\dfrac{(\pi/4)^{9}}{9!}&\dfrac{(\pi/4)^{10}}{10!}&\dfrac{(\pi/4)^{11}}{11!}\\ \hline &7.854E-01&3.084E-01&8.075E-02&1.585E-02&2.490E-03&3.260E-04&3.658E-05&3.591E-06&3.134E-07&2.461E-08&1.757E-09\\ \hline \end{array} $$

= Exercise #8 =

Given

 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle f(x)= \frac{e^x-1}{x} $$
 * $$\displaystyle I= \int\limits_{0}^{1}\frac{e^x-1}{x}\, dx $$
 * }
 * }
 * }

Find
Use 3 methods to find $$I_n$$

1) Taylor series extention of $$f_n$$

2) Comp. Trap. Rule

3) Comp. Simpson Rule

n=2, 4, 8,. . . until error of order $$10^{-6}$$

Solution
1) Taylor series extention of $$f_n$$

because $$f_n$$ is like below,

$$\displaystyle f_n(x)= \sum_{j=1}^n \frac{x^{j-1}}{j!}$$

$$\displaystyle I_n= \int\limits_{0}^{1}f_n(x)\, dx = \int\limits_{0}^{1} \sum_{j=1}^n \frac{x^{j-1}}{j!}\, dx = \sum_{j=1}^n \frac{1}{j j!}$$

The erroer$$\displaystyle (E_n) $$ is

$$\displaystyle E_n= I-I_n = \int\limits_{0}^{1}f(x)-f_n(x)\, dx = \int\limits_{0}^{1} \frac{(x-0)^{n}}{(n+1)!} \frac{e^x-1}{x}\, dx \underbrace{=}_{IMVT} \max \left | \frac{e^\xi-1}{\xi} \right |\int\limits_{0}^{1} \frac{x^{n}}{(n+1)!} dx, \xi \in [0,1] \leqslant \frac{e-1}{(n+1)(n+1)!}$$

$$\displaystyle E_8 \leqslant 5.327\times10^{-6}$$

So, $$\displaystyle I_8 = \sum_{j=1}^7 \frac{1}{j j!} = 1.3179018$$

2) Comp. Trap. Rule

From the lecture note equation(2) p7-1

$$I_n = h\big[\dfrac{1}{2}f(x_o)+f(x_1)+f(x_2)+. . . +f(x_{n-1})+\dfrac{1}{2}f(x_n)\big]$$

--Egm6341.s10.Team4.yunseok 08:41, 25 January 2010 (UTC)