User:Egm6321.f10.team3.franklin/Hwk6

= Problem 3 =

Given
For $$q(x)=\sum_{i=0}^4c_ix^i$$ where $$c_0=2,\ c_1=-5,\ c_2=-3,\ c_3=11,\ c_4=7,\ c_5=6$$

Find
1. Find $$\displaystyle a_i$$ such that $$q=\sum_{i=0}^4a_iP_i .$$

2. Plot $$\displaystyle q=\sum_ic_ix^i$$ and $$\displaystyle q=\sum_ia_iP_i .$$

Solution
$$q(x)=\sum_{i=0}^5c_ix^i$$ can be shown as a column matrix

$$\begin{bmatrix} c_0x^0\\c_1x^1\\c_2x^2\\c_3x^3\\c_4x^4\\c_5x^5 \end{bmatrix}=\begin{bmatrix} 2x^0\\-5x^1\\-3x^2\\11x^3\\7x^4\\6x^5 \end{bmatrix}$$

Next, evaluate $$q(x)=\sum_{i=0}^5a_iP_i$$

$$q(x)=\sum_{i=0}^5a_iP_i=\begin{bmatrix} a_0&a_1&a_2&a_3&a_4&a_5 \end{bmatrix}\begin{bmatrix} P_0\\P_1\\P_2\\P_3\\P_4\\P_5 \end{bmatrix}$$

Setting $$q(x)=\sum_{i=0}^5a_iP_i(x)=\sum_{i=0}^5c_ix^i $$ yields

$$\begin{bmatrix} a_0&a_1&a_2&a_3&a_4&a_5 \end{bmatrix}\begin{bmatrix} P_0\\P_1\\P_2\\P_3\\P_4\\P_5 \end{bmatrix}=\begin{bmatrix} 2x^0\\-5x^1\\-3x^2\\11x^3\\7x^4\\6x^5 \end{bmatrix}$$

From above, we see that

$$a_0P_0=2x^0 \Rightarrow a_0={2/P_0}$$

$$a_1P_1=-5x^1 \Rightarrow a_1={-5x/P_1}$$

$$a_2P_1=-3x^2 \Rightarrow a_2={-3x^2/P_2}$$

$$a_3P_3=11x^3 \Rightarrow a_3={11x^3/P_3}$$

$$a_4P_4=7x^4 \Rightarrow a_4={7x^4/P_4}$$

$$a_5P_5=6x^5 \Rightarrow a_4={6x^4/P_5}$$

Where,

$$\displaystyle P_0(x)=1$$

$$\displaystyle P_1(x)=x$$

$$\displaystyle P_2(x)=1/2(3x^2-1)$$

$$\displaystyle P_3(x)=1/2(5x^3-3x)$$

$$\displaystyle P_4(x)=1/8(35x^4-30x^2+3)$$

$$\displaystyle P_5(x)=1/8(63x^5-70x^3+15)$$

Which gives

$$\displaystyle a_0=2$$

$$\displaystyle a_1={-5x\over x}$$

$$\displaystyle a_2={-3x^2\over 1/2(3x^2-1)}$$

$$\displaystyle a_3={11x^3\over 1/2(5x^3-3x)}$$

$$\displaystyle a_4={7x^4\over 1/8(35x^4-30x^2+3)}$$

$$\displaystyle a_5={6x^4\over 1/8(63x^5-70x^3+15)}$$

Which reduces to

 $$\displaystyle a_0=2$$

$$\displaystyle a_1=-5$$

$$\displaystyle a_2={-2\over (3x^2-1)}-2$$

$$\displaystyle a_3={66\over 5(5x^3-3x)}+22/5$$

$$\displaystyle a_4={24(10x^2-1)\over 5(35x^4-30x^2+3)}+8/5$$

$$\displaystyle a_5={80(14x^3-3)\over 21(63x^5-70x^3+15)}+16/21$$

The plots of $$\displaystyle q=\sum_ic_ix^i$$ and $$\displaystyle q=\sum_ia_iP_i$$ are showed below.

Contributing Members

 * Solved and posted by Egm6321.f10.team3.franklin 16:57, 5 December 2010 (UTC)

= Problem 4 Legendre Polynomials' Orthogonality =

Given
Consider the boundary condition
 * {| style="width:100%" border="0" align="left"

a)f(\theta) = T_0 \cos^6 \theta $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.1.a)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

b)f(\theta) = T_0 \exp{\left(-\left(\frac{2\theta}{\pi}\right)^2\right)} $$ $$ where
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.1.b)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

