User:Egm6321.f09.Team1.andy/HW7

= Problem 1: Odd and Even Solutions of Legendre DE =

From Lecture Slide 37-1.

Given
From lecture slide 31-3, general expression for Legendre Polynomial is given by,


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

P_n(x) = \sum_{i=0}^{\lfloor n/2 \rfloor} \frac{1 \cdot 3 \dots \left(2n - 2i - 1\right)}{2^i i! (n-2i)!} (-1)^i x^{n-2i} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * },
 * },

and from lecture slide 37-1, the general expression for the second solution of Legendre Differential Equation is given as,


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

Q_n(x) = P_n(x) tanh^{-1}(x) - 2 \sum_{j=1,3,5...}^{J} \frac{2n-2j+1}{(2n-j+1)j} P_{n-j}(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * },
 * },

where $$\displaystyle J $$ is given by,


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

J := 1 + 2 \left\lfloor \frac{n-1}{2} \right\rfloor $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }.
 * }.

Find
Using Equation (2), to show when $$\displaystyle Q_n $$ is even and odd, depending on whether "$$\displaystyle n $$" is even or odd.

Solution
We know, from Odd and Even property of $$\displaystyle P_n $$, that $$\displaystyle P_n $$ is odd, when $$\displaystyle n $$ is odd and even, when $$\displaystyle n $$ is even and the fact that


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

tanh^{-1}(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4)
 * },
 * },

is odd.

''' (i). When $$\displaystyle n $$ is odd.'''

When $$\displaystyle n $$ is odd, $$\displaystyle P_n $$ is odd and so,


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

P_n(x)tanh^{-1}(x) $$
 * $$\displaystyle
 * $$\displaystyle
 * },
 * },

is even.


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

So, when $$\displaystyle n $$ is odd, first term in Equation (2) is even.
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

When $$\displaystyle n $$ is odd, value of $$\displaystyle n - j $$ is even since $$\displaystyle j $$ values are odd,  and so, $$\displaystyle P_{n-j} $$ is even.


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

So, when $$\displaystyle n $$ is odd, all the terms in the summation of Equation (2) are even.
 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

And so,


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

$$\displaystyle \Rightarrow $$ So, when $$\displaystyle n $$ is odd, $$\displaystyle Q_n $$ is even.
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

''' (ii). When $$\displaystyle n $$ is even.'''

When $$\displaystyle n $$ is even, $$\displaystyle P_n $$ is even and so,


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

P_n(x)tanh^{-1}(x) $$
 * $$\displaystyle
 * $$\displaystyle
 * },
 * },

is odd.


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

So, when $$\displaystyle n $$ is even, first term in Equation (2) is odd.
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

When $$\displaystyle n $$ is even, value of $$\displaystyle n - j $$ is odd since $$\displaystyle j $$ values are odd, and so, $$\displaystyle P_{n-j} $$ is odd.


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

So, when $$\displaystyle n $$ is even, all the terms in the summation of Equation (2) are odd.
 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

And so,


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

$$\displaystyle \Rightarrow $$ So, when $$\displaystyle n $$ is even, $$\displaystyle Q_n $$ is odd.
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

= Problem 2: Legendre Solutions Plot =

From Lecture Slide 37-1.

Given
From lecture slide 31-3, general expression for Legendre Polynomial is given by,


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

P_n(x) = \sum_{i=0}^{\lfloor n/2 \rfloor} \frac{1 \cdot 3 \dots \left(2n - 2i - 1\right)}{2^i i! (n-2i)!} (-1)^i x^{n-2i} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * },
 * },

and from lecture slide 37-1, the general expression for the second solution of Legendre Differential Equation is given as,


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

Q_n(x) = P_n(x) tanh^{-1}(x) - 2 \sum_{j=1,3,5...}^{J} \frac{2n-2j+1}{(2n-j+1)j} P_{n-j}(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * },
 * },

where $$\displaystyle J $$ is given by,


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

J := 1 + 2 \left\lfloor \frac{n-1}{2} \right\rfloor $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }.
 * }.

