User:Egm6322.s12.TEAM1.HW/HW4

Problem 1: Verification and Integration
 Solved without assistance 

Find:
A. Verify Eq1.1 - Eq1.3 and Eq1.4 - Eq1.5 B. Intergrate both sides of Eq1.1 and use Eq1.2 to show the integral formula for weights, Eq1.6.

Solution:
A. verify equations First, according the definition, we have:

$$\displaystyle \pi (x):=\prod\limits_{k=1}^{n}{(x-{{x}_{k}})}$$.

The highest order of this equation won't be greater than n. Then,

$$\begin{array}{*{35}{l}} \pi (x)=(x-{{x}_{j}})\prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})}\in {{\mathcal{P}}_{n}} \\ \end{array}$$ Moving the first term from right to the left side of this equation yields: $$\begin{array}{*{35}{l}} \frac{\pi (x)}{x-{{x}_{j}}}=\prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})}\in {{\mathcal{P}}_{n-1}} \\ \end{array}$$ Taking the first derivative yields:

$$\begin{align} & {\pi }'(x)=(x-{{x}_{j}}{)}'\prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})}+(x-{{x}_{j}}){{\left[ \prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})} \right]}^{\prime }} \\ & =\prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})}+(x-{{x}_{j}}){{\left[ \prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})} \right]}^{\prime }} \end{align}$$

Substituting x_j into the above equation obtains:

$$\begin{align} & {\pi }'({{x}_{j}})=\prod\limits_{k=1,k\ne j}^{n}{({{x}_{j}}-{{x}_{k}})}+({{x}_{j}}-{{x}_{j}}){{\left[ \prod\limits_{k=1,k\ne j}^{n}{(x-{{x}_{k}})} \right]}^{\prime }} \\ & =\prod\limits_{k=1,k\ne j}^{n}{({{x}_{j}}-{{x}_{k}})} \end{align}$$ Because the highest order of polynomial P_n(x) won't be greater than n, so we can denote

$$\begin{array}{*{35}{l}} {{p}_{n}}(x)={{\alpha }_{n}}\pi (x) \\ \end{array}$$ in which $${{\alpha }_{n}}$$ is the leading coefficient, i.e. that of x^n. Then, the Lagrange basis function

