User:Egm6341.s10.team3.sa/HW1 updated

HW Problem Set 1 

= Plotting a given function $$ f(x) $$ = Ref: Lecture Notes [[media:Egm6341.s10.mtg2.pdf|p.2-2]]

Problem Statement
$$f(x) = \frac{e^x -1}{x} x \in [0,1] $$ (i) Find $$ \lim_{x\rightarrow 0} f(x)$$ (ii)Plot $$ \displaystyle f(x) $$

Solution
(i) By L'Hospital's rule,
 * {| style="width:100%" border="0" align="left"


 * $$\lim_{x\rightarrow 0} f(x) = \lim_{x\rightarrow 0} \frac{e^x -1}{x}$$
 * }
 * }
 * }


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


 * $$ = \lim_{x\rightarrow 0} \frac {\frac{d}{dx}(e^x -1)} {\frac {d}{dx}(x)}$$
 * }
 * }
 * }


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


 * $$ = \lim_{x\rightarrow 0} {e^x}$$
 * }
 * }
 * }


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


 * $$\displaystyle =1 $$
 * }
 * }
 * }

(ii) MATLAB Code to generate the plot

Plot :  $$\frac {e^x -1}{x}$$ vs $$ \displaystyle x $$

Subramanian Annamalai 21:44, 20 February 2010 (UTC)

= Taylor Series Expansion of $$ f(x)=e^{x} $$= Ref: Lecture notes [[media:Egm6341.s10.mtg2.pdf|p.2-3]]

Problem Statement
$$\displaystyle f(x)=e^{x} $$

Find

(i)$$\displaystyle P_{n}(x) $$ and

(ii)$$\displaystyle R_{n+1}(x) $$

Solution
From [[media:Egm6341.s10.mtg2.pdf|p.2-2]] and [[media:Egm6341.s10.mtg2.pdf|p.2-3]] of the class note, $$\displaystyle P_{n}(x) $$ and $$\displaystyle R_{n+1}(x) $$ are defined by
 * {| style="width:100%" border="0" align="left"

P_{n}(x)=f(x_{0})+\frac{(x-x_{0})}{1!}f^{(1)}(x_{0})+\cdots+\frac{(x-x_{0})^{n}}{n!}f^{(n)}(x_{0}) $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

R_{n+1}(x)=\frac{1}{n!}\int_{x_{0}}^{x}(x-t)^{n}f^{(n+1)}(t)dt=\frac{(x-x_{0})^{n+1}}{(n+1)!}f^{(n+1)}(\xi), \quad \xi\in[x_{0},x] $$ $$ respectively.
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * }
 * }

Also, note that the following property of $$\displaystyle e^{x} $$:
 * {| style="width:100%" border="0" align="left"

\frac{d^{n}}{dx^{n}}\left(e^{x}\right)=e^{x}, \quad n=1, 2, \cdots. $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }
 * }

(i) Let's plug $$\displaystyle f(x)=e^{x} $$ into Eq. 1.
 * {| style="width:100%" border="0" align="left"

P_{n}(x)=e^{x_{0}}+\frac{(x-x_{0})}{1!}\frac{d}{dx}\left(e^{x_{0}}\right)+\cdots+\frac{(x-x_{0})^{n}}{n!}\frac{d^{n}}{dx^{n}}\left(e^{x_{0}}\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4)
 * }
 * }

Now, use Eq. 3 to simplify Eq. 4. Then,
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \Rightarrow P_{n}(x)=e^{x_{0}}+\frac{(x-x_{0})}{1!}e^{x_{0}}+\cdots+\frac{(x-x_{0})^{n}}{n!}e^{x_{0}} $$ $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * $$\displaystyle (Eq. 5)
 * }
 * }

(ii) Let's plug $$\displaystyle f(x)=e^{x} $$ into Eq. 2.
 * {| style="width:100%" border="0" align="left"

R_{n+1}(x)=\frac{1}{n!}\int_{x_{0}}^{x}(x-t)^{n}\frac{d^{n+1}}{dt^{n+1}}\left(e^{t}\right)dt=\frac{(x-x_{0})^{n+1}}{(n+1)!}\frac{d^{n+1}}{dx^{n+1}}\left(e^{x}\right), \quad x= \xi, \quad \xi\in[x_{0},x] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 6)
 * }
 * }

Now, use Eq. 3 to simplify Eq. 6. Then,
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \Rightarrow R_{n+1}(x)=\frac{1}{n!}\int_{x_{0}}^{x}(x-t)^{n}e^{t}dt=\frac{(x-x_{0})^{n+1}}{(n+1)!}e^{\xi}, \quad \xi\in[x_{0},x] $$ $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * $$\displaystyle (Eq. 7)
 * }
 * }

Hence $$ \displaystyle f(x)$$ can be expressed as follows: $$\displaystyle f(x)=e^{x} $$ can be expressed in Taylor series expansion by
 * {| style="width:100%" border="0" align="left"

$$\displaystyle f(x)=e^{x}=\underbrace{e^{x_{0}}\sum_{j=0}^{n}\frac{(x-x_{0})^{j}}{j!}}_{P_{n}(x)}+\underbrace{\frac{(x-x_{0})^{n+1}}{(n+1)!}e^{\xi}}_{R_{n+1}(x)}, \quad \xi\in[x_{0},x] $$ $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * $$\displaystyle (Eq. 8)
 * }
 * }

Yong Nam Ahn 02:51, 21 February 2010 (UTC)

= Plot Functions sin (x),-cos (x)and sin(x) - cos(x) =

Ref. Lecture notes [[media:Egm6341.s10.mtg3.pdf|p.3-3 ]]