Find
Plot {$$\displaystyle P_0, P_1, P_2, P_3, P_4$$ } and {$$\displaystyle Q_0, Q_1, Q_2, Q_3, Q_4$$ } using Matlab.

Solution
Please refer Problem 6 Solution of HW6, for $$\displaystyle P_0(x),\ P_1(x),\ P_2(x),\ P_3(x),\ P_4(x) $$.

Please refer, p. 33, for expressions of $$\displaystyle Q_0(x), Q_1(x), Q_2(x), Q_3(x)$$.

The expression for $$\displaystyle Q_4(x)$$ is given by,


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

Q_4= P_4(x) tanh^{-1}(x) - 2 \sum_{j=1,3}^{} \frac{2n-2j+1}{(2n-j+1)j} P_{n-j}(x) $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.


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

\Rightarrow Q_4= \left[\frac{35}{8} x ^ 4 - \frac{15}{4} x ^ 2 + \frac{3}{8}\right] tanh^{-1}(x) - 2 \left[ \frac{2(4)-2+1}{(2(4)-1+1)1} P_{3}(x) \right] - 2 \left[ \frac{2(4)-2(3)+1}{(2(4)-3+1)3} P_{1}(x) \right] $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.


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

\Rightarrow Q_4= \left[\frac{35}{8} x ^ 4 - \frac{15}{4} x ^ 2 + \frac{3}{8}\right] tanh^{-1}(x) - \frac{7}{8} \left[ 5 x ^ 3 - 3 x\right] - \frac{1}{3} x $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

 Matlab Code: 

 Plots: 

The plots for $$\displaystyle P_n(x) $$ with $$\displaystyle n = 0,1,2,3,4 $$ are shown below:

.

The plots for $$\displaystyle Q_n(x) $$ with $$\displaystyle n = 0,1,2,3,4 $$ are shown below:

.

= Problem 3: Orthogonality of Legendre Solutions =

From Lecture Slide 37-2.

Given
From lecture slide 31-3, general expression for Legendre Polynomial is given by,


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

P_n(x) = \sum_{i=0}^{\lfloor n/2 \rfloor} \frac{1 \cdot 3 \dots \left(2n - 2i - 1\right)}{2^i i! (n-2i)!} (-1)^i x^{n-2i} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * },
 * },

and from lecture slide 37-1, the general expression for the second solution of Legendre Differential Equation is given as,


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

Q_n(x) = P_n(x) tanh^{-1}(x) - 2 \sum_{j=1,3,5...}^{J} \frac{2n-2j+1}{(2n-j+1)j} P_{n-j}(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * },
 * },

where $$\displaystyle J $$ is given by,


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

J := 1 + 2 \left\lfloor \frac{n-1}{2} \right\rfloor $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }.
 * }.

Find
Show that, $$\displaystyle < P_n, Q_n > = 0$$.

Solution
From lecture slide 33-1, the inner (scalar) product is given by,


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

 = \int_{-1}^{+1} G(x)F(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4)


 * },
 * },

and Equation (4) becomes zero, when $$\displaystyle G(x) $$ is even and $$\displaystyle F(x) $$ is odd or when $$\displaystyle G(x) $$ is odd and $$\displaystyle F(x) $$ is even.

For $$\displaystyle P_n(x) $$ and $$\displaystyle Q_n(x) $$ using Equation (4),


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

 = \int_{-1}^{+1} P_n(x)Q_n(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 5)


 * }.
 * }.

From Solution to Problem 1 above, $$\displaystyle Q_n(x) $$ is odd and $$\displaystyle P_n(x) $$ is even, when $$\displaystyle n $$ is even. When $$\displaystyle n $$ is odd, $$\displaystyle Q_n(x) $$ is even and $$\displaystyle P_n(x) $$ is odd.

So, for all values of $$\displaystyle n $$, $$\displaystyle Q_n(x) $$ is opposite to $$\displaystyle P_n(x) $$ in oddness and evenness, which means,


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

