# University of Florida/Egm6341/s10.Team2/HW2

## Problem-1: Expressions for co-efficients of second degree Newton-Cotes integration polynomial

P. 9-1 of Lecture 9 Notes

### Problem Statement

Using the following equations find the expressions for ${\displaystyle {\boldsymbol {c_{i}}}}$ in terms of ${\displaystyle {\boldsymbol {x_{i}}}}$ and ${\displaystyle {\boldsymbol {f(x_{i})}}}$ where i=0,1,2′′

 ${\displaystyle \displaystyle {\boldsymbol {f_{2}(x)=p_{2}(x)=c_{2}x^{2}+c_{1}x+c_{0}}}}$ (1 p8-3)
 ${\displaystyle \displaystyle {\boldsymbol {p_{2}(x)=\sum _{i=0}^{2}(l_{i}(x)f(x_{i}))}}}$ (3 p8-3)

### Solution

We have the general formula for the Lagrange basis function ${\displaystyle {\boldsymbol {l_{i}(x)}}}$ as

 ${\displaystyle \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 ${\displaystyle [a,b]}$

${\displaystyle {\boldsymbol {x_{0}=a}}}$

${\displaystyle {\boldsymbol {x_{2}=b}}}$

${\displaystyle {\boldsymbol {x_{1}={\frac {a+b}{2}}}}}$

Expanding equation 3 p8-3 we get:

${\displaystyle {\boldsymbol {p_{2}(x)=l_{0}(x)f(x_{0})+l_{1}(x)f(x_{1})+l_{2}(x)f(x_{2})}}}$ where,

${\displaystyle {\boldsymbol {l_{0}(x)=\left({\frac {x-x_{1}}{x_{0}-x_{1}}}\right)\left({\frac {x-x_{2}}{x_{0}-x_{2}}}\right)}}}$;

${\displaystyle {\boldsymbol {l_{1}(x)=\left({\frac {x-x_{0}}{x_{1}-x_{0}}}\right)\left({\frac {x-x_{2}}{x_{1}-x_{2}}}\right)}}}$;

${\displaystyle {\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 ${\displaystyle {\boldsymbol {p_{2}(x)=\left({\frac {x^{2}-(x_{2}+x_{1})x+(x_{1}x_{2})}{(x_{0}-x_{1})(x_{0}-x_{2})}}\right)f(x_{0})+\left({\frac {x^{2}-(x_{2}+x_{0})x+(x_{0}x_{2})}{(x_{1}-x_{0})(x_{1}-x_{2})}}\right)f(x_{1})+\left({\frac {x^{2}-(x_{0}+x_{1})x+(x_{1}x_{0})}{(x_{2}-x_{0})(x_{2}-x_{1})}}\right)f(x_{2})}}}$

Grouping coefficients of ${\displaystyle {\boldsymbol {x^{2},x^{1},x^{0}}}}$, ${\displaystyle {\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_{1}x_{2}]}{(x_{0}-x_{1})(x_{0}-x_{2})}}+{\frac {f(x_{1})[x_{0}x_{2}]}{(x_{1}-x_{0})(x_{1}-x_{2})}}+{\frac {f(x_{2})[x_{0}x_{1}]}{(x_{2}-x_{0})(x_{2}-x_{1})}}\right\}}}}$

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

 ${\displaystyle \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\}}}}$ (1)
 ${\displaystyle \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)
 ${\displaystyle \displaystyle {\boldsymbol {c_{0}=\left\{{\frac {f(x_{0})[x_{1}x_{2}]}{(x_{0}-x_{1})(x_{0}-x_{2})}}+{\frac {f(x_{1})[x_{0}x_{2}]}{(x_{1}-x_{0})(x_{1}-x_{2})}}+{\frac {f(x_{2})[x_{0}x_{1}]}{(x_{2}-x_{0})(x_{2}-x_{1})}}\right\}}}}$ (3)

Inference: This solution essentially shows the equivalence of the two methods for the Simpson's rule i.e. cubic polynomial and using Lagrange basis functions.

Solution for problem 1:Egm6341.s10.team2.niki 00:18, 8 February 2010 (UTC)

## Problem-2: Application of Newton-Cotes method to derive the simple Simpson's rule

P. 9-1 of Lecture 9 Notes

### Problem Statement

Derive the simple Simpson's rule using Eq.(4) on slide 8-3 Lecture-8 notes i.e. the second degree polynomial of Newton-Cotes method: ${\displaystyle P_{2}\left(x\right)=\sum _{i=0}^{2}l_{i}\left(x\right)f\left(x_{i}\right)}$

### Solution

 ${\displaystyle I_{2}\left(f\right)}$ ${\displaystyle =\int _{x_{0}}^{x_{2}}f_{2}\left(x\right).dx=\int _{x_{0}}^{x_{2}}P_{2}\left(x\right).dx}$ ${\displaystyle =\int _{x_{0}}^{x_{2}}\sum _{i=0}^{2}l_{i}\left(x\right)\cdot f\left(x_{i}\right)\cdot dx}$ ${\displaystyle =\int _{x_{0}}^{x_{2}}\left[l_{0}\left(x\right)\cdot f\left(x_{0}\right)+l_{1}\left(x\right)\cdot f\left(x_{1}\right)+l_{2}\left(x\right)\cdot f\left(x_{2}\right)\right]\cdot dx}$

But we know that ${\displaystyle l_{i}\left(x\right)=\prod _{j=0\;\;j\neq i}^{j=2}{\frac {x-x_{j}}{x_{i}-x_{j}}}}$

So we get the values of ${\displaystyle l_{0}\left(x\right),l_{1}\left(x\right)}$ and ${\displaystyle l_{2}\left(x\right)}$ as follows:

${\displaystyle l_{0}\left(x\right)=\left({\frac {x-x_{1}}{x_{0}-x_{1}}}\right)\left({\frac {x-x_{2}}{x_{0}-x_{2}}}\right)}$

${\displaystyle l_{1}\left(x\right)=\left({\frac {x-x_{0}}{x_{1}-x_{0}}}\right)\left({\frac {x-x_{2}}{x_{1}-x_{2}}}\right)}$

${\displaystyle l_{2}\left(x\right)=\left({\frac {x-x_{0}}{x_{2}-x_{0}}}\right)\left({\frac {x-x_{1}}{x_{2}-x_{1}}}\right)}$

But we know that ${\displaystyle x_{1}={\frac {\left(x_{0}+x_{2}\right)}{2}}}$ or ${\displaystyle 2x_{1}=\left(x_{0}+x_{2}\right)}$

${\displaystyle \therefore l_{0}\left(x\right)={\frac {\left(2x-x_{0}-x_{2}\right)}{\left(2x_{0}-x_{0}-x_{2}\right)}}{\frac {\left(x-x_{2}\right)}{\left(x_{0}-x_{2}\right)}}={\frac {2x^{2}-\left(3x_{2}+x_{0}\right)x+\left(x_{2}^{2}+x_{2}x_{0}\right)}{\left(x_{0}-x_{2}\right)^{2}}}}$

Similarily by substituting the value of ${\displaystyle x_{1}}$ in the equations of ${\displaystyle l_{1}\left(x\right)}$ and ${\displaystyle l_{2}\left(x\right)}$, we get:

${\displaystyle l_{1}\left(x\right)={\frac {-4\left(x^{2}-\left(x_{0}+x_{2}\right)x+x_{0}x_{2}\right)}{\left(x_{0}-x_{2}\right)^{2}}}}$

${\displaystyle l_{2}\left(x\right)={\frac {\left(2x-x_{0}-x_{2}\right)}{\left(2x_{2}-x_{0}-x_{2}\right)}}{\frac {\left(x-x_{0}\right)}{\left(x_{2}-x_{0}\right)}}={\frac {2x^{2}-\left(3x_{0}+x_{2}\right)x+\left(x_{0}^{2}+x_{2}x_{0}\right)}{\left(x_{0}-x_{2}\right)^{2}}}}$

Now plugging back the values of ${\displaystyle l_{0}\left(x\right),l_{1}\left(x\right)}$ and ${\displaystyle l_{2}\left(x\right)}$ in the Equation for ${\displaystyle I_{2}\left(f\right)}$ , we get:

${\displaystyle I_{2}\left(f\right)=\int _{x_{0}}^{x_{2}}\left[\left({\frac {2x^{2}-\left(3x_{2}+x_{0}\right)x+\left(x_{2}^{2}+x_{2}x_{0}\right)}{\left(x_{0}-x_{2}\right)^{2}}}\right)\cdot f\left(x_{0}\right)+\left({\frac {-4\left(x^{2}-\left(x_{0}+x_{2}\right)x+x_{0}x_{2}\right)}{\left(x_{0}-x_{2}\right)^{2}}}\right)\cdot f\left(x_{1}\right)+\left({\frac {2x^{2}-\left(3x_{0}+x_{2}\right)x+\left(x_{0}^{2}+x_{2}x_{0}\right)}{\left(x_{0}-x_{2}\right)^{2}}}\right)\cdot f\left(x_{2}\right)\right]\cdot dx}$

Now isolating the ${\displaystyle x^{2}}$ terms, ${\displaystyle x}$ terms and constant terms, we get three consolidated terms as follows:

Term-1: ${\displaystyle x^{2}}$ -term

${\displaystyle {\frac {x^{2}}{\left(x_{0}-x_{2}\right)^{2}}}\left[2f\left(x_{0}\right)-4f\left(x_{1}\right)+2f\left(x_{2}\right)\right]}$

Integrating this term between limits ${\displaystyle x_{0}}$ and ${\displaystyle x_{2}}$, we get:

${\displaystyle {\frac {x_{2}^{3}-x_{0}^{3}}{3\left(x_{0}-x_{2}\right)^{2}}}\left[2f\left(x_{0}\right)-4f\left(x_{1}\right)+2f\left(x_{2}\right)\right]={\frac {\left(x_{2}^{2}+x_{0}^{2}+x_{2}x_{0}\right)}{3\left(x_{0}-x_{2}\right)}}\left[2f\left(x_{0}\right)-4f\left(x_{1}\right)+2f\left(x_{2}\right)\right]}$

Term-2: ${\displaystyle x}$ -term

${\displaystyle {\frac {-x}{\left(x_{0}-x_{2}\right)^{2}}}\left[\left(3x_{2}+x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}+x_{0}\right)f\left(x_{1}\right)+\left(3x_{0}+x_{2}\right)f\left(x_{2}\right)\right]}$

Integrating this term between limits ${\displaystyle x_{0}}$ and ${\displaystyle x_{2}}$, we get:

${\displaystyle {\frac {x_{2}^{2}-x_{0}^{2}}{2\left(x_{0}-x_{2}\right)^{2}}}\left[\left(3x_{2}+x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}+x_{0}\right)f\left(x_{1}\right)+\left(3x_{0}+x_{2}\right)f\left(x_{2}\right)\right]={\frac {x_{2}+x_{0}}{2\left(x_{2}-x_{0}\right)}}\left[\left(3x_{2}+x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}+x_{0}\right)f\left(x_{1}\right)+\left(3x_{0}+x_{2}\right)f\left(x_{2}\right)\right]}$

Term-3: Constant term

${\displaystyle {\frac {1}{\left(x_{0}-x_{2}\right)^{2}}}\left[\left(x_{2}^{2}+x_{2}x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}x_{0}\right)f\left(x_{1}\right)+\left(x_{0}^{2}+x_{2}x_{0}\right)f\left(x_{2}\right)\right]}$

Integrating this term between limits ${\displaystyle x_{0}}$ and ${\displaystyle x_{2}}$, we get:

${\displaystyle {\frac {x_{2}-x_{0}}{\left(x_{2}-x_{0}\right)^{2}}}\left[\left(x_{2}^{2}+x_{2}x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}x_{0}\right)f\left(x_{1}\right)+\left(x_{0}^{2}+x_{2}x_{0}\right)f\left(x_{2}\right)\right]={\frac {1}{\left(x_{2}-x_{0}\right)}}\left[\left(x_{2}^{2}+x_{2}x_{0}\right)f\left(x_{0}\right)-4\left(x_{2}x_{0}\right)f\left(x_{1}\right)+\left(x_{0}^{2}+x_{2}x_{0}\right)f\left(x_{2}\right)\right]}$

Note that ${\displaystyle I_{2}\left(f\right)=Term\;1+Term\;2+Term\;3}$

Now consolidating the coefficients of ${\displaystyle f\left(x_{0}\right),f\left(x_{1}\right)and\;f\left(x_{2}\right)}$ in all the three terms, we get:

Consolidated Coefficient of ${\displaystyle f\left(x_{0}\right)}$ as:

 ${\displaystyle ={\frac {1}{x_{2}-x_{0}}}\left[{\frac {2}{3}}x_{2}^{2}+{\frac {2}{3}}x_{0}^{2}+{\frac {2}{3}}x_{2}x_{0}-{\frac {3}{2}}x_{2}^{2}-{\frac {1}{2}}x_{2}x_{0}-{\frac {3}{2}}x_{2}x_{0}-{\frac {1}{2}}x_{0}^{2}+x_{2}^{2}+x_{2}x_{0}\right]}$ ${\displaystyle ={\frac {1}{x_{2}-x_{0}}}\left[\left(1+{\frac {2}{3}}-{\frac {3}{2}}\right)x_{2}^{2}+\left({\frac {2}{3}}-{\frac {1}{2}}\right)x_{0}^{2}+\left({\frac {2}{3}}-{\frac {1}{2}}-{\frac {3}{2}}+1\right)x_{0}x_{2}\right]}$ ${\displaystyle ={\frac {1}{6\left(x_{2}-x_{0}\right)}}\left[\left(x_{2}-x_{0}\right)^{2}\right]={\frac {\left(x_{2}-x_{0}\right)}{6}}}$

Consolidated Coefficient of ${\displaystyle f\left(x_{1}\right)}$ as:

 ${\displaystyle ={\frac {1}{x_{2}-x_{0}}}\left[{\frac {-4}{3}}x_{2}^{2}-{\frac {4}{3}}x_{0}^{2}-{\frac {4}{3}}x_{2}x_{0}+{\frac {4}{2}}x_{2}^{2}+{\frac {4}{2}}x_{0}^{2}+\left({\frac {4}{2}}\right)2x_{2}x_{0}-4x_{2}x_{0}\right]}$ ${\displaystyle ={\frac {4}{6\left(x_{2}-x_{0}\right)}}\left[\left(x_{2}-x_{0}\right)^{2}\right]={\frac {4\left(x_{2}-x_{0}\right)}{6}}}$

Consolidated Coefficient of ${\displaystyle f\left(x_{2}\right)}$ as:

 ${\displaystyle ={\frac {1}{x_{2}-x_{0}}}\left[{\frac {2}{3}}x_{2}^{2}+{\frac {2}{3}}x_{0}^{2}+{\frac {2}{3}}x_{2}x_{0}-{\frac {3}{2}}x_{2}x_{0}-{\frac {3}{2}}x_{0}^{2}-{\frac {1}{2}}x_{2}^{2}-{\frac {1}{2}}x_{2}x_{0}+x_{0}^{2}+x_{2}x_{0}\right]}$ ${\displaystyle ={\frac {1}{x_{2}-x_{0}}}\left[\left({\frac {2}{3}}-{\frac {1}{2}}\right)x_{2}^{2}+\left({\frac {2}{3}}-{\frac {3}{2}}+1\right)x_{0}^{2}+\left({\frac {2}{3}}-{\frac {1}{2}}-{\frac {3}{2}}+1\right)x_{0}x_{2}\right]}$ ${\displaystyle ={\frac {1}{6\left(x_{2}-x_{0}\right)}}\left[\left(x_{2}-x_{0}\right)^{2}\right]={\frac {\left(x_{2}-x_{0}\right)}{6}}}$

Now the value of ${\displaystyle I_{2}\left(f\right)}$ is the sum of all the consolidated coefficient multiplied by their respective ${\displaystyle f\left(x_{i}\right)}$ term. i.e.

 ${\displaystyle I_{2}\left(f\right)}$ ${\displaystyle ={\frac {\left(x_{2}-x_{0}\right)}{6}}\left[f\left(x_{0}\right)\right]+{\frac {4\left(x_{2}-x_{0}\right)}{6}}\left[f\left(x_{1}\right)\right]+{\frac {\left(x_{2}-x_{0}\right)}{6}}\left[f\left(x_{2}\right)\right]}$ ${\displaystyle ={\frac {\left(x_{2}-x_{0}\right)}{6}}\left[f\left(x_{0}\right)+4f\left(x_{1}\right)+f\left(x_{2}\right)\right]={\frac {h}{3}}\left[f\left(x_{0}\right)+4f\left(x_{1}\right)+f\left(x_{2}\right)\right]}$ ${\displaystyle \displaystyle {\boldsymbol {={\frac {h}{3}}\left[f\left(x_{0}\right)+4f\left(x_{1}\right)+f\left(x_{2}\right)\right]}}}$