Problem Statement
Plot f(x)= sin(x) and g(x) = - cos(x) $$ {\in} [0,{\pi}] $$

and also find $$||f(x)||_{\infin}, ||g(x)||_{\infin} and ||f(x)-g(x)||_{\infin}$$

Solution
Plot f(x)= sin(x) $$ {\in} [0,{\pi}] $$

Matlab code :

Plot :

f(x)=y= sin(x)



Plot g(x)= - cos(x) $$ {\in} [0,{\pi}] $$

Matlab code :

Plot :

g(x)= y = - cos(x)



Plot f(x)-g(x)= sin(x) + cos(x)

Matlab code :



$$||f(x)||_{\infin} = 1$$

$$||g(x)||_{\infin} = 1$$

$$||f(x)-g(x)||_{\infin} = \sqrt{2}$$

Abhishekksingh 20:46, 21 February 2010 (UTC)

= Prove IMVT =

Ref: Lecture Notes [[media:Egm6341.s10.mtg5.pdf|p.5-1]]

Problem Statement
Prove :

(i) $$ \int_{a}^{b}w(x)\cdot f(x)dx = f(\xi )\int_{a}^{b}w(x)dx $$  for   $$ w(x)\geq 0 $$

(ii) Another version of IMVT $$w(x)<0$$ for all $$ x\in [a,b] $$

Solution
(i) $$ m\cdot w(x)\leq f(x)\cdot w(x)\leq M\cdot w(x)$$

where, m:=min f(x) M:=max f(x) m and M are constants

a) Integrating, $$ m\cdot \int_{a}^{b}w(x)dx\leq \int_{a}^{b}w(x)\cdot f(x)dx\leq M\cdot \int_{a}^{b}w(x)dx$$

b) Dividing by $$ \frac{1}{\int_{a}^{b}w(x)dx} $$ $$ m\leq \underbrace{\frac{1}{\int_{a}^{b}w(x)dx}\int_{a}^{b}w(x)\cdot f(x)dx}_{Z} \leq M $$ $$ Z=\frac{1}{\int_{a}^{b}w(x)dx}\int_{a}^{b}w(x)\cdot f(x) dx$$

c) By Intermediate Value Theorem, There exists $$ \xi \in [a,b] at   f(\xi)=Z $$

$$ \therefore f(\xi)=\frac{1}{\int_{a}^{b}w(x)dx}\int_{a}^{b}w(x)\cdot f(x)dx $$


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

$$\displaystyle \therefore \int_{a}^{b}w(x)\cdot f(x)dx = f(\xi )\int_{a}^{b}w(x)dx \quad for \quad w(x)\geq 0 $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }
 * }

(ii) $$ m\cdot \left | w(x) \right |\leq f(x)\cdot \left | w(x) \right |\leq M\cdot \left | w(x) \right | $$

where, m:=min f(x) M:=max f(x) m and M are constants

a) Integrating, $$ m\cdot \int_{a}^{b}\left | w(x) \right |dx\leq \int_{a}^{b}\left | w(x) \right |\cdot f(x)dx\leq M\cdot \int_{a}^{b}\left | w(x) \right |dx $$

b) Dividing by $$ \frac{1}{\int_{a}^{b}\left | w(x) \right |dx} $$ $$ m\leq \underbrace{\frac{1}{\int_{a}^{b}\left | w(x) \right |dx}\int_{a}^{b}\left | w(x) \right |\cdot f(x)dx}_{Z} \leq M $$ $$ Z=\frac{1}{\int_{a}^{b}\left | w(x) \right |dx}\int_{a}^{b}\left | w(x) \right |\cdot f(x)dx $$

c) By Intermediate Value Theorem, There exists $$ \xi \in [a,b] at   f(\xi)=Z $$

d) $$ w(x) $$ is strictly negative, so $$ f(\xi)=\frac{1}{\cancelto{}{(-1)}\cdot\int_{a}^{b}w(x)dx}\cdot\cancelto{}{(-1)}\cdot\int_{a}^{b}w(x)\cdot f(x)dx $$

$$ \therefore f(\xi)=\frac{1}{\int_{a}^{b}w(x)dx}\cdot\int_{a}^{b}w(x)\cdot f(x)dx $$


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

$$\displaystyle \therefore \int_{a}^{b}w(x)\cdot f(x)dx = f(\xi )\int_{a}^{b}w(x)dx \quad for \quad w(x)< 0 $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }
 * }

--Heejun Chung 03:20, 21 February 2010 (UTC)

= Proof : Taylor series by IMVT = Ref: Lecture Notes [[media:Egm6341.s10.mtg5.pdf|p.5-1]]

Problem Statement
See IMVT in [[media:Egm6341.s10.mtg2.pdf|Lecture p.2-3]]


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

$$ with $$ w(x)\geqslant 0 \quad \forall \ x \in [a,b] $$
 * $$\displaystyle \int_{a}^{b} w(x)f(x)\ dt = f(\xi)\int_{a}^{b} w(x)\ dt
 * $$\displaystyle \int_{a}^{b} w(x)f(x)\ dt = f(\xi)\int_{a}^{b} w(x)\ dt
 * }

Use IMVT to show that (5) in [[media:Egm6341.s10.mtg2.pdf|Lecture p.2-2]] is equal to (1) in [[media:Egm6341.s10.mtg2.pdf|Lecture p.2-3]]


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

= \frac{1}{n!} \frac{(x-x_0)^{n+1}}{(n+1)!}f^{(n+1)}(\xi)
 * $$\displaystyle R_n+1(x) = \frac{1}{n!} \int_{x_0}^{x} (x-t)^n f^{(n+1)}(t)\ dt

$$
 * }

for $$\quad \xi \in [x_0,x]$$