$$\begin{array}{*{35}{l}} \begin{align} & {{\ell }_{j}}(x)=\frac{\pi (x)}{(x-{{x}_{j}}){\pi }'({{x}_{j}})} \\ & =\frac{{{P}_{n}}(x)/{{\alpha }_{n}}}{(x-{{x}_{j}}){{P}_}({{x}_{j}})/{{\alpha }_{n}}} \\ & =\frac{{{P}_{n}}(x)}{(x-{{x}_{j}}){{P}_}({{x}_{j}})}\in {{\mathcal{P}}_{n-1}} \\ \end{align} \\ \end{array}$$ B. integral formula for the weight

First, according to the equation (2)P45-6 and (1)P45-16C, we have: $$\begin{array}{*{35}{l}} {{I}_{n}}=\sum\limits_{j=1}^{n}{{{w}_{j}}f({{x}_{j}})}=\int\limits_{-1}^{+1}{{{f}^{h}}(x)dx} \\ \end{array}$$ Then, continued derivation yields: $$\begin{align} & \sum\limits_{j=1}^{n}{{{w}_{j}}f({{x}_{j}})}=\int\limits_{-1}^{+1}{\sum\limits_{j=1}^{n}{{{l}_{j}}(x)f({{x}_{j}})}dx} \\ & =\sum\limits_{j=1}^{n}{\int\limits_{-1}^{+1}{{{l}_{j}}(x)dx}f({{x}_{j}})} \end{align}$$

So, we can get: $$\begin{align} & {{w}_{j}}=\int\limits_{-1}^{+1}{{{l}_{j}}(x)dx} \\ & =\int\limits_{-1}^{+1}{\frac{{{P}_{n}}(x)}{(x-{{x}_{j}}){{P}_}({{x}_{j}})}dx} \end{align}$$

Problem 2: Christoffel-Darboux Identity
 Solved without assistance 

Given: Equations 2.1 - 2.?
Where and and

with

Find
A.Show that the Christoffel-Darboux Identity, Eq2.1, with appropriate selection can be written as Eq2.5. B.Show that from the integral formula, Eq2.6 & Eq2.7 for the weight of the Gauss Legendre Quadrature, one can obtain the first formula for the weights, Eq2.8.

Solution:
A. When y is selected to be $${{x}_{j}}$$ , the CD identity can be shown as follows.

$$\displaystyle \sum\limits_{k=0}^{n}{\frac{{{P}_{k}}(x){{P}_{k}}({{x}_{j}})}}=\frac{{{P}_{n+1}}(x){{P}_{n}}({{x}_{j}})-{{P}_{n}}(x){{P}_{n+1}}({{x}_{j}})}{{{\beta }_{n}}{{h}_{n}}(x-{x}_{j})}$$ Because $${{x}_{j}}$$ is the root of n-order polynomial, so $${{P}_{n}}({{x}_{j}})=0$$. Then, CD identity becomes:

$$\displaystyle -\sum\limits_{k=0}^{n}{\frac{{{P}_{k}}(x){{P}_{k}}({{x}_{j}})}}=\frac{{{P}_{n}}(x){{P}_{n+1}}({{x}_{j}})}{{{\beta }_{n}}{{h}_{n}}(x-{x}_{j})}$$ The both sides of the above equation are multiplied by $${{P}_{0}}({{x}_{j}})$$, then integrate both side.

$$\displaystyle \begin{array}{*{35}{l}} \frac{{{P}_{n+1}}({{x}_{j}})}\frac{{{P}_{n}}(x){{P}_{0}}(x)}{(x-{{x}_{j}})}=-\sum\limits_{k=0}^{n}{\frac{{{P}_{k}}(x){{P}_{k}}({{x}_{j}})}} \\ \end{array}{{P}_{0}}(x)$$

$$\displaystyle \begin{align} & \int_{-1}^{+1}{\frac{{{P}_{n+1}}({{x}_{j}})}\frac{{{P}_{n}}(x){{P}_{0}}(x)}{(x-{{x}_{j}})}}dx=\int_{-1}^{+1}{-\sum\limits_{k=0}^{n}{\frac{{{P}_{k}}(x){{P}_{k}}({{x}_{j}})}}{{P}_{0}}(x)}dx \\ & =-\sum\limits_{k=0}^{n}{<{{P}_{0}},{{P}_{n}}>{{P}_{k}}({{x}_{j}})}=-{{P}_{0}}({{x}_{j}}) \end{align}$$ Since $${{P}_{0}}(x)=1$$, the above equation becomes:

$$\displaystyle \int_{-1}^{+1}{\frac{{{P}_{n}}(x)}{(x-{{x}_{j}})}}dx=-\frac{{{P}_{n+1}}({{x}_{j}})}$$

B. The weight of GL quadrature (1) P.45-9b can be further derived by using the integral derived in the above Part A. $$\displaystyle \begin{align} & \begin{array}{*{35}{l}} {{w}_{j}}=\int_{-1}^{+1}{\frac{{{P}_{n}}(x)}{(x-{{x}_{j}}){{P}_}({{x}_{j}})}}dx \\ \end{array} \\ & \begin{array}{*{35}{l}} =\frac{1}{{{P}_}({{x}_{j}})}\int_{-1}^{+1}{\frac{{{P}_{n}}(x)}{(x-{{x}_{j}})}}dx \\ \end{array} \\ & =\frac{-1}{{{P}_}({{x}_{j}})}\frac{{{P}_{n+1}}({{x}_{j}})} \end{align}$$

Using the general formula for Legendre polynomials in (2) P41-5 obtains: $$\displaystyle \begin{align} & \begin{array}{*{35}{l}} {{h}_{n}}=\frac{2}{2n+1} \\ \end{array} \\ & \begin{array}{*{35}{l}} {{\beta }_{n}}=\frac \\ \end{array}=\frac{1\centerdot 3\centerdot \cdots \left( 2n+1 \right)/(n+1)!}{1\centerdot 3\centerdot \cdots \left( 2n-1 \right)/(n)!}=\frac{2n+1}{n+1} \end{align}$$

Substituting the last two equation into $${{w}_{j}}$$ yields:

$${{w}_{j}}=\frac{-2}{(n+1){{P}_}({{x}_{j}}){{P}_{n+1}}({{x}_{j}})}$$

Problem 3: Polynomial Division
 Solved without assistance 

Find
Prove Eq 3.4 and Eq3.5 are valid based on Equations 3.1-3.3

Solution
From Eq3.3, solve for $$ q(x)\ $$ to get the following Equation: Next, plug in values of Eq3.1, 3.2 and 3.5 to get the following equations: Next simplify Perform division to get: $$ \therefore \ $$ Eq3.4 and Eq3.5 are valid based on Equations 3.1, 3.2, 3.3

Problem 4: Pose Question to be solved
 Solved without assistance 

Find
Use the table to verify Equations 4.1 and 4.2.

Solution:
Equation 4.1 states that the weights must be greater than zero. A quick scan of the third column verifies that all of the weights are >0. For the second part of this question, one must sum the weights, based on each number of points. Thus for $$ n=1 \ $$, $$ w_i=2 \ $$ Thus for $$ n=2 \ $$, $$ w_i=1 \ $$ in 2 places $$ \therefore \sum w_i = 1+1= 2 \ $$ Thus for $$ n=3 \ $$, $$ w_i=\frac{8}{9} \ $$ in one place and $$ w_i=\frac{5}{9} \ $$ in two places $$ \therefore \sum w_i = \frac{8}{9} + 2 \left ( \frac{8}{9} \right )= 2 \ $$ Thus for $$ n=4 \ $$, $$ w_i=\tfrac{18+\sqrt{30}}{36} \ $$ in 2 places and $$ \tfrac{18-\sqrt{30}}{36} \ $$ in two places $$ \therefore \sum w_i = 2*\tfrac{18+\sqrt{30}}{36} + 2*\tfrac{18-\sqrt{30}}{36}= 2 \ $$ Thus for $$ n=5 \ $$, $$ w_i=\frac{128}{225} \ $$ in one place and $$ w_i=\tfrac{322+13\sqrt{70}}{900} \ $$ in 2 places and $$ \tfrac{322-13\sqrt{70}}{900} \ $$ in two places $$ \therefore \sum w_i = \frac{128}{225} + 2* \tfrac{322-13\sqrt{70}}{900} + 2* \tfrac{322+13\sqrt{70}}{900} = 2 \ $$

Problem 5: Integrate and Find Number of Integration Points
 Solved without assistance 

Find: A & B below
A) Integrate Equation 5.1 analytically (not numerically) exactly over $$ [-1,1] \ $$ B) Determine the least nmber of integration points to integrate Eq5.1 exactly with the GL Quadrature. Carry out the integration and compare to the exact result.

