User:EML4500.f08.JAMAMA/NM/elango

= 3.3.1 Plotting figures similar to proof of LIET =

Given
Given a function


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

$$ f(x) = \frac{exp(x)-1}{x} \quad $$ in interval $$ x \in [-1, 1] \quad $$, $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle (Eq. 3.3.1)
 * }

Find
Find by Lagrange polynomial,weights and $$ q(n+1) \quad $$ for, $$ L_2,4^L(x) \quad $$, at 5 nodes. Nodes were chosen to be equidistant $$ x_0 = -1, x_1 = \frac{-1}{2}, x_2 = \frac 0, x_3 = \frac{1}{2}, x_4 = 1 $$.

also find errors at points $$ x = 0.5 \quad $$ and $$ t = 5 \quad $$

Solution
Consider a Lagrange method on approximating exact function: $$f_n^L\left( x \right)=\,\sum_{i=0}^{n}l_{i,n}\left ( x \right)f\left ( x_i \right)$$

For given 5 nodes at $$ n = 4 \rightarrow x_{0} = -1, x_{1} = -0.5, x_{2} = 0, x_{3} = 0.5, x_{4} = 1 $$.


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

f_{4}^L=\sum_{i=0}^{4}l_{i,4}(x)f(x_{i})=l_{0,4}(x)f(x_{0})+l_{1,4}(x)f(x_{1})+l_{2,4}(x)f(x_{2})+l_{3,4}(x)f(x_{3})+l_{4,4}(x)f(x_{4}) $$ $$ where
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3.3.1.3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