a)f(\mu) = T_0 \left(1 - \mu^2\right)^3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.2.a)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

b)f(\mu) = T_0 \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)} $$ $$ is even, and
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.2.b)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mu = \sin \theta. $$ $$ $$\displaystyle A_n $$ is
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

A_n = \frac{2n + 1}{2}  $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.4)
 * }
 * }

1.
Without calculation, find property of $$\displaystyle A_n$$, i.e.
 * {| style="width:100%" border="0" align="left"

A_{2k} \stackrel{?}{=} 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.5.a)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

A_{2k+1} \stackrel{?}{=} 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4.5.b)
 * }
 * }

2.
Compute 3 non-zero coefficients of $$\displaystyle A_n .$$

Solution for 1.
The scalar product of $$\displaystyle f $$ and $$\displaystyle P_n $$ is
 * {| style="width:100%" border="0" align="left"

 = \int_{-1}^1 f(\mu) P_n(\mu) \, {\rm d}\mu $$ $$ We can split the integral up in two intervals
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4a.6)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

 = \int_{-1}^0 f(\mu) P_n(\mu) \, {\rm d}\mu + \int_{0}^1 f(\mu) P_n(\mu) \, {\rm d}\mu $$ $$ When $$\displaystyle n$$ is odd, so is $$\displaystyle P_n$$, and $$\displaystyle f(\mu)$$ is $$\displaystyle even$$. Hence, when $$\displaystyle n$$ is odd, we have that $$\displaystyle n = 2k + 1$$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4a.7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

 = \int_{-1}^0 f(-\mu) (-P_{2k+1}(-\mu)) \, {\rm d}\mu + \int_{0}^1 f(\mu) P_{2k+1}(\mu) \, {\rm d}\mu $$ $$ We can substitute $$\displaystyle \xi = -\mu$$ in the first integral so that
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4a.8)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<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
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.9)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

<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 $$ $$ Hence
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle A_{2k+1} = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.11)
 * }
 * }

Part a.
The expression for $$\displaystyle A_n $$ is given by,


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

\begin{align} A_n & = \frac{2n+1}{2} \int_{-\pi/2}^{\pi/2} f(\theta)P_n(\sin\theta)d(\sin\theta) \\ & = \frac{2n+1}{2} \int_{-1}^{1} f(\mu)P_n(\mu)d\mu \\ \end{align} $$
 * $$\displaystyle
 * $$\displaystyle


 * }.
 * }.

where $$\displaystyle \mu = \sin\theta $$ and $$\displaystyle f(\mu) = T_0 \left(1-\mu^2\right)^3 $$.

$$\displaystyle A_n = 0 $$ for odd values of $$\displaystyle n $$.

n=0
When $$\displaystyle n = 0 $$, we know $$\displaystyle P_n(\mu) = 1 $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_0 = \frac{2(0)+1}{2} \int_{-1}^{1} T_0 \left(1-\mu^2\right)^3 d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.12)


 * }.
 * }.

Using definite integrals in Matlab, we get,


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1}\left(1-\mu^2\right)^3 d\mu = \left[ \frac{5\pi}{16} \right]

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.13)


 * }.
 * }.

Substituting equation Eq(4a.13) in Eq(4a.12),


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


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_0 = \frac{T_0}{2}\left[ \frac{5\pi}{16} \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_0 = T_0\left(\frac{5\pi}{32}\right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.14)
 * }.
 * }.

n=2
When $$\displaystyle n = 2 $$, we know $$\displaystyle P_n(\mu) = \frac{1}{2} (3

\mu^2 - 1) $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_2 = \frac{2(2)+1}{2} \int_{-1}^{1} T_0 \left(1-\mu^2\right)^3 \left[\frac{1}{2} (3\mu^2 - 1) \right]d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.15)


 * }.
 * }.

Using definite integrals in Matlab, we get,


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \left(1-\mu^2\right)^3\left[\frac{1}{2} (3\mu^2 - 1) \right] d\mu = \left[ \frac{-25\pi}{256} \right]

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.16)


 * }.
 * }.

Substituting equation Eq(4a.16) into Eq(4a.15),


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


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_2 = \frac{5T_0}{2} \left[ \frac{-25\pi}{256} \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_2 = T_0\left(\frac{-125\pi}{512}\right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.17)
 * }.
 * }.

n=4
When $$\displaystyle n = 4 $$, we know $$\displaystyle P_n(\mu) = \frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right) $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_4 = \frac{2(2)+1}{2} \int_{-1}^{1} T_0 \left(1-\mu^2\right)^3 \left(\frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right)\right)d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.18)


 * }.
 * }.