Where ${\displaystyle h:={\frac {\left(x_{2}-x_{0}\right)}{2}}}$

Thus, the simple Simpson's rule is derived using the Lagrange polynomial of second degree.

Solution for problem 2: Srikanth Madala 07:04, 11 February 2010 (UTC)

## Problem-3: Study of Newton-Cotes method of numerical integration with the help of an example

#### Problem Statement

P.9-2 of Lecture 9 Notes

For the function:

${\displaystyle F(x)={\frac {\exp ^{x}-1}{x}}}$ on the interval between 0 and 1 and letting ${\displaystyle \qquad x_{0}=a\quad and\quad x_{n}=b}$

Consider: n=1,2,4,8,16.

1) Construct ${\displaystyle F_{n}(x)=\sum _{i}^{n}l_{i,n}(x)f(x_{i})}$

Plot Fn for n=1,2,4,8,16

2) Compute the integral for n=1,2,4,8 and compare to I=1.3179022

${\displaystyle \int _{a}^{b}F_{n}(x)dx}$

3) for n=4 plot:

${\displaystyle l_{0}\quad ,\quad l_{1},\quad l_{2}}$

### 1: Calculation of Function

${\displaystyle F_{n}(x)=\sum _{i}^{n}L_{i,n}(x)F(x_{i})}$

For n=1

${\displaystyle x_{0}=0\quad x_{1}=1}$

${\displaystyle \;F_{n}(x)=xf(x_{1})-xf(x_{0})+f(x_{0})}$

For n=2

${\displaystyle x_{0}=0\quad x_{1}=0.5\quad x_{2}=1}$

${\displaystyle \;F_{n}(x)=(2x^{2}-3x+1)f(x_{0})+(-4x^{2}+4x)f(x_{1})+(2x^{2}-x)f(x_{2})}$

For n=4

${\displaystyle \;x_{0}=0\quad x_{1}=0.25\quad x_{2}=0.5\quad x_{3}=0.75\quad x_{4}=1}$

${\displaystyle \;F_{n}(x)=L_{0}(x)F(x_{0})+L_{1}(x)F(x_{1})+L_{2}(x)F(x_{2})+L_{3}(x)F(x_{3})+L_{4}(x)F(x_{4})}$

${\displaystyle \;L_{0}=10.66667x^{4}-26.66667x^{3}+23.33333x^{2}-8.33333x+1}$

${\displaystyle \;L_{1}=-42.66667x^{4}+96x^{3}-69.33333x^{2}+16x}$

${\displaystyle \;L_{2}=64x^{4}-128x^{3}+76x^{2}-12x}$

${\displaystyle \;L_{3}=-42.66667x^{4}+74.66667x^{3}-37.33333x^{2}+5.33333x}$

${\displaystyle \;L_{4}=10.66667x^{4}-16x^{3}+7.33333x^{2}-x}$

For n=8

${\displaystyle \;x_{0}=0\quad x_{1}={\frac {1}{8}}\quad x_{2}={\frac {2}{8}}\quad x_{3}={\frac {3}{8}}\quad x_{4}={\frac {4}{8}}\quad x_{5}={\frac {5}{8}}\quad x_{6}={\frac {6}{8}}\quad x_{7}={\frac {7}{8}}\quad x_{8}={\frac {8}{8}}}$

${\displaystyle \;F_{n}(x)=L_{0}(x)F(x_{0})+L_{1}(x)F(x_{1})+L_{2}(x)F(x_{2})+L_{3}(x)F(x_{3})+L_{4}(x)F(x_{4})+L_{5}(x)F(x_{5})+L_{6}(x)F(x_{6})+L_{7}(x)F(x_{7})+L_{8}(x)F(x_{8})}$

${\displaystyle \;L_{0}=416.10158x^{8}-1872.45714x^{7}+3549.86667x^{6}-3686.40x^{5}+2280.53334x^{4}-854.40x^{3}+187.49841x^{2}-21.74286x+1}$

${\displaystyle \;L_{1}=-3328.81269x^{8}+14563.55555x^{7}-26578.48889x^{6}+26168.88889x^{5}-14973.15556x^{4}+4963.55556x^{3}-879.54286x^{2}+64x}$

${\displaystyle \;L_{2}=11650.84445x^{8}-49516.08889x^{7}+87017.24445x^{6}-81464.88889x^{5}+43488.71111x^{4}-13051.02222x^{3}+1987.2x^{2}-112x}$

${\displaystyle \;L_{3}=-23301.688889x^{8}+96119.46667x^{7}-162747.73333x^{6}+145408x^{5}-73181.86667x^{4}+20403.2x^{3}-2848.71111x^{2}+149.33333x}$

${\displaystyle \;L_{4}=29127.11111x^{8}-116508.44444x^{7}+190236.44444x^{6}-162929.77778x^{5}+78172.44444x^{4}-20721.77778x^{3}+2764x^{2}-140x}$

${\displaystyle \;L_{5}=-23301.68889x^{8}+90294.04444x^{7}-142358.75556x^{6}+117464.17778x^{5}-54294.75556x^{4}+13912.17778x^{3}-1804.8x^{2}+89.6x}$

${\displaystyle \;L_{6}=11650.84445x^{8}-43690.66666x^{7}+66628.26667x^{6}-53248.0x^{5}+23918.93333x^{4}-5984x^{3}+761.95556x^{2}-37.33333x}$

${\displaystyle \;L_{7}=-3328.81267x^{8}+12066.94603x^{7}-17840.35555x^{6}+13880.88889x^{5}-6098.48889x^{4}+1499.02222x^{3}-188.34286x^{2}+9.14286x}$

${\displaystyle \;L_{8}=416.10159x^{8}-1456.35556x^{7}+2093.51111x^{6}-1592.88889x^{5}+687.64444x^{4}-166.75556x^{3}+20.74285x^{2}-x}$

For n=16

${\displaystyle \;L_{0}=881657.95157x^{16}-7494092.58831x^{15}+29273799.17310x^{14}-69671642.03199x^{13}+112925052.51958x^{12}-131967887.58325x^{11}+114825387.35065x^{10}-75729669.30819x^{9}+38171908.26140x^{8}-14714527.588281x^{7}+04309632.78652x^{6}-945274.82454x^{5}+151495.79946x^{4}-17046.98375x^{3}+1260.15769x^{2}-54.09166x+1}$

${\displaystyle \;L_{1}=-14106527.22506x^{16}+119023823.46147x^{15}-460941797.80334x^{14}+1085937410.14913x^{13}-1738929752.17911x^{12}+2002803091.82081x^{11}-1712031004.37163x^{10}+1104672771.15791x^{9}-541708483.98513x^{8}+201575661.16345x^{7}-56355645.76161x^{6}+11602169.33258x^{5}-1698797.20815x^{4}+166576.91462x^{3}-9751.46595x^{2}+256x}$

${\displaystyle \;L_{2}=105798954.18798x^{16}-0886066241.32429x^{15}+3402097620.60708x^{14}-7935334841.26295x^{13}+12559089447.19286x^{12}-14266260329.09093x^{11}+11995763940.94187x^{10}-7588089824.36582x^{9}+3632117763.32303x^{8}-1311728590.17858x^{7}+353189860.61015x^{6}-69284246.36891x^{5}+9518965.13969x^{4}-855767.40852x^{3}+44247.99734x^{2}-960x}$

${\displaystyle \;L_{3}=-493728452.87722x^{16}+4104117764.54188x^{15}-15623805456.08729x^{14}+36086656014.89820x^{13}-56471781408.17665x^{12}+63313558032.58708x^{11}-52430924785.25504x^{10}+32577816415.35461x^{9}-15267928048.50856x^{8}+5377398940.34311x^{7}-1405132059.13719x^{6}+265891640.65593x^{5}-34982965.07744x^{4}+2987004.95254x^{3}-145624.88060x^{2}+2986.66667x}$