\int_{-1}^{+1} P_n(x)Q_n(x)dx = 0 $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

And so,


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

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

= Problem 4: Integration by Parts: Legendre Solutions = From lecture slide 37-3.

Given
From lecture slide 37-2,


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

\alpha = \int_{-1}^{+1} L_m \left[ (1-x^2) L'_n \right]' dx $$ $$ where $$\displaystyle L_n$$ and $$\displaystyle L_m$$ are solutions to the Legendre differential equation.
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * }
 * }

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

\alpha = -\int_{-1}^{+1} (1-x^2) L'_n L'_m dx $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 2)
 * },
 * },

after integration by parts of $$\displaystyle \alpha $$ in Equation (1).

Solution
Let,


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

u = L_m \Rightarrow du = L'_m dx $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 3)
 * },
 * },

and,


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

dv = \left[ (1-x^2) L'_n \right]' dx $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4)
 * }.
 * }.


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

\Rightarrow \int dv = \int\left[ (1-x^2) L'_n \right]' dx \Rightarrow v = \left[ (1-x^2) L'_n \right] $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

We know,


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

\int_{a}^{b} udv = \left[uv \right]_{a}^{b} - \int_{a}^{b} vdu $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 5)
 * },
 * },

and so, with $$\displaystyle a = -1 $$ and $$\displaystyle b = +1 $$


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

\alpha = \int_{-1}^1 L_m \left[ (1-x^2) L'_n \right]' dx = \left[ L_m(1-x^2) L'_n\right]_{-1}^{+1} - \int_{-1}^{+1} (1-x^2) L'_n L'_m dx $$
 * $$\displaystyle
 * $$\displaystyle

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


 * },
 * },

For values of $$\displaystyle x = -1 $$ and $$\displaystyle x = +1 $$,


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

(1-x^2) = 0 $$
 * $$\displaystyle
 * $$\displaystyle

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


 * }.
 * }.

Substituting Equation (7) in first term of Equation (6), first term becomes zero.


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

\alpha = \cancelto{0}{\left[ L_m(1-x^2) L'_n\right]_{-1}^{+1}} - \int_{-1}^{+1} (1-x^2) L'_n L'_m dx $$
 * $$\displaystyle
 * $$\displaystyle


 * }.
 * }.

So,


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

$$\displaystyle \alpha = - \int_{-1}^{+1} (1-x^2) L'_n L'_m dx $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }.
 * }.

= Problem 5: Attraction of Spheres = From lecture slide 38-2.

Given
From lecture slide 38-2,


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

(r_{PQ})^2 = \sum_{i=1}^{3} \left(x_Q^i - x_P^i\right)^2 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 1)
 * },
 * },

where,

$$\displaystyle x_P^1 = x_P,\ x_P^2 = y_P,\ x_P^3 = z_P,\ $$

and,

$$\displaystyle x_Q^1 = x_Q,\ x_Q^2 = y_Q,\ x_Q^3 = z_Q,\ $$

given by,


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

x_P = r_P cos(\theta_P) cos(\psi_P);\ y_P = r_P cos(\theta_P) sin(\psi_P);\ z_P = r_P sin(\theta_P) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 2)
 * },
 * },

and,


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

x_Q = r_Q cos(\theta_Q) cos(\psi_Q);\ y_Q = r_Q cos(\theta_Q) sin(\psi_Q);\ z_Q = r_Q sin(\theta_Q) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 3)
 * }.
 * }.

Find
Show that,


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

(r_{PQ})^2 = (r_P)^2 + (r_Q)^2 - 2 (r_P) (r_Q) cos\gamma $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 4)
 * },
 * },

where,


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

cos\gamma = cos(\theta_Q) cos(\theta_P) cos(\psi_Q-\psi_P) + sin(\theta_Q)sin(\theta_P) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 5)
 * }
 * }

Solution
Equation (1) can be written as,


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

(r_{PQ})^2 = \left(x_Q - x_P\right)^2 + \left(y_Q - y_P\right)^2 + \left(z_Q - z_P\right)^2 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (Eq. 6)
 * }.
 * }.

