User:Egm6322.s12.TEAM1.HW/HW3

Problem 1: Verification of Terms
 Solved without assistance 

Given
after removing the coefficients of $$ \rho^n \ $$ we get

Solution
After removing the terms in Eq.1.2 fFrom Eq1.1, the remaining initial terms form the following equation: Combining and moving terms to the left hand side of the equation and setting equal to zero, one obtains: Simplify to obtain: Combine like terms to obtain: From Lecture 41, Eqs(1) and (2) the following is known: Substituting 1.7, 1.8 and 1.9 into 1.6, one obtains: Combining like terms and subtracting results in: $$ \therefore \ $$ Recurrence Relation 2 is satisfied using the initial terms

Problem 2: Generate Legendre Polynommials using Recurrence Relation2
 Solved without assistance 

Solution
Given F10 class lecture 36, page2, equation 7 as shown here: starting with $$ P_3 \ $$ and using the integer portion of $$ \frac{n}{2} \ $$, thus when $$ n=1 \ $$ , $$ i=0 \ $$ and when $$ n= 2,3 \ $$, $$ i=1 \ $$. Thus we have the following: Repeating above steps for $$ n= 4,5,6 \ $$ we get the following equations and solutions:

Problem 3: Evaluation
 Solved without assistance 

Given
and

Find
Evaluate $$ h_0 \ $$ by direct integration, then use Eq 3.1 to deduce Eq 3.2 by induction.

Solution:
First, integrate directly the first term: $$\begin{align} & {{h}_{0}}=\left\langle {{P}_{0}},{{P}_{0}} \right\rangle =\int_{x=-1}^{x=1}{{{P}_{0}}(x)}{{P}_{0}}(x)dx \\ & =\int_{x=-1}^{x=1}{1}*dx=2 \end{align}$$ Then, continue deriving: $$\begin{align} & {{h}_{n}}=\frac{2n-1}{2n+1}{{h}_{n-1}}=\frac{2(n-1)+1}{2(n-1)+3}{{h}_{n-1}} \\ & =\frac{2(n-1)+1}{2(n-1)+3}\times \frac{2(n-2)+1}{2(n-2)+3}{{h}_{n-2}}=\frac{2(n-2)+1}{2(n-1)+3}{{h}_{n-2}} \\ & =\frac{2(n-3)+1}{2(n-1)+3}{{h}_{n-3}} \\ & =\frac{2(n-3)+1}{2(n-1)+3}\cdots \frac{2*(1)+1}{2*(1)+3}\times \frac{2*(0)+1}{2*(0)+3}{{h}_{0}} \\ & =\frac{2*(0)+1}{2(n-1)+3}{{h}_{0}} \\ & =\frac{2}{2n+1} \end{align}$$

Problem 4: Weight Calculation
 Solved without assistance 

Find
Show that $$ w_2=1 \ $$ by carrying out the calculation as shown in Eq4.1

Solution:
According to the following equation: $$\displaystyle {{w}_{j}}=\frac{-2}{(n+1){{{{P}'}}_{n}}({{x}_{j}}){{P}_{n+1}}({{x}_{j}})}$$ $$ \displaystyle n=2$$, and Legendre polynomials are: $$\displaystyle {{P}_{2}}(x)=\frac{1}{2}(3{{x}^{2}}-1)$$ $$\displaystyle {{P}_{3}}(x)=\frac{1}{2}(5{{x}^{3}}-3x)$$ $$\displaystyle {{P}_{2}}^{\prime }(x)=3x$$ $${{x}_{1,2}}=\pm \frac{1}{\sqrt{3}}$$ So,

$$\begin{align} & {{w}_{2}}=\frac{-2}{(2+1){{{{P}'}}_{2}}({{x}_{2}}){{P}_{3}}({{x}_{2}})} \\ & =\frac{-2}{(2+1)*3*\frac{1}{\sqrt{3}}*\frac{1}{2}(5{{\left( \frac{1}{\sqrt{3}} \right)}^{3}}-3\frac{1}{\sqrt{3}})} \\ & =\frac{-2}{(2+1)*3*\frac{1}{\sqrt{3}}*\frac{1}{2}*(-\frac{4\sqrt{3}}{9})} \\ & =1 \end{align}$$

Problem 5: Verify table for Gauss Legendre Quadrature
 Solved without assistance 

Find: Verify Table
(1) Verify values in table against corresponding numerical values from NIST Digital Library of Math Functions (2) Discuss the relative merits of using the exact, but irrational vaules versus using the numerical values. (3) Extend above table to include $$ n=6 \ $$

Solution:
(1).Verify the values for the roots of the Legendre polynomials:
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} P_0 &= 1\\ P_1 &= x \\ P_2 &= \frac{1}{2}(3x^2-1) \\ P_3 &= \frac{1}{2}(5x^3-3x) \\ P_4 &= \frac{1}{8}(35x^4-30x^2+3) \\ P_5 &= \frac{1}{8}(63x^5-70x^3+15x) \\ P_6 &= \frac{1}{16}(231x^6-315x^4+105x^2-5) \end{align} $$
 * 
 * }
 * }

To verify the values of the roots in the table just plug them into Legendre polynomials and see whether they are equal to 0.
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} P_1 &= x =0\\ P_2 &= \frac{1}{2}(3(\pm 1/\sqrt{3})^2-1)=0 \\ P_3 &= \frac{1}{2}(5(\pm \sqrt{3/5})^3-3(\pm \sqrt{3/5}))=0 \\ P_4 &= \dots =0 \\ P_5 &= \dots =0 \end{align} $$ So, the roots are verified.
 * 
 * }
 * }

Verify the weights in the table using:
 * {| style="width:100%" border="0" align="left"

\displaystyle w_j=\frac{-2}{(n+1)P_n'(x_j)P_{n+1}(x_j)} $$ n=1:
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_1=\frac{-2}{(1+1)P_1'(0)P_2(0)}=\frac{-2}{2\cdot 1\cdot (-\frac{1}{2})}=2 $$
 * 
 * }
 * }

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

\displaystyle w_1=\frac{-2}{(2+1)P_2'(-1/\sqrt{3})P_3(-1/\sqrt{3})}=\frac{-2}{3\cdot (-3/\sqrt{3})(2/3\cdot \sqrt{3})}=1 $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_2=\frac{-2}{3\cdot (3/\sqrt{3})\cdot (-2/3\cdot \sqrt{3})}=1 $$
 * 
 * }
 * }

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

\displaystyle w1=\frac{-2}{(3+1)P_3'(-\sqrt{3/5})P_4(-\sqrt{3/5})}=\frac{5}{9} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_2=\frac{-2}{(3+1)\cdot P_3'(0)\cdot P_4(0)}=\frac{8}{9} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_3=\frac{5}{9} $$
 * 
 * }
 * }

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