Solution
Because $$t \in [x_0,x]$$, thus $$ (x-t)^n \geqslant 0 $$, according to IMVT we have following equations:


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

= \frac{1}{n!} g(\xi)\int_{x_0}^{x} w(t)\ dt = \frac{1}{n!} f^{(n+1)}(\xi) \int_{x_0}^{x} (x-t)^n\ dt $$ $$ Int. $$ \int_{x_0}^{x} (x-t)^n\ dt $$, we have
 * $$ \displaystyle R_{n+1}(x) = \frac{1}{n!} \int_{x_0}^{x} \underbrace{(x-t)^n}_{w(t)} \underbrace{f^{(n+1)}(t)}_{g(t)}\ dt
 * $$ \displaystyle R_{n+1}(x) = \frac{1}{n!} \int_{x_0}^{x} \underbrace{(x-t)^n}_{w(t)} \underbrace{f^{(n+1)}(t)}_{g(t)}\ dt
 * $$\displaystyle (Eq. 1)
 * }
 * }


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

= \cancelto{o}{-\frac{(x-x)^{n+1}}{n+1}} + \frac{(x-x_0)^{n+1}}{n+1} = \frac{(x-x_0)^{n+1}}{n+1} $$ $$
 * $$ \displaystyle \int_{x_0}^{x} (x-t)^n\ dt = \left [ -\frac{(x-t)^{n+1}}{n+1} \right ]_{t=x_0}^{t=x}
 * $$ \displaystyle \int_{x_0}^{x} (x-t)^n\ dt = \left [ -\frac{(x-t)^{n+1}}{n+1} \right ]_{t=x_0}^{t=x}
 * $$\displaystyle (Eq. 2)
 * }
 * }

Use Eq.1 & Eq.2 we have :


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

$$ \displaystyle \Rightarrow  R_{n+1}(x) = \frac{1}{n!} \int_{x_0}^{x} (x-t)^n f^{(n+1)}(t)\ dt = \frac{(x-x_0)^{n+1}}{(n+1)!}f^{(n+1)}(\xi)
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |

$$
 * style = |
 * }

for $$\quad \xi \in [x_0,x]$$ --Min Zhong 03:20, 21 February 2010 (UTC) = Taylor series - Generating higher order terms -Integration by parts = Ref: Lecture Notes [[media:Egm6341.s10.mtg5.pdf|p.5-3]]

Problem Statement

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

$$ $$
 * $$\displaystyle f(x) = f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \int_{x_0}^{x} (x-t) f^{(2)}(t)\, dt
 * $$\displaystyle f(x) = f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \int_{x_0}^{x} (x-t) f^{(2)}(t)\, dt
 * $$\displaystyle (Eq. 1)
 * }
 * }

(i)Repeat int. by parts to reveal the following items with remainder


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


 * $$\displaystyle \frac{(x-x_0)^2}{2!}\ f^{(2)}(x_0) + \frac{(x-x_0)^3}{3!}\ f^{(3)}(x_0) $$


 * }

(ii)Assume (4)and (5) in [[media:Egm6341.s10.mtg2.pdf|Lecture p.2-2]] are true, do int. by parts one more time

Solution
(i)Int.$$\int_{x_0}^{x} (x-t){f^{(2)}(t)} dt $$ by parts in Eq 1:


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

\int_{x_0}^{x} \underbrace{(x-t)}_{U^\prime} \underbrace{f^{(2)}(t)}_{V}\, dt & = \left [ UV \right ]_{x_0}^x -  \int_{t=x} UV^\prime\, dt \\ & = \left [ -\frac{(x-t)^2}{2}\ f^{(2)}(t) \right ]_{t=x_0}^{t=x} + \underbrace{\int_{x_0}^{x} \frac{(x-t)^2}{2}f^{(3)}(t)\, dt}_{W1} \\ & = \cancelto{o}{-\frac{(x-x)^2}{2}\ f^{(2)}(x)} + \frac{(x-x_0)^2}{2}\ f^{(2)}(x_0) + W1\\ & = \frac{(x-x_0)^2}{2!}\ f^{(2)}(x_0) + W1\\ \end{align} $$ $$
 * $$ \displaystyle \begin{align}
 * $$ \displaystyle \begin{align}
 * $$\displaystyle (Eq. 2)
 * }
 * }

Use Eq 1, Eq 2, we have:
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$\Rightarrow \ f(x) = f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \frac{(x-x_0)^2}{2!}\ f^{(2)}(x_0) + \frac{1}{2!}\int_{x_0}^{x} {(x-t)^2}f^{(3)}(t)\, dt
 * $$\Rightarrow \ f(x) = f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \frac{(x-x_0)^2}{2!}\ f^{(2)}(x_0) + \frac{1}{2!}\int_{x_0}^{x} {(x-t)^2}f^{(3)}(t)\, dt
 * <p style="text-align:right;">$$\displaystyle (Eq. 3)
 * }
 * }

Int. $$\int_{x_0}^{x} {(x-t)^2}f^{(3)}(t)\,dt $$ by part one more time in Eq 3:
 * {| style="width:100%" border="0" align="left"

\int_{x_0}^{x} \underbrace{(x-t)^2}_{U^\prime} \underbrace{f^{(3)}(t)}_{V}\, dt & = \left [ UV \right ]_{x_0}^x -  \int_{t=x} UV^\prime\, dt \\ & = \left [ -\frac{(x-t)^3}{3}\ f^{(3)}(t) \right ]_{t=x_0}^{t=x} + \underbrace{\int_{x_0}^{x} \frac{(x-t)^3}{3}f^{(4)}(t)\, dt}_{W2} \\ & = \cancelto{o}{-\frac{(x-x)^3}{3}\ f^{(3)}(x)} + \frac{(x-x_0)^3}{3}\ f^{(3)}(x_0) + W2\\ & = \frac{(x-x_0)^3}{3}\ f^{(3)}(x_0) + W2\\ \end{align} $$ $$ Use Eq 3, Eq 4, we have:
 * $$ \displaystyle \begin{align}
 * $$ \displaystyle \begin{align}
 * <p style="text-align:right;">$$\displaystyle (Eq. 4)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\Rightarrow \ f(x) = f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \frac{(x-x_0)^2}{2!}\ f^{(2)}(x_0) + \frac{(x-x_0)^3}{3!}\ f^{(3)}(x_0) + \underbrace{\frac{1}{3!}\int_{x_0}^{x} (x-t)^3f^{(4)}(t)\, dt}_{Remainder} $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }

(ii)Int. $$\int_{x_0}^{x} {(x-t)^n}f^{(n+1)}(t)\,dt $$ by part one more time:


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

\int_{x_0}^{x} \underbrace{(x-t)^n}_{U^\prime} \underbrace{f^{(n+1)}(t)}_{V}\, dt & = \left [ UV \right ]_{x_0}^x -  \int_{t=x} UV^\prime\, dt \\ & = \left [ -\frac{(x-t)^{n+1}}{n+1}\ f^{(n+1)}(t) \right ]_{t=x_0}^{t=x} + \underbrace{\int_{x_0}^{x} \frac{(x-t)^{n+1}}{n+1}f^{(n+2)}(t)\, dt}_{W} \\ & = \cancelto{o}{-\frac{(x-x)^{n+1}}{n+1}\ f^{(n+1)}(x)} + \frac{(x-x_0)^{n+1}}{n+1}\ f^{(n+1)}(x_0) + W\\ & = \frac{(x-x_0)^{n+1}}{n+1}\ f^{(n+1)}(x_0) + W\\ \end{align} $$ $$
 * $$ \displaystyle \begin{align}
 * $$ \displaystyle \begin{align}
 * <p style="text-align:right;">$$\displaystyle (Eq. 5)
 * }
 * }

Use Eq 5, (4)& (5) in [[media:egm6341.s10.p2-2.png|Lecture p.2-2]], we have:
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \Rightarrow \ f(x) = \underbrace{f(x_0) + \frac{(x-x_0)}{1!}\ f^{(1)}(x_0) + \cdots + \frac{(x-x_0)^{n+1}}{n+1}\ f^{(n+1)}(x_0)}_{P_{n+1}(x)} + \underbrace{\frac{1}{(n+1)!}\int_{x_0}^{x} (x-t)^{n+1}f^{(n+2)}(t)\, dt}_{R_{n+2}(x)} $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |


 * }

--Min Zhong 03:20, 21 February 2010 (UTC) = Expressing a function $$ f(.)$$ using Taylor Series = Ref: Lecture Notes [[media:Egm6341.s10.mtg6.pdf|p.6-1]]

Problem Statement
$$ f(x)=sin x, x \in [0,\pi] $$ (i)Construct a Taylor series of $$f(x)$$ around $$x_0 = \frac{\pi}{4}$$ for $$\displaystyle n=0,1,2......,10.$$ (ii)Plot the series for each $$\displaystyle n $$ (iii)Estimate the maximum $$\displaystyle R(x)$$ at $$ x=\frac{\pi}{2}$$

Solution
(i) $$\displaystyle n^{th}$$ order polynomial is given by, $$\displaystyle P_n(x) = f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + ........+ \frac{(x-x_0)^n}{n!}f^n(x_0) $$

(a)$$\displaystyle P_n(x)$$ for $$\displaystyle n=0 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$


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


 * $$ \displaystyle P_0(x)= f(x_0) $$
 * }
 * }
 * }


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

$$\displaystyle P_0(x) = sin (\frac{\pi}{4}) = \frac{1}{\sqrt{2}}$$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(b)$$\displaystyle P_n(x)$$ for $$\displaystyle n=1 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_1(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) $$
 * }
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_1(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!}\Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(c)$$\displaystyle P_n(x)$$ for $$\displaystyle n=2 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_2(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) $$
 * }
 * }
 * }


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

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


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

$$ \displaystyle P_2(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!}\Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(d)$$\displaystyle P_n(x)$$ for $$\displaystyle n=3 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_3(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0)$$
 * }
 * }
 * }


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

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


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

$$ \displaystyle P_3(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} \Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(e)$$\displaystyle P_n(x)$$ for $$\displaystyle n=4 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_4(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) $$
 * }
 * }
 * }


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

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


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

$$ \displaystyle P_4(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} \Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(f)$$\displaystyle P_n(x)$$ for $$\displaystyle n=5 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_5(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0)$$
 * }
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^2}{2!} sin(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^3}{3!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^4}{4!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^5}{5!} cos(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_5(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} \Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(g)$$\displaystyle P_n(x)$$ for $$\displaystyle n=6 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"


 * $$ \displaystyle P_6(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0)$$
 * }
 * }
 * }


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

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


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

$$ \displaystyle P_6(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} - \frac{(x-\frac{\pi}{4})^6}{6!} \Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(h)$$\displaystyle P_n(x)$$ for $$\displaystyle n=7 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"