Substituting Equations (2) and (3) in (6),


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

\begin{align} \Rightarrow (r_{PQ})^2 = & \left[r_Q cos(\theta_Q) cos(\psi_Q) - r_P cos(\theta_P) cos(\psi_P)\right]^2 + \\ & \left[r_Q cos(\theta_Q) sin(\psi_Q) - r_P cos(\theta_P) sin(\psi_P)\right]^2 + \\ & \left[r_Q sin(\theta_Q) - r_P sin(\theta_P)\right]^2 \end{align} $$
 * $$\displaystyle
 * $$\displaystyle


 * }.
 * }.


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

\begin{align} \Rightarrow (r_{PQ})^2 = & \left[r_Q^2 cos^2(\theta_Q) cos^2(\psi_Q) + r_P^2 cos^2(\theta_P) cos^2(\psi_P) - 2 r_P r_Q cos(\theta_Q) cos(\psi_Q) cos(\theta_P) cos(\psi_P) \right] + \\ & \left[r_Q^2 cos^2(\theta_Q) sin^2(\psi_Q) + r_P^2 cos^2(\theta_P) sin^2(\psi_P) - 2 r_P r_Q cos(\theta_Q) sin(\psi_Q) cos(\theta_P) sin(\psi_P)\right] + \\ & \left[r_Q^2 sin^2(\theta_Q) + r_P^2 sin^2(\theta_P) - 2 r_P r_Q sin(\theta_Q) sin(\theta_P)\right] \end{align} $$
 * $$\displaystyle
 * $$\displaystyle


 * }.
 * }.


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

\begin{align} \Rightarrow (r_{PQ})^2 = &\ r_Q^2 cos^2(\theta_Q) \cancelto{1}{\left[ cos^2(\psi_Q) + sin^2(\psi_Q) \right]} + r_Q^2 sin^2(\theta_Q) -  2 r_P r_Q cos(\theta_Q) cos(\theta_P) \left [cos(\psi_Q) cos(\psi_P) \right] + \\ &\ r_P^2 cos^2(\theta_P) \cancelto{1}{\left[ cos^2(\psi_P) + sin^2(\psi_P) \right]} + r_P^2 sin^2(\theta_P) - 2 r_P r_Q cos(\theta_Q)cos(\theta_P) \left [sin(\psi_Q) sin(\psi_P)\right] - 2 r_P r_Q sin(\theta_Q) sin(\theta_P)
 * $$\displaystyle
 * $$\displaystyle

\end{align} $$


 * }.
 * }.


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

\begin{align} \Rightarrow (r_{PQ})^2 = &\ r_Q^2 \cancelto{1}{\left[cos^2(\theta_Q) + sin^2(\theta_Q) \right]} -  2 r_P r_Q cos(\theta_Q) cos(\theta_P) \underbrace{\left [cos(\psi_Q) cos(\psi_P) + sin(\psi_Q) sin(\psi_P)\right]}_{=\ cos(\psi_Q-\psi_P)} + \\ &\ r_P^2 \cancelto{1}{\left[ cos^2(\theta_P) + sin^2(\theta_P) \right]} - 2 r_P r_Q sin(\theta_Q) sin(\theta_P)
 * $$\displaystyle
 * $$\displaystyle

\end{align} $$


 * }.
 * }.


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

\begin{align} \Rightarrow (r_{PQ})^2 = &\ r_Q^2 + r_P^2 -  2 r_P r_Q \left[\underbrace{cos(\theta_Q) cos(\theta_P) {cos(\psi_Q-\psi_P)} + sin(\theta_Q)sin(\theta_P)}_{=\ cos\gamma} \right]
 * $$\displaystyle
 * $$\displaystyle

\end{align} $$


 * }
 * }

And so,


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

$$\displaystyle (r_{PQ})^2 = (r_P)^2 + (r_Q)^2 - 2 (r_P) (r_Q) cos\gamma $$
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style="width:10%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * }.
 * }.

= Notes and References =