part A
$$\displaystyle p(x) = \frac{x^7}{8} + \frac{x^6}{7} + \frac{x^2}{3} + 5$$ $$\displaystyle \int_{x=-1}^{x=1} p(x)dx = \int_{x=-1}^{x=1} (\frac{x^7}{8} + \frac{x^6}{7} + \frac{x^3}{3} + 5)dx $$ $$\displaystyle = [\frac {x^8}{8^2} + \frac{x^7}{7^2} + \frac{x^3}{3^2} +5x]_{-1}^{1} = \frac{492}{4} $$

part B
p(x) is 7 order equation. If n = 4, $$\displaystyle \int_{-1}^{1} f[x]dx = w_1f[x_1] + w_2f[x_2] + w_3f[x_3]+w_4f[x_4] $$ Where $$\displaystyle f_1[x] =1,f_2[x] =x,f_3[x]=x^2, ...... ,f_8[x] = x^7$$ $$\displaystyle \int_{-1}^{1} f_1[x]dx = w_1f_1[x_1] + w_2f_1[x_2] + w_3f_1[x_3]+w_4f_1[x_4] $$ $$\displaystyle \int_{-1}^{1} f_2[x]dx = w_1f_2[x_1] + w_2f_2[x_2] + w_3f_2[x_3]+w_4f_2[x_4] $$ $$\displaystyle \int_{-1}^{1} f_3[x]dx = w_1f_3[x_1] + w_2f_3[x_2] + w_3f_3[x_3]+w_4f_3[x_4] $$ $$\displaystyle \int_{-1}^{1} f_4[x]dx = w_1f_4[x_1] + w_2f_4[x_2] + w_3f_4[x_3]+w_4f_4[x_4] $$ $$\displaystyle \int_{-1}^{1} f_5[x]dx = w_1f_5[x_1] + w_2f_5[x_2] + w_3f_5[x_3]+w_4f_5[x_4] $$ $$\displaystyle \int_{-1}^{1} f_6[x]dx = w_1f_6[x_1] + w_2f_6[x_2] + w_3f_6[x_3]+w_4f_6[x_4] $$ $$\displaystyle \int_{-1}^{1} f_7[x]dx = w_1f_7[x_1] + w_2f_7[x_2] + w_3f_7[x_3]+w_4f_7[x_4] $$ $$\displaystyle \int_{-1}^{1} f_8[x]dx = w_1f_8[x_1] + w_2f_8[x_2] + w_3f_8[x_3]+w_4f_8[x_4] $$ From the above equations, $$\displaystyle w_1 + w_2 + w_3 + w_4= 2$$