\displaystyle w_1=\frac{-2}{(4+1)\cdot P_4'(x_1)P_5(x_1)}=\frac{18-\sqrt{30}}{36} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_2=\frac{18+\sqrt{30}}{36} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_3=\frac{18+\sqrt{30}}{36} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_4=\frac{18-\sqrt{30}}{36} $$
 * 
 * }
 * }

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

\displaystyle w_3=\frac{128}{225} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_1=w_5=\frac{322-13\sqrt{70}}{900} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle w_2=w_4=\frac{322+13\sqrt{70}}{900} $$
 * 
 * }
 * }

(2)Verify these exact values in the table against the corresponding numerical values in NIST: There's only a table for 5-point Gauss-Legendre formula:
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{matrix} \pm x_k & w_k \\ 0.00000 \ 00000 \ 00000 & 0.56888\ 88888\ 88889 \\ 0.53846\ 93101\ 05683 & 0.47862\ 86704\ 99366 \\ 0.90617\ 98459\ 38664 & 0.23692\ 68850\ 56189 \end{matrix} $$
 * <p style="text-align:right;">
 * }
 * }


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

\displaystyle \begin{matrix} x_3=0 \\ w_3=\frac{128}{225}=0.5689 \\ x_2,x_4=\pm \frac{1}{3} \sqrt{5-2 \sqrt{10/7}}=\pm 0.5385\\ w_{2,4}=\frac{322+13\sqrt{70}}{900}=0.4786\\ x_1,x_5=\pm \frac{1}{3}\sqrt{5+2\sqrt{10/7}}=\pm 0.9062\\ w_1,5=\frac{322-13\sqrt{70}}{900}=0.2369 \end{matrix}

$$ So, using numerical values will be more convenient when the expression of the function is comlicated. But exact, irrational values will be more precise.
 * <p style="text-align:right;">
 * }
 * }

(3)Extend the table to 6.
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{matrix} Number\ of\ points,n & Points,x_i & Weights,n_i\\ 6 & \pm 0.9325 & 0.1715 \\ & \pm 0.6612 & 0.3607 \\ & \pm 0.2386 & 0.4679 \end{matrix}

$$
 * <p style="text-align:right;">
 * }
 * }

Problem 6: Pose Question to be solved
 Solved without assistance 

Given
from NIST Digital Library of Math Functions, the weights are given by the formula: with

Find
Show that can be obtained from equations 6.1 and 6.2

Problem 7: Compute using GL Quadrature
 Solved without assistance 

Given
$$\displaystyle A_n = \frac{2n+1}{2} \int_{-1}^{1} f(\mu)P_n(\mu)d\mu $$|| <p style="text-align:right"> (7.1) $$\displaystyle f(\mu) = T_0 \sinh(1-\mu^2) $$|| <p style="text-align:right"> (7.2)

Find
Compute the first 3 non-zero coefficients using Gauss-Legendre quadrature to within 5% error.

