University of Florida/Egm6341/s10.team2.niki/HW2

Statement
Using the following equations find the expressions for $$\boldsymbol{c_i}$$ in terms of $$\boldsymbol{x_i}$$ and  $$\boldsymbol{f(x_i)}$$ where i=0,1,2


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

$$  \displaystyle \boldsymbol{f_2(x)=p_2(x)=c_2 x^2+c_1 x+c_0} $$     (1 p8-3)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }
 * {| style="width:100%" border="0"

$$  \displaystyle \boldsymbol{p_2(x)=\sum_{i=0}^{2}(l_i(x)f(x_i))} $$     (3 p8-3)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Solution
We have the general formula for the Lagrange basis function $$\boldsymbol{l_i(x)}$$ as


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

$$  \displaystyle \boldsymbol{l_i(x)=\prod_{j=0;j\neq i}^{n} \left (\frac{x-x_j}{x_i-x_j} \right )} $$     (2 p7-3) for the case of Simple Simpson's Rule, n =2 i.e i=0,1,2. For the given interval $$[a,b]$$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

$$\boldsymbol{x_0=a}$$

$$\boldsymbol{x_2=b}$$

$$\boldsymbol{x_1=\frac{a+b}{2}}$$

Expanding equation 3 p8-3 we get:

$$\boldsymbol{p_2(x)=l_0(x)f(x_0)+l_1(x)f(x_1)+l_2(x)f(x_2)}$$ where,

$$\boldsymbol{l_0(x)=\left ( \frac{x-x_1}{x_0-x_1} \right )\left ( \frac{x-x_2}{x_0-x_2} \right )}$$;

$$\boldsymbol{l_1(x)=\left ( \frac{x-x_0}{x_1-x_0} \right )\left ( \frac{x-x_2}{x_1-x_2} \right )}$$;

$$\boldsymbol{l_2(x)=\left ( \frac{x-x_0}{x_2-x_0} \right )\left ( \frac{x-x_1}{x_2-x_1} \right )}$$

Thus we have the polynomial as $$\boldsymbol{p_2(x)=\left ( \frac{x^2-(x_2+x_1)x+(x_1x_2)}{(x_0-x_1)(x_0-x_2))} \right )f(x_0)+\left ( \frac{x^2-(x_2+x_0)x+(x_0x_2)}{(x_1-x_0)(x_1-x_2))} \right )f(x_1)+\left ( \frac{x^2-(x_0+x_1)x+(x_1x_0)}{(x_2-x_0)(x_2-x_1))} \right )f(x_2)}$$

Grouping coefficients of $$\boldsymbol{x^2,x^1, x^0}$$, $$\boldsymbol{p_2(x)=\left \{ \frac{f(x_0)}{(x_0-x_1)(x_0-x_2)}+\frac{f(x_1)}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)}{(x_2-x_0)(x_2-x_1)} \right \}x^2

-\left \{\frac{f(x_0)[x_2+x_1]}{(x_0-x_1)(x_0-x_2)}+ \frac{f(x_1)[x_2+x_0]}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)[x_1+x_0]}{(x_2-x_0)(x_2-x_1)} \right \}x+

\left \{ \frac{f(x_0)[x_1x_2]}{(x_0-x_1)(x_0-x_2)}+\frac{f(x_1)[x_0x_2]}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)[x_0x_1]}{(x_2-x_0)(x_2-x_1)} \right \}}$$

Comparing this equation with eqn 1p8-3 we see that


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

$$  \displaystyle \boldsymbol{c_2=\left \{ \frac{f(x_0)}{(x_0-x_1)(x_0-x_2)}+\frac{f(x_1)}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)}{(x_2-x_0)(x_2-x_1)} \right \}}
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |

$$     (1)
 * 
 * }


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

$$  \displaystyle \boldsymbol{c_1=-\left \{\frac{f(x_0)[x_2+x_1]}{(x_0-x_1)(x_0-x_2)}+ \frac{f(x_1)[x_2+x_0]}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)[x_1+x_0]}{(x_2-x_0)(x_2-x_1)} \right \}} $$     (2)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }


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

$$  \displaystyle \boldsymbol{c_0=\left \{ \frac{f(x_0)[x_1x_2]}{(x_0-x_1)(x_0-x_2)}+\frac{f(x_1)[x_0x_2]}{(x_1-x_0)(x_1-x_2)}+\frac{f(x_2)[x_0x_1]}{(x_2-x_0)(x_2-x_1)} \right \}} $$     (3)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }

Statement
For the Lagrange Interpolation Error verify the following:


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

$$  \displaystyle \boldsymbol{E^{(n+1)}(x)=f^{(n+1)}(x)-0} $$     (1)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Solution
We can write the Lagrange Interpolation error as

$$ \boldsymbol{E(x)=f(x)-f_n(x)} $$

differentiating the above expression once we get

$$\boldsymbol{E^1(x)=f^1(x)-f_n^1(x)}$$

differentiating the expression (n+1) times we get

$$\boldsymbol{E^{n+1}(x)=f^{n+1}(x)-f_n^{n+1}(x)}$$

But since $$ \boldsymbol{f_n(x)} $$ is a polynomial of degree n the (n+1)th derivative is zero


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

$$  \displaystyle \boldsymbol{E^{n+1}(x)=f^{n+1}(x)-0} $$     (1)
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }

Statement
Given the polynomial $$\boldsymbol{f_3(x)=P_3(x)=3+8x^1-2x^2+6x^3}$$ where $$\boldsymbol{x \epsilon \left [ 0,1 \right ]}$$ determine the exact integral $$\boldsymbol{I}$$ and the integral using Simpson's Rule $$\boldsymbol{I_n}$$

Case A: Determination of Exact Integral
$$\boldsymbol{I=\int_{0}^{1}(3+8x-2x^2+6x^3)dx}$$

$$\boldsymbol{I=[3x+4x^2-\frac{2}{3}x^3+\frac{3}{2}x^4]_0^1}$$

$$\boldsymbol{I=3+4-\frac{2}{3}+1.5}$$


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

$$  \displaystyle \boldsymbol{I=7.833} $$     (1)
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * 
 * }

Case B: Using Simple Simpson's rule
We have the Simple Simpson's rule as
 * {| style="width:100%" border="0"

$$  \displaystyle \boldsymbol{I_2=\frac{h}{3}\left \{ f(x_0)+4f(x_1)+f(x_2) \right \}} $$     (2 p7-2) where $$\boldsymbol{h=\frac{a+b}{2}=\frac{0+1}{2}=0.5}$$
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * style="width:92%; padding:10px; border:2px solid #8888aa" |
 * 
 * }

$$\boldsymbol{I_2=\frac{0.5}{3}\left \{ f(0)+4f(0.5)+f(1) \right \}}$$ we know $$\boldsymbol{f(0)=3;f(0.5)=7.25;f(1)=15}$$ substituting we get

$$\boldsymbol{I_2=\frac{0.5}{3}\left \{ 3+4(7.25)+15 \right \}=\frac{0.5}{3}\left \{ 47 \right \}}$$


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

$$  \displaystyle \boldsymbol{I_2=7.833} $$     (2)
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * 
 * }