$$\displaystyle w_1x_1 + w_2x_2 + w_3x_3 + w_4x_4= 0$$

$$\displaystyle w_1x_1^2 + w_2x_2^2 + w_3x_3^2 + w_4x_4^2= \frac{2}{3}$$

$$\displaystyle w_1x_1^3 + w_2x_2^3 + w_3x_3^3 + w_4x_4^3= 0$$

$$\displaystyle w_1x_1^4 + w_2x_2^4 + w_3x_3^4 + w_4x_4^4= \frac{2}{5}$$

$$\displaystyle w_1x_1^5 + w_2x_2^5 + w_3x_3^5 + w_4x_4^5= 0$$

$$\displaystyle w_1x_1^6 + w_2x_2^6 + w_3x_3^6 + w_4x_4^6= \frac{2}{7}$$

$$\displaystyle w_1x_1^7 + w_2x_2^7 + w_3x_3^7 + w_4x_4^7= 0$$

As a result of the above equations, the solution is that $$\displaystyle x_1 = -0.86113$$ $$\displaystyle x_2 = -0.33998$$ $$\displaystyle x_3 = 0.33998$$ $$\displaystyle x_4 = 0.86113$$ $$\displaystyle w_1 = 0.34785$$ $$\displaystyle w_2 = 0.65214$$ $$\displaystyle w_3 = 0.65214$$ $$\displaystyle w_4 = 0.34785$$

These results show that $$\displaystyle \int_{x=-1}^{x=1} p(x)dx = \sum_{j=1}^{n}w_jp(x_j) $$ Actually, $$\displaystyle \int_{x=-1}^{x=1} p(x)dx = \frac{492}{49} = 10.0408 $$ However, using the above values, $$\displaystyle \sum_{j=1}^{n}w_jp(x_j) = 10.2630$$ I think it is round-off error and truncation error.

Problem 6: Plot Function and Find non-zero coefficients
 Solved without assistance 

Find: A & B
A) Plot the function given in Eq6.1 B) Find the first three non-zero coefficients of the Fourier-Legendre Series, if not analytically then numerically using GL Quadrature with $$ 10^6 \ $$ accuracy.

Solution:

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