${\displaystyle \;L_{4}=1604617471.8510x^{16}-13238094142.7704x^{15}+49968790959.3588x^{14}-114310190758.3826x^{13}+176946047896.0571x^{12}-195945043427.5014x^{11}+159995944121.3113x^{10}-97829012110.5894x^{9}+45015620008.1122x^{8}-15526535208.6470x^{7}+3961897869.3057x^{6}-729925713.3421x^{5}+93240926.6909x^{4}-7715278.7671x^{3}+364667.3131x^{2}-7280.0000x}$

${\displaystyle \;L_{5}=-3851081932.4423x^{16}+31530733321.8714x^{15}-118014600625.0386x^{14}+267446169700.4090x^{13}-409679701374.1887x^{12}+448410826284.2035x^{11}-361428908733.8343x^{10}+217840661558.8782x^{9}-98659688548.6735x^{8}+33441903834.1596x^{7}-8373881063.3471x^{6}+1512122601.3085x^{5}-189195339.1544x^{4}+15337681.5698x^{3}-711343.3212x^{2}+13977.6x}$

${\displaystyle \;L_{6}=7060316876.1442x^{16}-57365074618.6718x^{15}+212912680796.2242x^{14}-478088254093.5941x^{13}+725020725291.7742x^{12}-784916071782.2535x^{11}+625178174985.6762x^{10}-372001376200.4074x^{9}+166180125282.1892x^{8}-55516389946.1491x^{7}+13692893124.6509x^{6}-2434925873.1974x^{5}+300081159.6671x^{4}-23981811.0600x^{3}+1098163.6741x^{2}-21354.6667x}$

${\displaystyle \;L_{7}=-10086166965.920x^{16}+81319721162.733x^{15}-299314884531.628x^{14}+666093322863.382x^{13}+1000446772071.373x^{12}+1072017171171.158x^{11}-844594918904.077x^{10}+496837139865.232x^{9}-219320381819.450x^{8}+72381528563.948x^{7}-17635280331.068x^{6}+3098508847.931x^{5}-377514324.910x^{4}+29854977.045x^{3}-1354651.574x^{2}+26148.571x}$

${\displaystyle \;L_{8}=11346937836.660x^{16}-90775502693.283x^{15}+331366044011.222x^{14}-730991010946.104x^{13}+1087849920454.064x^{12}-1154501752969.400x^{11}+900551858718.191x^{10}-524364914637.391x^{9}+229090002005.604x^{8}-74830969058.400x^{7}+18049489433.320x^{6}-3140942275.210x^{5}+379279801.510x^{4}-29754780.212x^{3}+1340839.429x^{2}-25740x}$

${\displaystyle \;L_{9}=-10086166965.9203x^{16}+80058950291.9925x^{15}-289859103001.0773x^{14}+633997839407.8629x^{13}-935238816157.1799x^{12}+983640799863.9704x^{11}-760304481367.9756x^{10}+438676146116.2794x^{9}-189931298320.0814x^{8}+61497840304.9114x^{7}-14709663906.2828x^{6}+2539758045.4894x^{5}-304498045.2923x^{4}+23737343.7162x^{3}-1063948.1905x^{2}+20337.7778x}$

${\displaystyle \;L_{10}=7060316876.1442x^{16}-55599995399.6357x^{15}+199674586653.4538x^{14}-433133892733.7696x^{13}+633595137618.2660x^{12}-660801882755.2526x^{11}+506520525181.9884x^{10}-289867863581.2933x^{9}+124513226619.0337x^{8}-40013170290.0740x^{7}+9503307923.1606x^{6}-1630193342.9661x^{5}+194307522.7623x^{4}-15070044.2088x^{3}+672565.1911x^{2}-12812.8x}$

${\displaystyle \;L_{11}=-3851081932.4423x^{16}+30086577597.2055x^{15}-107183432690.0446x^{14}+230637122421.3279x^{13}-334693607740.9036x^{12}+346333877641.7664x^{11}-263452751068.9336x^{10}+149663429178.3096x^{9}-63841287725.7351x^{8}+20382171194.1772x^{7}-4811733315.5251x^{6}+820893779.1809x^{5}-97369178.8764x^{4}+7519914.5780x^{3}-334427.5394x^{2}+6353.4545x}$

${\displaystyle \;L_{12}=1604617471.8510x^{16}-12435785406.8449x^{15}+43951475439.9177x^{14}-93838781918.2841x^{13}+135144509146.9397x^{12}-138823173541.3109x^{11}+104864824822.2035x^{10}-59179379524.2647x^{9}+25088338392.5610x^{8}-7964186416.2542x^{7}+1870391859.2768x^{6}-317606286.2109x^{5}+37517640.3682x^{4}-2887280.1637x^{3}+128026.8822x^{2}-2426.6667x}$

${\displaystyle \;L_{13}=-493728452.87722x^{16}+3795537481.49362x^{15}-13309453333.22533x^{14}+28202188704.66898x^{13}-40323751088.42652x^{12}+41138969287.27365x^{11}-30876804370.45528x^{10}+17321211261.59502x^{9}-7302784476.34160x^{8}+2306623062.41091x^{7}-539263122.24266x^{6}+91202614.92199x^{5}-10735523.07630x^{4}+823698.40506x^{3}-36433.35509x^{2}+689.23077x}$

${\displaystyle \;L_{14}=105798954.18797x^{16}-806717025.68331x^{15}+2806978503.29972x^{14}-5904490853.45158x^{13}+8384576805.58060x^{12}-8499641805.10702x^{11}+6341859902.60960x^{10}-3538432902.20016x^{9}+1484500201.94362x^{8}-466805633.89329x^{7}+108701004.725845x^{6}-18319599.810063x^{5}+2149846.10200x^{4}-164522.71173x^{3}+7261.55064x^{2}-137.14286x}$

${\displaystyle \;L_{15}=-14106527.22506x^{16}+106680612.13954x^{15}-368367712.88886x^{14}+769401541.678536x^{13}-1085486894.98980x^{12}+1093842237.27907x^{11}-811729100.16131x^{10}+450678677.52992x^{9}-188239271.99821x^{8}+58958123.91421x^{7}-13680883.41476x^{6}+2298568.99135x^{5}-269024.36205x^{4}+20541.40071x^{3}-904.95995x^{2}+17.06667x}$

${\displaystyle \;L_{16}=881657.95157x^{16}-6612434.63675x^{15}+22661364.53636x^{14}-47010277.49563x^{13}+65914775.02395x^{12}-66053112.55929x^{11}+48772274.79135x^{10}-26957394.51683x^{9}+11214513.74456x^{8}-3500013.84371x^{7}+809618.94280x^{6}-135655.88173x^{5}+15839.91772x^{4}-1207.06603x^{3}+53.09166x^{2}-x}$

### 2:Integral Comparison

 Integrals using Newton Cotes Actual Value 1.3179022 n Estimated Value Percent Difference n=1 1.35915 3.12981% n=2 1.318008 .00802791% n=4 1.318009 .00810379% n=8 1.31790215 3.7939E-6

### 3: Lagrange Polynomial Plots

The plots for l3 and l4 (3rd and 4th Lagrange Polynomial) are not necessary to be plotted as their graph are symmetrical to one another (a mirror image of the l0 and l1 polynomials).

Solution for problem 3: Guillermo Varela

## Problem-4: Simple to composite Simpson's rule

Solution for problem 4: Egm6341.s10.team2.lee 18:48, 7 February 2010 (UTC)

## Problem-5: Error Bound

Refer to P. 11-1 on Lecture-11 Notes

### Problem Statement

Find ${\displaystyle n\!}$ if:

${\displaystyle \left|f_{n}^{T}({\frac {7\pi }{8}})-f({\frac {7\pi }{8}})\right|\leq \left|f_{4}^{L}({\frac {7\pi }{8}})-f({\frac {7\pi }{8}})\right|\leq {\frac {\left|q_{4+1}(t)\right|}{(4+1)!}}}$

For ${\displaystyle f(x)=sin(x)\!}$ and ${\displaystyle x_{0}=0,x_{1}={\frac {\pi }{4}},x_{2}={\frac {\pi }{2}},x_{3}={\frac {3\pi }{4}},x_{4}=1}$

### Solution

Constructing the Lagrangian Interpolating Function:

${\displaystyle f_{4}^{L}(x)=P_{4}(x)=\sum _{i=0}^{4}l_{i,4}(x)f(x_{i})}$

Where

${\displaystyle l_{i,4}(x)=\prod _{j=0,j\neq 4}^{4}{\frac {x-x_{j}}{x_{i}-x_{j}}}}$