$$ \displaystyle + \frac{(x-x_0)^7}{7!} f^7(x_0)$$
 * $$ \displaystyle P_7(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * $$ \displaystyle P_7(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^2}{2!} sin(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^3}{3!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^4}{4!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^5}{5!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^6}{6!} sin(\frac{\pi}{4})$$ $$\displaystyle -\frac{(x-\frac{\pi}{4})^7}{7!} cos(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_7(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} - \frac{(x-\frac{\pi}{4})^6}{6!} - \frac{(x-\frac{\pi}{4})^7}{7!}\Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(i)$$\displaystyle P_n(x)$$ for $$\displaystyle n=8 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"

$$ \displaystyle + \frac{(x-x_0)^7}{7!} f^7(x_0) + \frac{(x-x_0)^8}{8!} f^8(x_0)$$
 * $$ \displaystyle P_8(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * $$ \displaystyle P_8(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^2}{2!} sin(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^3}{3!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^4}{4!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^5}{5!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^6}{6!} sin(\frac{\pi}{4})$$ $$\displaystyle -\frac{(x-\frac{\pi}{4})^7}{7!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^8}{8!} sin(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_8(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} - \frac{(x-\frac{\pi}{4})^6}{6!} - \frac{(x-\frac{\pi}{4})^7}{7!} + \frac{(x-\frac{\pi}{4})^8}{8!}\Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(j)$$\displaystyle P_n(x)$$ for $$\displaystyle n=9 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"

$$ \displaystyle + \frac{(x-x_0)^7}{7!} f^7(x_0) + \frac{(x-x_0)^8}{8!} f^8(x_0) + \frac{(x-x_0)^9}{9!} f^9(x_0)$$
 * $$ \displaystyle P_9(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * $$ \displaystyle P_9(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^2}{2!} sin(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^3}{3!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^4}{4!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^5}{5!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^6}{6!} sin(\frac{\pi}{4})$$ $$\displaystyle -\frac{(x-\frac{\pi}{4})^7}{7!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^8}{8!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^9}{9!} cos(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_9(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} - \frac{(x-\frac{\pi}{4})^6}{6!} - \frac{(x-\frac{\pi}{4})^7}{7!} + \frac{(x-\frac{\pi}{4})^8}{8!} + \frac{(x-\frac{\pi}{4})^9}{9!} \Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(k)$$\displaystyle P_n(x)$$ for $$\displaystyle n=10 $$ and $$\displaystyle x_0 = \frac{\pi}{4}$$
 * {| style="width:100%" border="0" align="left"

$$ \displaystyle + \frac{(x-x_0)^7}{7!} f^7(x_0) + \frac{(x-x_0)^8}{8!} f^8(x_0) + \frac{(x-x_0)^9}{9!} f^9(x_0) + \frac{(x-x_0)^{10}}{10!} f^{10}(x_0)$$
 * $$ \displaystyle P_{10}(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * $$ \displaystyle P_{10}(x)= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \frac{(x-x_0)^2}{2!} f^2(x_0) + \frac{(x-x_0)^3}{3!} f^3(x_0) +  \frac{(x-x_0)^4}{4!} f^4(x_0) + \frac{(x-x_0)^5}{5!} f^5(x_0) + \frac{(x-x_0)^6}{6!} f^6(x_0) $$
 * }
 * }


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

$$ \displaystyle = sin (\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})}{1!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^2}{2!} sin(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^3}{3!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^4}{4!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^5}{5!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^6}{6!} sin(\frac{\pi}{4})$$ $$\displaystyle -\frac{(x-\frac{\pi}{4})^7}{7!} cos(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^8}{8!} sin(\frac{\pi}{4}) + \frac{(x-\frac{\pi}{4})^9}{9!} cos(\frac{\pi}{4}) - \frac{(x-\frac{\pi}{4})^{10}}{10!} sin(\frac{\pi}{4}) $$
 * }
 * }


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

$$ \displaystyle P_{10}(x)= \frac{1}{\sqrt{2}}\Bigg[1 + \frac{(x-\frac{\pi}{4})}{1!} - \frac{(x-\frac{\pi}{4})^2}{2!} -\frac{(x-\frac{\pi}{4})^3}{3!} + \frac{(x-\frac{\pi}{4})^4}{4!} + \frac{(x-\frac{\pi}{4})^5}{5!} - \frac{(x-\frac{\pi}{4})^6}{6!} - \frac{(x-\frac{\pi}{4})^7}{7!} + \frac{(x-\frac{\pi}{4})^8}{8!} + \frac{(x-\frac{\pi}{4})^9}{9!} - \frac{(x-\frac{\pi}{4})^{10}}{10!}\Bigg] $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(ii) MATLAB Code for generating the plots for :     $$ \displaystyle n=0,1......,10 $$

Plot: $$\displaystyle f(x)=sin(x)$$ for $$\displaystyle n = 0, 1, 2, 3, 4 and 5$$

$$\displaystyle f(x)=sin(x)$$ for $$\displaystyle n = 6, 7, 8, 9 and 10$$



(iii)Error Estimation $$\displaystyle R_{n+1}(x) = \frac{(x-x_0)^{n+1}}{(n+1)!} f^{n+1}(\xi)$$ $$\displaystyle max R_{n+1}(x) = \frac{(x-x_0)^{n+1}}{(n+1)!} max \bigg| f^{n+1}(\xi)\bigg|$$

Since $$\displaystyle f(x) = sin (x)$$  $$\displaystyle max \bigg| f^{n+1}(\xi)\bigg| = 1  $$ for all $$\displaystyle n $$

(a)$$\displaystyle R_{n+1}(x)$$ for $$\displaystyle n=0 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{n+1}(x)_{max}= \frac{x-x_0}{1!} $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{\frac{\pi}{2}-\frac{\pi}{4}}{1!} $$
 * }
 * }


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

$$\displaystyle R_1(x)_{max} = 0.6168 $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(b)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=1 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{2}(x)_{max}= \frac{(x-x_0)^2}{2!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^2}{2!} $$
 * }
 * }


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

$$\displaystyle R_2(x)_{max} = 0.3084 $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(c)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=2 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{3}(x)_{max}= \frac{(x-x_0)^3}{3!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^3}{3!} $$
 * }
 * }


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