Using definite integrals in Matlab, we get


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \left(1-\mu^2\right)^3 \left(\frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right)\right)d\mu = \left[ \frac{45\pi}{2048} \right]

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.19)


 * }.
 * }.

Substituting equation Eq(4a.19) in Eq(4a.18),


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


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_4 = \frac{9T_0}{2} \left[ \frac{45\pi}{2048} \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_4 = T_0 \left(\frac{405\pi}{4096}\right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 4a.20)
 * }.
 * }.

Part b.
The expression for $$\displaystyle A_n $$ is given by,


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

\begin{align} A_n & = \frac{2n+1}{2} \int_{-\pi/2}^{\pi/2} f(\theta)P_n(\sin\theta)d(\sin\theta) \\ & = \frac{2n+1}{2} \int_{-1}^{1} f(\mu)P_n(\mu)d\mu \\ \end{align} $$
 * $$\displaystyle
 * $$\displaystyle


 * }.
 * }.

where $$\displaystyle \mu = \sin\theta $$ and $$\displaystyle f(\mu) = T_0 \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)}$$.

$$\displaystyle A_n = 0 $$ for odd values of $$\displaystyle n $$.

n=0
When $$\displaystyle n = 0 $$, we know $$\displaystyle P_n(\mu) = 1 $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_0 = \frac{2(0)+1}{2} \int_{-1}^{1} T_0 \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)} d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4b.12)


 * }.
 * }.

Using definite integrals in Matlab, we get,


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1}\exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)} d\mu = \left[ \frac{\pi^{\frac{3}{2}} erf\left(1\right)}{2} \right] , $$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 4b.13)
 * }
 * }

where $$\displaystyle erf\left(x\right) $$ is
 * {| style="width:100%" border="0" align="left"

erf\left(x\right) = \frac{2}{\sqrt{\pi}}\int_{-1}^{x} \left(\exp{-t^2}\right) dt $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4b.13.a)
 * }
 * }

Substituting equation Eq(4b.13) in Eq(4b.12),
 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_0 = \frac{T_0}{2}\left[ \frac{\pi^{\frac{3}{2}} erf\left(1\right)}{2} \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_0 = T_0\left( \frac{\pi^{\frac{3}{2}} erf\left(1\right)}{4} \right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 4b.14)
 * }.
 * }.

n=2
When $$\displaystyle n = 2 $$, we know $$\displaystyle P_n(\mu) = \frac{1}{2} (3

\mu^2 - 1) $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_2 = \frac{2(2)+1}{2} \int_{-1}^{1} T_0 \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)} \left(\frac{1}{2} (3\mu^2 - 1) \right)d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 15)


 * }.
 * }.

Matlab does not return and analytical solution for the above definite integral. Evaluating the integral in Wolfram Alpha returns


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)}\left(\frac{1}{2} (3\mu^2 - 1) \right) d\mu = \left[ \right]

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 16)


 * }.
 * }.

Substituting equation (16) in (15),


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


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_2 = \frac{5T_0}{2} \left[  \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_2 = T_0\left( \right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 17)
 * }.
 * }.

n=4
When $$\displaystyle n = 4 $$, we know $$\displaystyle P_n(\mu) = \frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right) $$ and so,


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


 * $$\displaystyle
 * $$\displaystyle

A_4 = \frac{2(2)+1}{2} \int_{-1}^{1} T_0 \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)} \left(\frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right)\right)d\mu

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 18)


 * }.
 * }.

Using definite integrals in Matlab, we get


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


 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \exp{\left(-\left(\frac{2\arcsin{\mu}}{\pi}\right)^2\right)}\left(\frac{1}{8}\left(35\mu^4 - 30\mu^2 + 3\right)\right)d\mu = \left[ \right]

$$ $$
 * <p style="text-align:right;">$$\displaystyle (Eq. 19)


 * }.
 * }.

Substituting equation (19) in (18),


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


 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_4 = \frac{9T_0}{2} \left[  \right]

$$
 * }.
 * }.


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

$$\displaystyle
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |

\Rightarrow A_4 = T_0 \left( \right)

$$ $$
 * style= |
 * <p style="text-align:right;">$$\displaystyle (Eq. 20)
 * }.
 * }.

Contributing Members

 * Solved and posted by Egm6321.f10.team3.franklin 16:57, 5 December 2010 (UTC)