The Lagrangian Error

${\displaystyle E_{4}^{L}({\frac {7\pi }{8}})=\left|f_{4}^{L}({\frac {7\pi }{8}})-f({\frac {7\pi }{8}})\right|\leq {\frac {\left|q_{5}({\frac {7\pi }{8}})\right|}{5!}}}$

By Computing

${\displaystyle f_{4}^{L}({\frac {7\pi }{8}}),f({\frac {7\pi }{8}}),{\frac {q_{5}({\frac {7\pi }{8}})}{5!}}}$

Must plot the functions to compute

${\displaystyle E_{4}^{L}({\frac {7\pi }{8}})=1.4808e-3}$

The Taylor Series Error

${\displaystyle \left|f_{n}^{T}({\frac {7\pi }{8}})-f({\frac {7\pi }{8}})\right|}$

For ${\displaystyle n=0,1,2,3...\!}$

n=0

${\displaystyle \left|f_{0}^{T}(x)-f(x)\right|=\left|sin(x)-sin(x)\right|=0}$

n=1

${\displaystyle =\left|{\frac {1}{\sqrt {2}}}\left[1+{\frac {{\frac {7\pi }{8}}-{\frac {\pi }{4}}}{1!}}\right]-sin({\frac {7\pi }{8}})\right|}$

${\displaystyle =1.7128\!}$

...n=9

${\displaystyle \left|f_{n}^{T}({\frac {7\pi }{8}})-f({\frac {7\pi }{8}})\right|=6.31E-4\leq E_{4}^{L}({\frac {7\pi }{8}})=1.4808e-3}$

Solution for problem 5:Egm6341.s10.team2.patodon 21:43, 10 February 2010 (UTC)

## Problem 6: ${\displaystyle \;(n+1)^{th}}$ derivative of Lagrange Interpolation Error

P. 12-2 reference: Lecture-12 Notes

### Problem Statement

For the Lagrange Interpolation Error verify the following:

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

### Solution

We can write the Lagrange Interpolation error as

${\displaystyle {\boldsymbol {E(x)=f(x)-f_{n}(x)}}}$

differentiating the above expression once we get

${\displaystyle {\boldsymbol {E^{1}(x)=f^{1}(x)-f_{n}^{1}(x)}}}$

differentiating the expression (n+1) times we get

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

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

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

Solution for problem 6: Egm6341.s10.team2.niki 00:20, 8 February 2010 (UTC)

## Problem-7: Intermediate step in the proof of Error in Newton Cotes method

P. 12-3 (top); reference: Lecture-12 Notes

### Problem Statement

To Prove that the ${\displaystyle \left(n+1\right)^{th}}$ derivative of ${\displaystyle q_{n+1}\left(x\right)}$ is ${\displaystyle \left(n+1\right)!}$

### Solution

We know that by definition ${\displaystyle q_{n+1}\left(x\right)}$ is:

${\displaystyle q_{n+1}\left(x\right)=\prod _{j=0}^{n}\left(x-x_{j}\right)}$

Expanding the above terms in the product, we get:

${\displaystyle q_{n+1}\left(x\right)=\left(x-x_{0}\right)\left(x-x_{1}\right)\left(x-x_{2}\right).....\left(x-x_{n}\right)}$

We see that the above expression is a ${\displaystyle \left(n+1\right)^{th}}$ degree polynomial in ${\displaystyle x}$

Let it be expressed as:

${\displaystyle q_{n+1}\left(x\right)=x^{n+1}+C_{0}x^{n}+C_{1}x^{n-1}+C_{2}x^{n-2}+.....+C_{n}x^{0}}$

Note that here the coefficient of ${\displaystyle \;x^{n+1}}$ is 1. As we successively differentiate the ${\displaystyle q_{n+1}\left(x\right)}$ term ${\displaystyle \;\left(n+1\right)}$ times, all the lower degree terms that are less than ${\displaystyle \;\left(n+1\right)}$ vanish. Therefore, we are concerned only about the ${\displaystyle \;\left(n+1\right)^{th}}$ degree term i.e. ${\displaystyle \;x^{n+1}}$ as we successively differentiate the equation.

${\displaystyle {\frac {\mathrm {d} }{\mathrm {d} x}}\left[q_{n+1}\left(x\right)\right]=\left(n+1\right)x^{\left(n+1\right)-1}+other\;terms}$

${\displaystyle {\frac {\mathrm {d^{2}} }{\mathrm {d} x^{2}}}\left[q_{n+1}\left(x\right)\right]=\left(n+1\right)\left(\left(n+1\right)-1\right)x^{\left(n+1\right)-2}+other\;terms}$

${\displaystyle \vdots \qquad \qquad \qquad \vdots \qquad \qquad \qquad \vdots \qquad \qquad \qquad \vdots }$
${\displaystyle \vdots \qquad \qquad \qquad \vdots \qquad \qquad \qquad \vdots \qquad \qquad \qquad \vdots }$

${\displaystyle {\begin{matrix}{\frac {\mathrm {d} ^{n+1}}{\mathrm {d} x^{n+1}}}\left[q_{n+1}\left(x\right)\right]&=&\left(n+1\right)\left(\left(n+1\right)-1\right)\cdots \cdots \left(\left(n+1\right)-n\right)x^{\left(n+1\right)-\left(n+1\right)}\\\\\ &=&\left(n+1\right)\left(\left(n+1\right)-1\right)\cdots \cdots \left(\left(n+1\right)-n\right)\\\\\ &=&\left(n+1\right)\cdot \left(n\right)\cdots \cdots 2\;\cdot 1\\\\\ &=&\left(n+1\right)!\end{matrix}}}$

Thus, we proved that the ${\displaystyle \left(n+1\right)^{th}}$ derivative of ${\displaystyle q_{n+1}\left(x\right)}$ is ${\displaystyle \left(n+1\right)!}$

Solution for problem 7: Egm6341.s10.team2.madala 11:58, 8 February 2010 (UTC)

## Problem-8: Geometric Interpretation of G(x) Error for Log(x)

### Problem Statement

Let ${\displaystyle \;F(x)=\log(x)\quad and\quad t=2\quad x_{0}=3\quad x_{1}=4\quad ...\quad x_{6}=9}$

Plot:

1) A graph of ${\displaystyle \;F(x)}$ and ${\displaystyle \;F_{n}(x)}$

2) A plot of the Lagrange Polynomial when i=3

3) A plot of ${\displaystyle \;q_{n+1}(t)}$ when n=6

### Part 1

The Lagrange Interpolation Function is as follows:

${\displaystyle \;F_{n}=-4.92641E-6x^{6}+.000212^{5}+-.0039x^{4}+.039876x^{3}-.25286x^{2}+1.114899x-.77941}$

The plot is as follows:

### Part 2

The Lagrange Polynomial is as follows:

${\displaystyle \;L_{3}(x)=-0.027777778x{^{6}}+x^{5}-14.61111111x^{4}+110.6666667x^{3}-457.3611111x^{2}+976.3333333x-840}$

The plot as follows:

### Part 3

${\displaystyle \;q_{7}(x)=x^{7}-42x^{6}+742x^{5}-7140x^{4}+40369x^{3}-133938x^{2}+241128x-181440}$

The Plot as Follows:

Solution for problem 8:

## Problem-9: Error in simple Trapezoidal rule

Solution for problem 9: Egm6341.s10.team2.lee 20:48, 9 February 2010 (UTC)

## Problem 10: Simple Simpson's Rule Error

### Problem Statement

Show that the Error for the simple simpson's rule is:

${\displaystyle n=2\qquad q_{3}(x)=(x-x_{0})(x-x_{1})(x-x_{2})}$

${\displaystyle \left|E_{2}\right|={\frac {(b-a)^{4}}{192}}M_{3}={\frac {2^{4}h^{4}M_{3}}{192}}}$

${\displaystyle h={\frac {a+b}{2}}}$

### Solution

The error can be written:

${\displaystyle {\frac {M_{3}}{3!}}\int _{a}^{b}\left|(x-a)(x-{\frac {a+b}{2}})(x-b)\right|dx}$

with ${\displaystyle x_{0}=a\quad x_{1}={\frac {a+b}{2}}\quad x_{2}=b}$

The Integral can be evaluated as follows:

${\displaystyle \int _{a}^{b}\left|(x-a)(x-{\frac {a+b}{2}})(x-b)\right|dx=\int _{a}^{b}(x-a)(x-{\frac {a+b}{2}})(b-x)dx}$

${\displaystyle \int _{a}^{b}(xb-x^{2}-ab+xa)(x-{\frac {a+b}{2}}dx}$

${\displaystyle \int _{a}^{b}-x^{3}+x^{2}((b+a)+({\frac {a+b}{2}})+x(-ab-b{\frac {a+b}{2}}-a({\frac {b+a}{2}}))+ab({\frac {a+b}{2}})dx}$

After algebraic manipulation and simplification the following is obtained:

${\displaystyle {\frac {1}{4}}\left[-b^{4}-a^{4}+(2a+2b)(b^{3}-a{3})+(a^{2}+b^{2})(b^{2}-a^{2})+(a+b)(2ab^{2}-2a^{2}b)\right]}$

which reduces to:

${\displaystyle {\frac {1}{32}}(b-a)^{4}}$

This result is used in the error function to yield:

${\displaystyle {\frac {(b-a)^{4}}{32}}{\frac {M_{3}}{3!}}={\frac {(b-a)^{4}}{192}}M_{3}={\frac {h^{4}16}{192}}M_{3}}$

Solution for problem 10: Guillermo Varela

## Problem 11:To show that Simpson's rule can be used to integrate a cubic polynomial exactly

P. 13-3, reference: Lecture-13 Notes

### Problem Statement

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

### Case A: Determination of Exact Integral

${\displaystyle {\boldsymbol {I=\int _{0}^{1}(3+8x-2x^{2}+6x^{3})dx}}}$

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

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

 ${\displaystyle \displaystyle {\boldsymbol {I=7.833}}}$ (1)

### Case B: Using Simple Simpson's rule

We have the Simple Simpson's rule as

 ${\displaystyle \displaystyle {\boldsymbol {I_{2}={\frac {h}{3}}\left\{f(x_{0})+4f(x_{1})+f(x_{2})\right\}}}}$ (2 p7-2)

where ${\displaystyle {\boldsymbol {h={\frac {a+b}{2}}={\frac {0+1}{2}}=0.5}}}$

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

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

 ${\displaystyle \displaystyle {\boldsymbol {I_{2}=7.833}}}$ (2)

### Conclusion

From the above we see that ${\displaystyle {\boldsymbol {I=I_{2}=7.833}}}$ which proves that the Simpsons rule can integrate a cubic polynomial exactly

Solution for problem 11: Egm6341.s10.team2.niki 00:23, 8 February 2010 (UTC)

## Problem-12: Differentiation of a definite integral

Solution for problem 12:Egm6341.s10.team2.lee 20:54, 9 February 2010 (UTC)

## Problem-13: Intermediate step in proving the tight error bound of the Simpson's rule

Solution for problem 13: Egm6341.s10.team2.lee 20:47, 9 February 2010 (UTC)

## Problem-14: An intermediate step in the proof of tight error bound of the simple Simpson's rule

P. 15-2 (bottom), Refer: Lecture-15 Notes

### Title

To Prove that: ${\displaystyle e^{(3)}\left(t\right)={\frac {-t}{3}}\left[F^{(3)}\left(t\right)-F^{(3)}\left(-t\right)\right]}$ which is an intermediate step in the proof of tight error bound of simple Simpson's rule

### Solution

We know by the definition ${\displaystyle e\left(t\right)}$

 ${\displaystyle e\left(t\right)}$ ${\displaystyle =\left[\int _{-t}^{t}F\left(\tau \right).d\tau \right]-\left({\frac {t}{3}}\right)\left[F\left(-t\right)+4F\left(0\right)+F\left(t\right)\right]}$ ${\displaystyle =\left[\int _{-t}^{k}F\left(\tau \right).d\tau +\int _{k}^{t}F\left(\tau \right).d\tau \right]-\left({\frac {t}{3}}\right)\left[F\left(-t\right)+4F\left(0\right)+F\left(t\right)\right]}$

Differentiating with respect to 't', we get:

${\displaystyle e^{(1)}\left(t\right)=\left[F\left(-t\right)+F\left(t\right)\right]-\left({\frac {1}{3}}\right)\left[F\left(-t\right)+4F\left(0\right)+F\left(t\right)\right]-\left({\frac {t}{3}}\right)\left[-{F}'\left(-t\right)+{F}'\left(t\right)\right]}$

Again Differentiating with respect to 't', we get:

 ${\displaystyle e^{(2)}\left(t\right)}$ ${\displaystyle =\left[-{F}'\left(-t\right)+{F}'\left(t\right)\right]-\left({\frac {1}{3}}\right)\left[-{F}'\left(-t\right)+{F}'\left(t\right)\right]-\left({\frac {1}{3}}\right)\left[-{F}'\left(-t\right)+{F}'\left(t\right)\right]-\left({\frac {t}{3}}\right)\left[{F}''\left(-t\right)+{F}''\left(t\right)\right]}$ ${\displaystyle =\left({\frac {1}{3}}\right)\left[-{F}'\left(-t\right)+{F}'\left(t\right)\right]-\left({\frac {t}{3}}\right)\left[{F}''\left(-t\right)+{F}''\left(t\right)\right]}$

Again Differentiating with respect to 't', we get:

 ${\displaystyle e^{(3)}\left(t\right)}$ ${\displaystyle =\left({\frac {1}{3}}\right)\left[{F}''\left(-t\right)+{F}''\left(t\right)\right]-\left({\frac {1}{3}}\right)\left[{F}''\left(-t\right)+{F}''\left(t\right)\right]-\left({\frac {t}{3}}\right)\left[-{F}'''\left(-t\right)+{F}'''\left(t\right)\right]}$ ${\displaystyle ={\frac {-t}{3}}\left[{F}'''\left(t\right)-{F}'''\left(-t\right)\right]={\frac {-t}{3}}\left[F^{(3)}\left(t\right)-F^{(3)}\left(-t\right)\right]}$

Thus Proved.

Solution for problem 14: Srikanth Madala 07:04, 11 February 2010 (UTC)

## Problem-15: Relationship between ${\displaystyle \zeta \quad and\quad \zeta _{4}}$

P. 15-3 on Lecture-15 Notes

### Problem Statement

Proof:

${\displaystyle {\frac {-F^{(4)}(\zeta _{4})}{90}}={\frac {-(b-a)^{4}f^{(4)}(\zeta )}{1440}}}$

### Solution

Given:

${\displaystyle x(t)=x_{1}+ht\qquad and\qquad h={\frac {b-a}{2}}}$

${\displaystyle {\frac {dx(t)}{dt}}=h}$

${\displaystyle \;F(t)=F(x(t))}$

${\displaystyle F^{1}(t)={\frac {df(x(t))}{dt}}={\frac {df(x)}{dx}}{\frac {dx}{dt}}=f^{1}(x)h}$

${\displaystyle F^{2}(t)={\frac {df^{1}(x(t))}{dt}}=h{\frac {df^{1}(x)}{dx}}{\frac {dx}{dt}}=f^{2}(x)h^{2}}$

${\displaystyle F^{3}(t)={\frac {df^{2}(x(t))}{dt}}=h^{2}{\frac {df^{2}(x)}{dx}}{\frac {dx}{dt}}=f^{3}(x)h^{3}}$

${\displaystyle F^{4}(t)={\frac {df^{3}(x(t))}{dt}}=h^{3}{\frac {df^{3}(x)}{dx}}{\frac {dx}{dt}}=f^{4}(x)h^{4}}$

The next step is to substitute h, and manipulate the equations as follows:

${\displaystyle F^{4}(t)=f^{4}(x){\frac {(b-a)^{4}}{16}}}$

${\displaystyle -F^{4}(\zeta _{4})={\frac {-(b-a)^{4}}{16}}f^{4}(x)}$

${\displaystyle {\frac {-F^{4}(\zeta _{4})}{90}}={\frac {-(b-a)^{4}}{1440}}F^{4}(x)}$

It is then seen that the relation between ${\displaystyle \zeta \quad and\quad \zeta _{4}}$ must be:

${\displaystyle \;\zeta =x1+h\zeta _{4}}$

Solution for problem 15:

## Problem 16: Illustration of Runge Phenomenon

P. 16-1 on Lecture-16 Notes

### Problem Statement

Given data: ${\displaystyle I=\int _{-5}^{5}\left({\frac {1}{1+x^{2}}}\right)\cdot dx}$
To find:

1. Using Newton-Cotes for ${\displaystyle n=1,2,3\cdots \cdots 15}$ find the numerical integral ${\displaystyle \;I_{n}}$, and find Exact Integral ${\displaystyle \;I}$ also for comparison
2. Plot ${\displaystyle f,\;f_{n}}$ for selected values of ${\displaystyle \;n=1,2,3,8,12}$
3. Plot ${\displaystyle \;I_{n}}$ vs ${\displaystyle \;n}$ and prove that the value of ${\displaystyle \;I_{n}}$ does not converge with increasing value of ${\displaystyle \;n}$
4. Prove that the weights ${\displaystyle W_{i,n}:=\int _{a}^{b}l_{i,n}\left(x\right)\cdot dx}$ for ${\displaystyle n\geq 8}$ are not all positive and plot the ${\displaystyle l_{i,n}\left(x\right)}$ for ${\displaystyle i=1,2,3\cdots 8}$ with ${\displaystyle \;n=8}$

### Solution

1. From the below Matlab code, we generate the values of ${\displaystyle \;I}$ and various values of ${\displaystyle \;I_{n}}$ as tabulated below:

 Integrals using Newton Cotes Exact Integral value (I i.e 'IE' in Matlab code) 2 Arctan(5)=2.7468 n Numerical Integral Value (I_{n} i.e 'I' in Matlab code) Percent Difference n=1 0.3846 614.1684 n=2 6.7949 -59.5754 n=3 2.0814 31.9659 n=4 2.3740 15.7033 n=5 2.3077 19.0281 n=6 3.8704 -29.0314 n=7 2.8990 -5.2499 n=8 1.5005 83.0604 n=9 2.3986 14.5160 n=10 4.6733 -41.2235 n=11 3.2448 -15.3469 n=12 -0.3129 -977.7504 n=13 1.9198 43.0777 n=14 7.8995 -65.2284 n=15 4.1556 -33.9006

${\displaystyle f\left(x\right)=\left({\frac {1}{1+x^{2}}}\right)}$

And from Matlab code below we know that:

${\displaystyle f_{1}(x)={\frac {1}{26}}}$

${\displaystyle \;f_{2}(x)=-1/130*y*(-1/10*y+1/2)+(1/5*y+1)*(-1/5*y+1)+1/130*(1/10*y+1/2)*y}$

${\displaystyle \;f_{3}(x)=1/26*(-3/10*y-1/2)*(-3/20*y+1/4)*(-1/10*y+1/2)+9/34*(3/10*y+3/2)*(-3/10*y+1/2)*(-3/20*y+3/4)+9/34*(3/20*y+3/4)*(3/10*y+1/2)*(-3/10*y+3/2)+1/26*(1/10*y+1/2)*(3/20*y+1/4)*(3/10*y-1/2)}$

${\displaystyle \;f_{8}(x)=-1/130*(-4/5*y-3)*(-2/5*y-1)*(-4/15*y-1/3)*y*(-4/25*y+1/5)*(-2/15*y+1/3)*(-4/35*y+3/7)*(-1/10*y+1/2)-64/3615*(4/5*y+4)*(-4/5*y-2)*(-2/5*y-1/2)*y*(-1/5*y+1/4)*(-4/25*y+2/5)*(-2/15*y+1/2)*(-4/35*y+4/7)-8/145*(2/5*y+2)*(4/5*y+3)*(-4/5*y-1)*y*(-4/15*y+1/3)*(-1/5*y+1/2)*(-4/25*y+3/5)*(-2/15*y+2/3)-64/205*(4/15*y+4/3)*(2/5*y+3/2)*(4/5*y+2)*y*(-2/5*y+1/2)*(-4/15*y+2/3)*(-1/5*y+3/4)*(-4/25*y+4/5)+(1/5*y+1)*(4/15*y+1)*(2/5*y+1)*(4/5*y+1)*(-4/5*y+1)*(-2/5*y+1)*(-4/15*y+1)*(-1/5*y+1)+64/205*(4/25*y+4/5)*(1/5*y+3/4)*(4/15*y+2/3)*(2/5*y+1/2)*y*(-4/5*y+2)*(-2/5*y+3/2)*(-4/15*y+4/3)+8/145*(2/15*y+2/3)*(4/25*y+3/5)*(1/5*y+1/2)*(4/15*y+1/3)*y*(4/5*y-1)*(-4/5*y+3)*(-2/5*y+2)+64/3615*(4/35*y+4/7)*(2/15*y+1/2)*(4/25*y+2/5)*(1/5*y+1/4)*y*(2/5*y-1/2)*(4/5*y-2)*(-4/5*y+4)+1/130*(1/10*y+1/2)*(4/35*y+3/7)*(2/15*y+1/3)*(4/25*y+1/5)*y*(4/15*y-1/3)*(2/5*y-1)*(4/5*y-3)}$

$\displaystyle \;f_{12}(x)=-1/130*(-6/5*y-5)*(-3/5*y-2)*(-2/5*y-1)*(-3/10*y-1/2)*(-6/25*y-1/5)*y*(-6/35*y+1/7)*(-3/20*y+1/4)*(-2/15*y+1/3)*(-3/25*y+2/5)*(-6/55*y+5/11)*(-1/10*y+1/2)-216/16525*(6/5*y+6)*(-6/5*y-4)*(-3/5*y-3/2)*(-2/5*y-2/3)*(-3/10*y-1/4)*y*(-1/5*y+1/6)*(-6/35*y+2/7)*(-3/20*y+3/8)*(-2/15*y+4/9)*(-3/25*y+1/2)*(-6/55*y+6/11)-27/1090*(3/5*y+3)*(6/5*y+5)*(-6/5*y-3)*(-3/5*y-1)*(-2/5*y-1/3)*y*(-6/25*y+1/5)*(-1/5*y+1/3)*(-6/35*y+3/7)*(-3/20*y+1/2)*(-2/15*y+5/9)*(-3/25*y+3/5)-8/145*(2/5*y+2)*(3/5*y+5/2)*(6/5*y+4)*(-6/5*y-2)*(-3/5*y-1/2)*y*(-3/10*y+1/4)*(-6/25*y+2/5)*(-1/5*y+1/2)*(-6/35*y+4/7)*(-3/20*y+5/8)*(-2/15*y+2/3)-27/170*(3/10*y+3/2)*(2/5*y+5/3)*(3/5*y+2)*(6/5*y+3)*(-6/5*y-1)*y*(-2/5*y+1/3)*(-3/10*y+1/2)*(-6/25*y+3/5)*(-1/5*y+2/3)*(-6/35*y+5/7)*(-3/20*y+3/4)-216/305*(6/25*y+6/5)*(3/10*y+5/4)*(2/5*y+4/3)*(3/5*y+3/2)*(6/5*y+2)*y*(-3/5*y+1/2)*(-2/5*y+2/3)*(-3/10*y+3/4)*(-6/25*y+4/5)*(-1/5*y+5/6)*(-6/35*y+6/7)+(1/5*y+1)*(6/25*y+1)*(3/10*y+1)*(2/5*y+1)*(3/5*y+1)*(6/5*y+1)*(-6/5*y+1)*(-3/5*y+1)*(-2/5*y+1)*(-3/10*y+1)*(-6/25*y+1)*(-1/5*y+1)+216/305*(6/35*y+6/7)*(1/5*y+5/6)*(6/25*y+4/5)*(3/10*y+3/4)*(2/5*y+2/3)*(3/5*y+1/2)*y*(-6/5*y+2)*(-3/5*y+3/2)*(-2/5*y+4/3)*(-3/10*y+5/4)*(-6/25*y+6/5)+27/170*(3/20*y+3/4)*(6/35*y+5/7)*(1/5*y+2/3)*(6/25*y+3/5)*(3/10*y+1/2)*(2/5*y+1/3)*y*(6/5*y-1)*(-6/5*y+3)*(-3/5*y+2)*(-2/5*y+5/3)*(-3/10*y+3/2)+8/145*(2/15*y+2/3)*(3/20*y+5/8)*(6/35*y+4/7)*(1/5*y+1/2)*(6/25*y+2/5)*(3/10*y+1/4)*y*(3/5*y-1/2)*(6/5*y-2)*(-6/5*y+4)*(-3/5*y+5/2)*(-2/5*y+2)+27/1090*(3/25*y+3/5)*(2/15*y+5/9)*(3/20*y+1/2)*(6/35*y+3/7)*(1/5*y+1/3)*(6/25*y+1/5)*y*(2/5*y-1/3)*(3/5*y-1)*(6/5*y-3)*(-6/5*y+5)*(-3/5*y+3)+216/16525*(6/55*y+6/11)*(3/25*y+1/2)*(2/15*y+4/9)*(3/20*y+3/8)*(6/35*y+2/7)*(1/5*y+1/6)*y*(3/10*y-1/4)*(2/5*y-2/3)*(3/5*y-3/2)*(6/5*y-4)*(-6/5*y+6)+1/130*(1/10*y+1/2)*(6/55*y+5/11)*(3/25*y+2/5)*(2/15*y+1/3)*(3/20*y+1/4)*(6/35*y+1/7)*y*(6/25*y-1/5)*(3/10*y-1/2)*(2/5*y-1)*(3/5*y-2)*(6/5*y-5)$

Using the above equations, we generate plots (as show in the picture below) of the function ${\displaystyle f\left(x\right),\;f_{n}\left(x\right)}$ for selected values of ${\displaystyle \;n=1,2,3,8,12}$




3. The following picture is generated using the Matlab code below and from the graph we can observe that the value of ${\displaystyle \;I_{n}}$ does not converge with increasing value of ${\displaystyle \;n}$
For each projected dotted line from X-axis on to the blue curve, we have a distinct numerical value of ${\displaystyle \;I_{n}}$ on the Y-axis. The Exact Integral- ${\displaystyle \;I}$ is the green straight line on the plot. We can clearly see that there is no convergence in the value of ${\displaystyle \;I_{n}}$(on Y-axis) as ${\displaystyle \;n}$ (on X-axis) value increases.




4. The Values of weights are evaluated by integrated the Lagrange polynomials within the integration limits and they are presented in the table below. It can be noted that the Bold weights in the table are negative

 Weights of the function n-value W0 Value W1 Value W2 Value W3 Value W4 Value W5 Value W6 Value W7 Value W8 Value W9 Value W10 Value W11 Value W12 Value W13 Value W14 Value W15 Value 8 989/2835 5888/2835 -928/2835 10496/2835 -908/567 10496/2835 -928/2835 5888/2835 989/2835 9 2857/8960 15741/8960 27/224 1209/560 2889/4480 2889/4480 1209/560 27/224 15741/8960 2857/8960 10 80335/299376 132875/74844 -80875/99792 28375/6237 -24125/5544 89035/12474 -24125/5544 28375/6237 -80875/99792 132875/74844 80335/299376 11 434293/1741824 4495513/2903040 -3237113/8709120 560593/193536 -1599257/1451520 2582261/1451520 2582261/1451520 -1599257/1451520 560593/193536 -3237113/8709120 4495513/2903040 434293/1741824 12 1364651/6306300 25008/15925 -210774/175175 1786256/315315 -1144251/140140 2431008/175175 -1045204/75075 2431008/175175 -1144251/140140 1786256/315315 -210774/175175 25008/15925 1364651/6306300 13 8181904909/40236134400 56280729661/40236134400 -1737125143/2235340800 11148172711/2874009600 -6066382933/1609445376 22964826443/4470681600 -3592666051/3353011200 -3592666051/3353011200 22964826443/4470681600 -6066382933/1609445376 11148172711/2874009600 -1737125143/2235340800 56280729661/40236134400 8181904909/40236134400 14 90241897/500385600 44436679/31274100 -770720657/500385600 109420087/15637050 -6625093363/500385600 789382601/31274100 -5600756791/166795200 101741867/2606175 -5600756791/166795200 789382601/31274100 -6625093363/500385600 109420087/15637050 -770720657/500385600 44436679/31274100 90241897/500385600 15 25221445/147603456 147529925/114802688 -129408925/114802688 1746295975/344408064 -124034975/16400384 1367713705/114802688 -10001664025/1033224192 566004225/114802688 566004225/114802688 -10001664025/1033224192 1367713705/114802688 -124034975/16400384 1746295975/344408064 -129408925/114802688 147529925/114802688 25221445/147603456

The plot of ${\displaystyle l_{i,n}\left(x\right)}$ for ${\displaystyle i=1,2,3\cdots 8}$ with ${\displaystyle \;n=8}$




MATLAB Code:

To generate the values of numerical Intergrals: ${\displaystyle I_{1},I_{2},\cdots I_{15}}$

%To generate Lagrange polynomials l(x)%

for n=1:15
for i=1:n+1
x(n,i) = -5+(i-1)*10/n;
f(n,i) = 1/(1+x(n,i)^2);
end
end
syms y;
for n=1:15
for i=1:n+1
pr=1;
for j=1:n+1
if j~=i
pr=pr*((y-x(n,j))/(x(n,i)-x(n,j)));
end
end
l(n,i)=pr;
end
end

%To generate Fn(x)for numerically integrating%

for n=1:15
for i=1:n+1
F(n,i)=l(n,i)*f(n,i);
end
end
for n=1:15
sum=0;
for i=1:n+1
sum=sum+F(n,i);
end
G(n)=sum;
end
for n=1:15
T(n,1)=G(n);
end

%for calculating Exact Integral and Numerical Integral%

Ie=double(int(1/(1+y^2),y,-5,5));
for n=1:15
I(n,1)=int(T(n,1),y,-5,5);
IE(n,1)=Ie;
end
n=linspace(1,15,15);
I=double(I);
plot(n,I,n,IE);
legend('I=Numerical Integral(I_n)','IE=Exact Integral(I)');
xlabel('n-Value (Degree of the Newton-Cotes appoximating polynomial)');
ylabel('Numerical Value of Exact Integral (I) and Numerical Integrals (I_n)');

%code for calculating percentage error%
for n=1:15
PE(n,1)=(((IE(n,1)-I(n,1))/I(n,1))*100);
end

Te=(1/(1+y^2));
%code for plotting f,f1,f2,f3,f8 and f12 that are represented by Te, T(1,1), T(2,1), T(3,1), T(8,1), T(12,1) respectively in this code%
figure (2);
EZPLOT(Te);
hold on;
EZPLOT(T(1,1))
hold on;
EZPLOT(T(2,1))
hold on;
EZPLOT(T(3,1))
hold on;
EZPLOT(T(8,1))
hold on;
EZPLOT(T(12,1))
hold on;
xlabel('x- Value ');
ylabel('f(x),f1(x),f2(x),f3(x),f8(x) and f12(x)');

%code for calculating the Weights by integrating the lagrange polnomial%
for n=1:15
for i=1:n+1
W(n,i)=int(l(n,i),y,-5,5);
end
end
%code for plotting L0,L1,L2,L3,L4...L7 and L8 for n=8%
figure (3);
ezplot(l(8,1));
hold on;
ezplot(l(8,2));
hold on;
ezplot(l(8,3));
hold on;
ezplot(l(8,4));
hold on;
ezplot(l(8,5));
hold on;
ezplot(l(8,6));
hold on;
ezplot(l(8,7));
hold on;
ezplot(l(8,8));
hold on;
ezplot(l(8,9));
hold on;
xlabel('x- Value ');
ylabel('L0(x),L1(x),L2(x),L3(x)....L7(x) and L8(x)');


Solution for problem 16: Srikanth Madala 07:04, 11 February 2010 (UTC)

## Contributing Authors

Solutions for problem 5 and proofread problems: 3,6,8,and 12--Egm6341.s10.team2.patodon 16:42, 10 February 2010 (UTC)

--Egm6341.s10.Team2.GV 21:55, 10 February 2010 (UTC)

Solutions for problems 1,6,11 and proofread 5,9,14--Niki Nachappa Chenanda Ganapathy

Solutions for problems 4,9,12,13 and proofread 2,10,11--Pengxiang Jiang

Solutions for problems 2,7,14,16 and proofread 1,8,13--Srikanth Madala 07:04, 11 February 2010 (UTC)

 Problem Assignments Problem Solution Proofread Problem 1 NN SM Problem 2 SM JP Problem 3 GV PO Problem 4 JP GV Problem 5 PO NN Problem 6 NN PO Problem 7 SM GV Problem 8 PO SM Problem 9 JP NN Problem 10 GV JP Problem 11 NN JP Problem 12 GV PO Problem 13 JP SM Problem 14 SM NN Problem 15 PO GV Problem 16 SM PO