$$\displaystyle R_3(x)_{max} = 0.0807 $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(d)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=3 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{4}(x)_{max}= \frac{(x-x_0)^4}{4!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^4}{4!} $$
 * }
 * }


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

$$\displaystyle R_4(x)_{max} = 0.0158 $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(e)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=4 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{5}(x)_{max}= \frac{(x-x_0)^5}{5!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^5}{5!} $$
 * }
 * }


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

$$\displaystyle R_5(x)_{max} = 2.4903 * 10^{-3} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(f)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=5 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{6}(x)_{max}= \frac{(x-x_0)^6}{6!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^6}{6!} $$
 * }
 * }


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

$$\displaystyle R_6(x)_{max} = 3.2599 * 10^{-4}$$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(g)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=6 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{7}(x)_{max}= \frac{(x-x_0)^7}{7!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^7}{7!} $$
 * }
 * }


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

$$\displaystyle R_7(x)_{max} = 3.6576 * 10^{-5} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(h)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=7 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{8}(x)_{max}= \frac{(x-x_0)^8}{8!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^8}{8!} $$
 * }
 * }


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

$$\displaystyle R_8(x)_{max} = 3.5908 * 10^{-6} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(i)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=8 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{9}(x)_{max}= \frac{(x-x_0)^9}{9!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^9}{9!} $$
 * }
 * }


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

$$\displaystyle R_9(x)_{max} = 3.1336 * 10^{-7}$$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(j)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=9 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{10}(x)_{max}= \frac{(x-x_0)^{10}}{10!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^{10}}{10!} $$
 * }
 * }


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

$$\displaystyle R_{10}(x)_{max} = 2.4611 * 10^{-8} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

(k)$$\displaystyle R_{n+1}(x)_{max}$$ for $$\displaystyle n=10 $$ ,$$\displaystyle x_0 = \frac{\pi}{4} $$ and $$\displaystyle x = \frac{\pi}{2} $$


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


 * $$ \displaystyle R_{11}(x)_{max}= \frac{(x-x_0)^{11}}{11!}  $$
 * }
 * }
 * }


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

$$ \displaystyle = \frac{(\frac{\pi}{2}-\frac{\pi}{4})^{11}}{11!} $$
 * }
 * }


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

$$\displaystyle R_{11}(x)_{max} = 1.7572 * 10^{-9} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }
 * }

Subramanian Annamalai 21:45, 20 February 2010 (UTC)

= Taylor, Trapezoidal and Simpson Rule =

Ref: Lecture Notes [[media:Egm6341.s10.mtg6.pdf|p.6-5]]

Problem Statement
$$ I=\int_{0}^{1}\frac{e^{x}-1}{x}dx $$ Use (i) Taylor series expansion fn (ii) Composite Trapezoidal rule (iii) Composite Simpson rule to find $$\displaystyle I_n $$ for n=2,4,8.......... until error is of order $$\displaystyle 10^{-6} $$

Solution
(i)Taylor series expansion The approximate value of the integral in Taylor series is given by, $$\displaystyle \sum_{j=1}^{n}\frac{1}{j! \cdot j}$$

The error range in Taylor series is calculated by, $$ \frac{1}{(n+1)!\cdot (n+1)}\leq I-I_{n}\leq \frac{e}{(n+1)!\cdot(n+1))}$$

a) $$I_{n}$$ for n=2, $$ I_{2}=\left ( \frac{1}{(1!\cdot 1)}+\frac{1}{(2!\cdot 2)} \right )=1.25 $$ a-1) Error for n=2, $$ \frac{1}{(2+1)!\cdot (2+1)}\leq I-I_{2}\leq \frac{e}{(2+1)!\cdot(2+1))}=0.055556\leq I-I_{2}\leq0.151016 $$

b) $$I_{n}$$ for n=4, $$ I_{4}=\left ( \frac{1}{(1!\cdot 1)}+\frac{1}{(2!\cdot 2)}+\frac{1}{(3!\cdot 3)}+\frac{1}{(4!\cdot 4)} \right )=1.3159722222223\approx 1.31597 $$ b-1) Error for n=4, $$\frac{1}{(4+1)!\cdot (4+1)}\leq I-I_{4}\leq \frac{e}{(4+1)!\cdot(4+1))}=0.001667\leq I-I_{4}\leq0.00453$$

c)$$I_{n}$$ for n=8, $$ I_{8}=\left ( \frac{1}{(1!\cdot 1)}+\frac{1}{(2!\cdot 2)}+\frac{1}{(3!\cdot 3)}+\frac{1}{(4!\cdot 4)}+\frac{1}{(5!\cdot 5)}+\frac{1}{(6!\cdot 6)}+\frac{1}{(7!\cdot 7)}+\frac{1}{(8!\cdot 8)}  \right )=1.3179018152401 \approx 1.3179 $$ c-1) Error for n=8, $$ \frac{1}{(8+1)!\cdot (8+1)}\leq I-I_{8}\leq \frac{e}{(8+1)!\cdot(8+1))}=3.06192\times 10^{-7}\leq I-I_{8}\leq8.32317\times 10^{-7} $$

$$\therefore I_n = 1.3179$$ Thus n=8 brings the error down to the order of $$10^{-6}$$

(ii) Composite Trapezoidal rule or the Corrected Trapezoidal rule It is hard to define the true value of I. Thus, MATLAB codes were used to generate the true value of I.

MATLAB Code to find the true value of I

True value of I = 1.317902151956861

a) The Composite Trapezoidal rule is given by $$ \int_{a}^{b}f(x)dx=\frac{b-a}{2n}*[f(x_{0})+2f(x_{1})+2f(x_{2})+.........+2f(x_{n-1})+f(x_{n})] $$

