User:Egm6322.s12.team1.zheng.zx/R11

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} $$
 * }
 * }
 * }
 * {| 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 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.
 * }
 * }
 * }