Solution
To know non zero coefficient, We have to define $$\displaystyle A_{2n} = A_{2n+1} = 0?$$ $$\displaystyle <f, P_n> = \int_{-1}^1 f(\mu) P_n(\mu) \, {\rm d}\mu = \int_{-1}^0 f(\mu) P_n(\mu) \, {\rm d}\mu + \int_{0}^1 f(\mu) P_n(\mu) \, {\rm d}\mu $$ If n is odd, $$\displaystyle P_n$$ and $$\displaystyle f(\mu)$$ is $$\displaystyle even$$. Thus, when $$\displaystyle n$$ is odd, we have that $$\displaystyle n = 2k + 1$$ $$\displaystyle <f, P_{2k+1}> = \int_{-1}^0 f(-\mu) (-P_{2k+1}(-\mu)) \, {\rm d}\mu + \int_{0}^1 f(\mu) P_{2k+1}(\mu) \, {\rm d}\mu $$ Let's define $$\displaystyle -\mu = \xi$$ $$\displaystyle <f, P_{2k+1}> = \int_1^0 f(\xi) P_{2k+1}(\xi) \, {\rm d}\xi + \int_0^1 f(\mu) P_{2k+1}(\mu) \, {\rm d}\mu $$ $$\displaystyle <f, P_{2k+1}> = - \int_0^1 f(\xi) P_{2k+1}(\xi) \, {\rm d}\xi + \int_0^1 f(\mu) P_{2k+1}(\mu) \, {\rm d}\mu = 0 $$ Thus $$\displaystyle A_{2k+1} = 0 $$ This shows that when n  = odd number, $$\displaystyle A_n = 0$$ $$\displaystyle \begin{align} &P_0\left(\mu\right)=1 ,\\ &P_2\left(\mu\right)=\frac{1}{2}\left(3\mu^2-1\right) ,\\ &P_4\left(\mu\right)=\frac{1}{8}\left(35\mu^4-30\mu^2+3\right) ,\\ &P_6\left(\mu\right)=\frac{1}{16}\left(231\mu^6-315\mu^4+105\mu^2-5\right) .\\ \end{align} $$

Using the above values and plugging into eq 7.1, <Br/> $$\displaystyle A_n = \frac {2(n) + 1}{2}\int_{-1}^{1}T_0sinh(1-\mu^2)P_n(\mu)d\mu$$ $$\displaystyle A_0 = \frac {2(0) + 1}{2}\int_{-1}^{1}T_0sinh(1-\mu^2)P_0(\mu)d\mu = \frac {1}{2} * 1.492T_0 = 0.746T_0$$ $$\displaystyle A_2 = \frac {2(2) + 1}{2}\int_{-1}^{1}T_0sinh(1-\mu^2)P_2(\mu)d\mu = -0.7997T_0$$ $$\displaystyle A_4 = \frac {2(4) + 1}{2}\int_{-1}^{1}T_0sinh(1-\mu^2)P_4(\mu)d\mu = 0.066713T_0$$

Using Matlab, I compute the coefficient.

Problem 8: Verification
 Solved without assistance 

Find
Verify equation 8.1 and show that for $$ i=1,...,n \ $$ and thus

Part1
From the wikipedia, $$\ell_j(x_i) = \prod_{m=0,\, m\neq j}^{k} \frac{x_i-x_m}{x_j-x_m} $$ From above equation, when $$m = j$$, the product skips And if $$i = j$$ the above equation's all terms are $$\frac{x_j-x_m}{x_j-x_m} = 1$$ except where $$x_j = x_m$$ if $$i \neq j$$ then since $$m \neq j$$ doesn't preclude it, one term in the product will be for $$m=i$$, $$\frac{x_i-x_i}{x_j-x_i} = 0$$ Thus, $$\ell_j(x_i) = \delta_{ji} = \begin{cases} 1, & \text{if } j=i  \\ 0, & \text{if } j \ne i \end{cases} $$ Where $$\displaystyle \delta_{ji}$$ is that The value is 1 if they are equal $$ \delta_{1 \, 1} = 1 $$

And 0 otherwise. $$\delta_{1 \, 2} = 0. $$

Part2
$$\displaystyle p^h(x) = \sum_{j=1}^n p(x_j)\ell_j(x) $$ $$\displaystyle d(x)=p(x) - p^h(x) = p(x) - \sum_{j=1}^n p(x_j)\ell_j(x) $$<Br/> $$\displaystyle d(x_i)=p(x_i) - p^h(x_i) = p(x_i) - \sum_{j=1}^n p(x_j)\ell_j(x_i) $$<Br/> $$\displaystyle d(x_i)=p(x_i) - \sum_{j=1}^n p(x_j)\ell_j(x_i) = p(x_i)-[p(x_1)\ell_1(x_i) + p(x_2)\ell_2(x_i)+ p(x_3)\ell_3(x_i)+ .......+ p(x_n)\ell_n(x_i)] $$<Br/> When j = i, $$\displaystyle \ell_j(x_i) = \delta_{ji} = 1$$ $$\displaystyle p(x_i)\ell_i(x_i) = p(x_i)$$ The other terms are always zero. Hence,<Br/> $$\displaystyle d(x_i) = p(x_i) - p(x_i) = 0$$

=Contributing Members & Referenced Lecture=

=Table of Contributions=