b) The Corrected Trapezoidal rule is given by $$ \int_{a}^{b}f(x)dx=\frac{b-a}{2n}*[f(x_{0})+2f(x_{1})+2f(x_{2})+.........+2f(x_{n-1})+f(x_{n})]-\frac{h^2}{12}*[f^{'}(b)-f^{'}(a)] $$

where <li> $$ h=\frac{(b-a)}{n} $$

c) MATLAB Code for n=2

d) Results of Composite Trapezoidal rule

where $$\therefore I_{n} = 1.317904695 $$ <li>En = The true value of I (=1.317902152) - In= -2.54263*10-6

Thus, the value of n=128 brings the error down to the order of 10-6 order.

(iii) Composite Simpson rule It is also hard to find the true value of I. Thus, MATLAB codes were used

a) The Composite Simpson rule is given by $$ \int_{a}^{b}f(x)dx=\frac{b-a}{3n}*[f(x_{0})+4f(x_{1})+2f(x_{2})+.........+2f(x_{n-2})+4f(x_{n-1})+f(x_{n})] $$

b) MATLAB Code - Simpson's Rule

c) MATLAB Code for n=2

d) Results of Composite Simpson rule

where $$\therefore I_{n} = 1.317908917 $$ <li>En = The true value of I (=1.317902152) - In= -6.76473*10-6 Thus, the value of n=4 brings the error down to the order of 10-6 order.

--Heejun Chung 03:21, 21 February 2010 (UTC)

= Taylor Series Expansion - $$ f(x) = \frac{e^{x}-1}{x}=\frac{1}{x}\left[e^{x}-1\right] $$  with remainder = Ref: Lecture notes [[media:Egm6341.s10.mtg7.pdf|p.7-1]]

Problem Statement

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

f(x) = \frac{e^{x}-1}{x}=\frac{1}{x}\left[e^{x}-1\right] $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

(i)Expand $$\displaystyle e^{x} $$ in Taylor series with remainder,
 * {| style="width:100%" border="0" align="left"

R(x) = \frac{(x-0)^{n+1}}{(n+1)!}e^{\xi(x)}. $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

(ii) Find Taylor series expansion and remainder of $$\displaystyle f(x) $$ to get (4) [[media:Egm6341.s10.mtg6.pdf|p.6-3]],
 * {| style="width:100%" border="0" align="left"

f(x)-f_{n}(x)=R_{n}(x)=\frac{(x-0)^{n}}{(n+1)!}e^{\xi(x)},\quad \xi\in[0,x]. $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

Solution
First, remember the Taylor series expansion for a function $$\displaystyle f(x) $$ around $$\displaystyle x=x_{0} $$:
 * {| style="width:100%" border="0" align="left"

f(x)=P_{n}(x)+R_{n+1}(x), $$ $$ where
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 1)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

P_{n}(x)=f(x_{0})+\frac{(x-x_{0})}{1!}f^{(1)}(x_{0})+\cdots+\frac{(x-x_{0})^{n}}{n!}f^{(n)}(x_{0}) $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 2)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

R_{n+1}(x)=\frac{1}{n!}\int_{x_{0}}^{x}(x-t)^{n}f^{(n+1)}(t)dt=\frac{(x-x_{0})^{n+1}}{(n+1)!}f^{(n+1)}(\xi), \quad \xi\in[x_{0},x] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 3)
 * }
 * }

 (i) Expand $$\displaystyle f(x)=e^{x} $$ in Taylor series around $$\displaystyle x=x_{0}=0 $$. Recall that $$\displaystyle \frac{d^{n}}{dx^{n}}\left(e^{x}\right)=e^{x}, \quad n=1, 2, \cdots. $$
 * {| style="width:100%" border="0" align="left"

P_{n}(x)=e^{0}+\frac{(x-0)}{1!}e^{0}+\frac{(x-0)^{2}}{2!}e^{0}+\cdots+\frac{(x-0)^{n}}{n!}e^{0} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

\Rightarrow P_{n}(x)=1+\frac{x}{1!}+\frac{x^{2}}{2!}+\cdots+\frac{x^{n}}{n!}=\sum_{j=0}^{n}\frac{x^{j}}{j!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

R_{n+1}(x)=\frac{(x-0)^{n+1}}{(n+1)!}e^{\xi}=\frac{x^{n+1}}{(n+1)!}e^{\xi} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 5)
 * }
 * }

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

$$\displaystyle e^{x}=P_{n}(x)+R_{n+1}(x)=\sum_{j=0}^{n}\frac{x^{j}}{j!}+\underbrace{\frac{x^{n+1}}{(n+1)!}e^{\xi}}_{remainder} $$ $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * <p style="text-align:right;">$$\displaystyle (Eq. 6)
 * }
 * }

 (ii) Expand $$\displaystyle f(x)=\frac{e^{x}-1}{x}=\frac{1}{x}\left[e^{x}-1\right] $$ in Taylor series using Eq.6.
 * {| style="width:100%" border="0" align="left"

\frac{1}{x}\left[e^{x}-1\right]=\frac{1}{x}\left[\cancelto{0}{1}+\frac{x}{1!}+\frac{x^2}{2!}+\cdots+\frac{x^n}{n!}+\frac{x^{n+1}}{(n+1)!}e^{\xi}\cancelto{0}{-1}\right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 7)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

\Rightarrow\frac{1}{x}\left[e^{x}-1\right]=\frac{1}{x}\left[\sum_{j=1}^{n}\frac{x^{j}}{j!}+\frac{x^{n+1}}{(n+1)!}e^{\xi}\right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 8)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

\Rightarrow\frac{1}{x}\left[e^{x}-1\right]=\frac{1}{x}\sum_{j=1}^{n}\frac{x^{j}}{j!}+\frac{1}{x}\frac{x^{n+1}}{(n+1)!}e^{\xi} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 9)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