\displaystyle f(\theta)=\frac{1}{1+\sin^2(sin^2 \theta)} $$
 * 
 * }
 * }


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

\displaystyle \mu:=\sin \theta $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle F(\mu)=f(\theta)=\frac{1}{1+\sin^2(\mu^2)} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle F(\mu)=\sum_{j=0}^{\infty}A_jP_j(\mu) $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle A_j=\frac{\langle P_j,F \rangle}{\langle P_j,P_j \rangle}=\frac{2j+1}{2} \int \limits_{\mu=-1}^{\mu=+1}P_j(\mu)F(\mu)d\mu $$
 * 
 * }
 * }

The first several Legendre polynomials are:
 * {| style="width:100%" border="0" align="left"

\displaystyle P_0(\mu)=1, \, P_1(\mu)=\mu $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle P_2(\mu)=\frac{1}{2}(3\mu^2-1) $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle P_3(\mu)=\frac{1}{2}(5\mu^3-3\mu) $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle P_4(\mu)=\frac{1}{8}(35\mu^4-30\mu^2+3) $$
 * 
 * }
 * }


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

\displaystyle A_0=\frac{1}{2}\int_{-1}^11\cdot \frac{1}{1+\sin^2(\mu^2)}d\mu $$
 * 
 * }
 * }

For the equation above can't be integrated analytically, then we use GL quadrature.
 * {| style="width:100%" border="0" align="left"

\displaystyle A_0=\frac{1}{2}\cdot \sum_{j=1}^{n}w_j\cdot g(x_j) $$
 * 
 * }
 * }

Here we use three points for accuracy.
 * {| style="width:100%" border="0" align="left"

\displaystyle \left\{\begin{matrix} x_1=-\sqrt{\frac{3}{5}}&w_1=\frac{5}{9} \\ x_2=0&w_2=\frac{8}{9} \\ x_3=\sqrt{\frac{3}{5}}&w_3=\frac{5}{9} \end{matrix}\right. $$
 * 
 * }
 * }

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

\displaystyle \begin{align} A_0 &=\frac{1}{2}[w_1\cdot g(x_1)+w_2\cdot g(x_2)+w_3\cdot g(x_3)]\\ &=0.8657 \end{align} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} A_1 &=\frac{3}{2}\int_{-1}^{1}\mu \cdot \frac{1}{1+\sin^2(\mu^2)}d\mu \\ &=\frac{3}{2}\sum_{j=1}^n w_j\cdot g(x_j) \\ &=\frac{3}{2}[w_1\cdot g(x_1)+w_2\cdot g(x_2)+w_3\cdot g(x_3)]\\ &=0 \end{align} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} A_2 &=\frac{5}{2}\int_{-1}^1 P_2(\mu)F(\mu)d\mu\\ &=\frac{5}{2}\sum_{j=1}^n w_j\cdot g(x_j)\\ &=-0.2686 \end{align} $$
 * 
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} A_3 &=\frac{7}{2}\int_{-1}^1 P_3(\mu)F(\mu)d\mu\\ &=\frac{7}{2}\sum_{j=1}^n w_j\cdot g(x_j)\\ &=0 \end{align} $$
 * 
 * }
 * }

From A4, we begin to use five points for accuracy.
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} A_4 &=\frac{9}{2}\sum_{j=1}^n w_j\cdot g(x_j)\\ &=-0.0707 \end{align} $$
 * <p style="text-align:right;">
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle F(\mu)=\sum_{j=0}^{\infty} A_jP_j(\mu) $$
 * <p style="text-align:right;">
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\displaystyle f(\theta)=\sum_{j=0}^{\infty}A_jP_j(\sin\theta) $$ Plot the results(Fourier-Legendre series of function $$f(\theta)$$) using Matlab: for only one term: for three terms: for five terms: Comparing with the originally exact one: from the above results, we see that with the increase of number of terms, it shows the convergence toward the original function.
 * <p style="text-align:right;">
 * }
 * }

=Contributing Members & Referenced Lecture=

=Table of Contributions=