l_{i,n}=\prod_{j=0,j\neq 0}^{4}\frac{x-x_{j}}{x_{i}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{0,4}=\prod_{j=0,j\neq 0}^{4}\frac{x-x_{j}}{x_{0}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{1,4}=\prod_{j=0,j\neq 1}^{4}\frac{x-x_{j}}{x_{1}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{2,4}=\prod_{j=0,j\neq 2}^{4}\frac{x-x_{j}}{x_{2}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{3,4}=\prod_{j=0,j\neq 3}^{4}\frac{x-x_{j}}{x_{3}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{4,4}=\prod_{j=0,j\neq 4}^{4}\frac{x-x_{j}}{x_{4}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

For example:


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

l_{0,4}=\prod_{j=0,j\neq 0}^{4}\frac{x-x_{j}}{x_{0}-x_{j}} = \frac{x-x_1}{x_{0}-x_{1}}\frac{x-x_{2}}{x_{0}-x_{2}}\frac{x-x_{3}}{x_{0}-x_{3}}\frac{x-x_{4}}{x_{0}-x_{4}} = \left(\frac{x-(-0.5)}{(-1)-(-0.5)} \right) \left(\frac{x-0}{(-1)-0} \right ) \left( \frac{x-0.5}{(-1)-0.5} \right) \left (\frac{x-1}{(-1)-1} \right ) $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

Therefore, plotting $$ Eq. (3.3.1.3) \quad $$ with given parameters we get:

Maple code was written to plot the graphs and is given below, and the equations used are provided.

q_{n+1}(x) := (x - x_0)(x - x_1)(x - x_2)(x - x_3)\cdots(x - x_n) $$ $$
 * $$\displaystyle
 * $$\displaystyle (Eq. 3.3.1.2)

Maple code was written to plot the graphs and is given below, and the equations used are provided.









$$ |e_4^L(t)| = 0.0046570,|e_4^L(x)| = 0.3955996 \quad $$

= 3.3.2 Runge-Phenomenon =

Given
Given a function


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

$$ f(x) = \frac{1}{1+4x^2}\quad $$ in interval $$ x \in [-5,5] \quad $$, $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle (Eq. 3.3.2)
 * }

Find
Find the error estimate for the function given above and plot, $$ L_3,8^L(x) \quad $$, for n=8. Nodes were chosen to be equidistant $$ a = -5,b = 5 \quad$$.

Solution
When n = 8 $$ \rightarrow x_{0} = -5, x_{1} = -3.75, x_{2} = -2.5, x_{3} = -1.25, x_{4} = 0, x_{5} = 1.25, x_{6} = 2.5, x_{7} = 3.75, x_{8} = 5 $$.


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


 * $$\displaystyle
 * $$\displaystyle

f_{8}=\sum_{i=0}^{8}l_{i,8}(x)f(x_{i})=l_{0,8}(x)f(x_{0})+l_{1,8}(x)f(x_{1})+l_{2,8}(x)f(x_{2})+l_{3,8}(x)f(x_{3})+l_{4,8}(x)f(x_{4})+l_{5,8}(x)f(x_{5})+l_{6,8}(x)f(x_{6})+l_{7,8}(x)f(x_{7})+l_{8,8}(x)f(x_{8}) $$ $$
 * $$\displaystyle (Eq.3.3.2.1)
 * }
 * }

where,


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

l_{3,8}=\prod_{j=0,j\neq 3}^{8}\frac{x-x_{j}}{x_{3}-x_{j}} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

Maple code was written to solve for the error estimates and to plot the req function



$$ |e_8^L(t)| = 0.001415387826,|e_8^L(x)| = -0.2033016134e-3 \quad $$

Ref

 * }

Given that, $$ i=1 \,$$

$$ \frac{c_{1}}{3!}+c_{3}=0\, $$

$$ p_{1}(t)=-t,i.e.,c_{1}=-1 \, $$

$$ \Rightarrow c_{3}=\frac{1}{6}\, $$

when $$ i=2 \,$$

$$ \frac{c_{1}}{5!}+\frac{c_{3}}{3!}+c_{5}=0\, $$

$$ c_{3}=\frac{1}{6}\, $$

$$ \Rightarrow c_{5}=-\frac{7}{360}\, $$

when $$ i=3 \,$$

$$ \frac{c_{1}}{7!}+\frac{c_{3}}{5!}+\frac{c_{5}}{3!}+c_{7}=0\, $$

$$ c_{5}=-\frac{7}{360}\, $$

$$ \Rightarrow c_{7}=\frac{31}{15120}\, $$

when $$ i=4 \,$$

$$ \frac{c_{1}}{9!}+\frac{c_{3}}{7!}+\frac{c_{5}}{5!}+\frac{c_{7}}{3!}+c_{9}=0\, $$

substitute the values and solve for c_{9} ,

$$ \Rightarrow c_{9}=-\frac{127}{604800}\, $$

Now we calculate the pair polynomials using the expressions given below for odd and even terms, and then the constants are substituted in them ,

$$ p_{2i}(t)=\sum_{j=0}^{i}c_{2j+1}\frac{t^{2(i-j)}}{[2(i-j)]!}\, $$

$$ p_{2i+1}(t)=\sum_{j=0}^{i}c_{2j+1}\frac{t^{2(i-j)+1}}{[2(i-j)+1]!}+c_{2i+2}\, $$

The expressions are generated as follows,

Now we get the final Pair Polynomials ,by just substituting the constants in the maple generated equations and the pairs are listed below :


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


 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * $$ \displaystyle
 * $$ \displaystyle

p_{2}=-\frac{t^{2}}{2}+\frac{1}{6},

p_{3}=-\frac{t^{3}}{6}+\frac{1t}{6}\,$$ $$
 * $$\displaystyle
 * }
 * }


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


 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * $$ \displaystyle
 * $$ \displaystyle

p_{4}=-\frac{t^{4}}{24}+\frac{t^{2}}{12}-\frac{7}{360},

p_{5}=-\frac{t^{5}}{120}+\frac{t^{3}}{36}-\frac{7t}{360}\,$$ $$
 * $$\displaystyle
 * }
 * }


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


 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * $$ \displaystyle
 * $$ \displaystyle

p_{6}=-\frac{t^{6}}{720}+\frac{t^{4}}{144}-\frac{7t^{2}}{720}+\frac{31}{15120},

p_{7}=-\frac{t^{7}}{5040}+\frac{t^{5}}{720}-\frac{7t^{3}}{2160}+\frac{31t}{15120}\,$$ $$
 * $$\displaystyle
 * }
 * }


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


 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * $$ \displaystyle
 * $$ \displaystyle

p_{8}=-\frac{t^{8}}{40320}+\frac{t^{6}}{4320}-\frac{7t^{4}}{8640}+\frac{31t^{2}}{30240}-\frac{127}{604800},

p_{9}=-\frac{t^{9}}{362880}+\frac{t^{7}}{30240}-\frac{7t^{5}}{43200}+\frac{31t^{3}}{90720}-\frac{127t}{604800}\,$$ $$
 * $$\displaystyle
 * }
 * }