\Rightarrow\frac{1}{x}\left[e^{x}-1\right]=\sum_{j=1}^{n}\frac{x^{j-1}}{j!}+\frac{x^n}{(n+1)!}e^{\xi} $$ $$ Therefore,
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

f(x)=\underbrace{\sum_{j=1}^{n}\frac{x^{j-1}}{j!}}_{f_{n}(x)=P_{n-1}(x)}+\underbrace{\frac{x^n}{(n+1)!}e^{\xi}}_{R_{n}(x)} $$ $$ Let's move the first term on RHS of Eq.11 to LHS. Then,
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 11)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle f(x)-f_{n}(x)=R_{n}(x)=\frac{x^{n}}{(n+1)!}e^{\xi} $$ $$ As Eq.12 shows, our final result is consistent with (4) [[media:Egm6341.s10.mtg6.pdf|p.6-3]] of our lecture note.
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * <p style="text-align:right;">$$\displaystyle (Eq. 12)
 * }
 * }

Yong Nam Ahn 02:51, 21 February 2010 (UTC)

= Prove Simple trapezoidal rule =

Ref. Lecture notes [[media:Egm6341.s10.mtg8.pdf|p.8-2]]

Problem Statement
Use (2) in Slide [[media:Egm6341.s10.mtg8.pdf|8-2]] to obtain Simple trapezoidal rule.

Solution
Given

$$I_1 =\Big[\int_a^b l_{\text{o}} (x)dx\Big] f(x_{\text{o}})$$ + $$\Big[\int_a^b l_1 (x)dx\Big] f(x_1)$$

where

$$l_{\text{o}}(x) = \frac{x - x_1} {(x_{\text{o}} - x_1)}$$,

$$l_1 (x) = \frac {x - x_{\text{o}}} {(x_1 - x_{\text{o}})}$$,

$$ x_{\text{o}} = a $$

$$ x_1 = b $$

Now $$  I_1 = \Bigg[\int_a^b \frac{x - x_1} {x_{\text{o}} - x_1} dx\Bigg] f(x_{\text{o}})$$ + $$\Bigg[\int_a^b \frac{x - x_{\text{o}}} {x_1 - x_{\text{o}}} dx\Bigg]  f(x_1)$$

= $$\Bigg[\frac{x^2 /2 - bx} {a - b}\Bigg]_a^b  f(a) + \Bigg[\frac{x^2 /2 - ax} {b - a}\Bigg]_a^b  f(b)$$

= $$\Bigg[\frac{(\frac{b^2}{2} - b^2)- (\frac{a^2} {2} - ab)} {(a - b)}\Bigg] f(a) + \Bigg[\frac{(\frac{b^2}{2} - ab)- (a^2 /2 - a^2)} {(b - a)}\Bigg] f(b)$$

= $$\Bigg[\frac{(b-a)^2}{2(b - a)}\Bigg] f(a)+ \Bigg[\frac{(b-a)^2}{2(b - a)}\Bigg] f(b)$$

= $$\Bigg[\frac{(b-a)}{2}\Bigg] (f(a) + f(b))$$

which is same as equation (1) Slide [[media:Egm6341.s10.mtg7.pdf|p.7-1]]

This completes the Proof of simple trapezoidal rule

Abhishekksingh 20:49, 21 February 2010 (UTC)

= Expansion of Lagrange functions =

Ref: Lecture notes [[media:Egm6341.s10.mtg8.pdf|p.8-3]]

Problem Statement
Expand(4) from Slide [[media:Egm6341.s10.mtg8.pdf|8-3]] to obtain $$P_2 (x_j)= \sum_{i=0}^2 l_i(x_j) f(x_i) = f(x_j)$$

Solution
$$P_2 (x_j)= \sum_{i=0}^2 l_i(x_j) f(x_i)= l_{\text{o}}(x_j)f(x_{\text{o}})+ l_1(x_j)f(x_1)+ l_2 (x_j)f(x_2)$$

where  $$ j = 0 ,1 ,2 $$

but when $$ i=j $$ $$ l_i(x_j) = 1 $$

and when i$$ \ne  $$j $$ l_i(x_j) = 0 $$

then only surviving terms are given by


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


 * $$\displaystyle P_2 (x_j)= l_{\text{o}}(x_{\text{o}}) f(x_{\text{o}}) + l_1 (x_1)  f(x_1)+ l_2 (x_2)  f(x_2) = f(x_{\text{o}}) + f(x_1) + f(x_2)=f (x_j) $$
 * }

Abhishekksingh 20:49, 21 February 2010 (UTC)

= Contributing Team Members =

1.Subramanian Annamalai 21:47, 20 February 2010 (UTC) Authored:1 and 7 Proof read:2 and 9 2. Yong Nam Ahn 02:53, 21 February 2010 (UTC) Authored: 2 and 9 Proof read: 4 and 8 3. Heejun Chung 03:23, 21 February 2010 (UTC) Authored: 4 and 8 Proof read: 1 and 7 4. Abhishekksingh 20:52, 21 February 2010 (UTC) Authored: 3,10 and 11 Proof read: 5 and 6 5. Min Zhong 21:56, 21 February 2010 (UTC) Authored: 5 and 6 Proof read: 3,10 and 11

=References= 1. Introduction to Numerical Methods,2nd Edition by Kendall E Atkinson Second Edition 2. Numerical Methods for Engineers,5th Edition by Steven C Chapra and Raymond P Canale