User:EGM6321.f10.team6.cook/hw7

= Problem 1 - Plot Legendre Functions for $$n=0,1,2 \text{ and } 3$$ =

Plot the Legendre polynomials and functions together, namely

Also plot the Legendre polynomials with the function for each $$n$$.

Observe $$P_n(\mu)$$ and $$Q_n(\mu)$$ as $$\scriptstyle \mu \rightarrow \pm 1$$ and observe the even and oddness.

Guess the value of

Legendre polynomials
$$\begin{align} & {{P}_{0}}(x)=1 \\ & {{P}_{1}}(x)=x \\ & {{P}_{2}}(x)=\frac{1}{2}(3{{x}^{2}}-1) \\ & {{P}_{3}}(x)=\frac{1}{2}(5{{x}^{3}}-3x) \\ \end{align}$$

Associated Legendre functions
$$\begin{align} & {{Q}_{0}}(x)=\frac{1}{2}\log \left( \frac{1+x}{1-x} \right) \\ & {{Q}_{1}}(x)=\frac{1}{2}x\log \left( \frac{1+x}{1-x} \right)-1 \\ & {{Q}_{2}}(x)=\frac{1}{4}(3{{x}^{2}}-1)\log \left( \frac{1+x}{1-x} \right)-\frac{3}{2}x \\ & {{Q}_{3}}(x)=\frac{1}{4}(5{{x}^{3}}-3x)\log \left( \frac{1+x}{1-x} \right)-\frac{5}{2}{{x}^{2}}+\frac{2}{3} \\ \end{align}$$

Legendre Function Plots
The solutions are plotted below. Note that if $$P_n(x)$$ is even $$Q_n(x)$$ is odd, and vice versa.



$$n=16$$
A higher order set is shown where Runge's phenomenon can be seen at the edges.



Observations
For $$\scriptstyle x \rightarrow \pm 1$$, $$P_n(x)\text{ and }Q_n(x)$$ both have the steepest slopes in the domain (-1 1).

For $$n$$ being even, $$P_n(x)$$ is even while $$Q_n(x)$$ is odd;

For $$n$$ being odd, $$P_n(x)$$ is odd while $$Q_n(x)$$ is even;

The integral is thus guessed to have a zero value,

as the product of an even and odd function will be odd, with a symmetric integral having zero value.

MATLAB Script
The following MATLAB script was used to generate and plot $$P_n(x),Q_n(x)$$. The plots were exported as an EPS file format and then converted to PNG using GIMP.

The expression for $$P_n(x)$$ was taken from Lecture 36 page 2 and $$Q_n(x)$$ was taken from  Lecture 39, page 1.

= Problem 2 - Show the Character of Even and Odd Functions =

From class note lecture 38_1

Problem Statement
Let

Required
Show that: 1. if the $$ \begin{align} \{g_i\} \end{align}$$ is odd, then $$ \begin{align} f \end{align}$$ is odd.

2. if the $$ \begin{align} \{g_i\} \end{align}$$ is even, then $$ \begin{align} f \end{align}$$ is even.

==Solution ==

1. The definition of an odd function is that $$\begin{align} f(x) = -f(-x) \end{align}$$.

If $$\begin{align}\sum_{i=0}^{n} g_i(x)\end{align}$$ is odd function,

 Odd functions, $$\begin{align} y = x^{2n+1}\end{align}$$

$$\begin{align} y= sin (nx) \end{align}$$

2. The definition of an even function is that $$\displaystyle f(x) = f(-x)$$.

If $$\begin{align}\sum_{i=0}^{n} g_i(x)\end{align}$$ is even function,  Even functions, $$\begin{align} y = x^{2n}\end{align}$$

$$\begin{align} y= cos (nx) \end{align}$$

Problem Statement
A solution to the Legendre equation may be written as :

Required
1. Determine if equation 3.1 is even or odd.

2. Find {a} such that the following two relations are equal for i=0 to 5.

Part 1
A function is considered to be even if it satisfies equation 3.2 and odd if it satisfies equation 3.3.

These conditions are essentially restrictions on the symmetry of a function. If a function is symmetric about the y-axis it will be even and if it is symmetric about the origin. Consider the sine and cosine.

It can be seen in equation 3.4 and 3.5 that the cosine and sine are even and odd functions, respectively.

In order to determine if equation 3.1 is even or odd we will apply the same test. Let us re-examine equation 3.1 to see if it can be simplified before we apply the test.

Most of the quantities in the equation are always positive, so they will have no impact on the evenness or oddness of the function. As a result we will neglect these terms and reduce the equation to the following:

Now, if we examine the argument we see that the quantity 2i is always an even number:

Recall that an even number subtracted from an even number always results in an even number, and an even number subtracted from an odd number always results in an odd number. Therefore, two cases that must be considered, namely when n is even and when n is odd. First let us examine when n is even:

We can see in equation 3.9 that if n is even that the sign of the argument will always be positive. Therefore, for n=even the Legendre polynomials of the first kind are even functions.

Now consider when n is odd:

It is clear in equation 3.10 that for n=odd the Legendre polynomials of the first kind are odd.

So, for n=even the Legendre polynomials are even and for n=odd the Legendre polynomials are odd.

Part 2
First let us write the terms for both sides of the equation.

Substituting in the functions for the Legendre polynomials we obtain:

We can now simplify and equate terms of like power in x to obtain the following equations:

This is a linear system of equations so we can solve for the values of $${{a}_{i}}$$ in many different ways, but for simplicity let’s rewrite equation 3.13 in matrix format:

Rewriting equation 3.14 as an augmented matrix we have:

We obtain the solution by putting the matrix in reduced row echelon form:

Substituting the following values:

This yields:

Given
Boundary condition

$$\begin{align} & (a)\text{ }\psi (r=1,\theta )=f(\theta )={{T}_{0}}{{\cos }^{6}}\theta  \\ & (b)\text{ }\psi (r=1,\theta )=f(\theta )={{T}_{0}}\exp \left( -\frac{4{{\theta }^{2}}} \right) \\ \end{align}$$

and expression of An

$${{A}_{n}}=\frac{2n+1}{2}$$

Find
(1) Properties of An, i.e.

$$\begin{align} & {{A}_{2k}}=0\text{ }? \\ & {{A}_{2k+1}}=0\text{  }? \\ & for\text{  }k=0,1,2,... \\ \end{align}$$

(2) Calculate non-zero

$$\left\{ {{A}_{n}} \right\}$$

(a).(1)
Define $$\begin{align}x=\sin \theta \end{align}$$

Then $$f(x)={{T}_{0}}{{(1-{{x}^{2}})}^{3}}$$ and it is a even function

We know Legendre polynomial $${{P}_{n}}$$ is even with even n and odd with odd n

Hence, for n=2k+1, k=0,1,2,...

$$\begin{align}=0\end{align}$$, i.e.,

$$\begin{align}{{A}_{2k+1}}=0\end{align}$$

Since

$$f(x)\in {{\Pi }_{6}}$$,a set of polynomials with order less than 6

and the linear independence of Legendre polynomials, we have

$$\begin{align} & {{P}_{n}}\bot f\text{ }for\text{  }n\ge 7,\text{  }i.e., \\ & =0 \\ & so\text{ } \\ & {{A}_{n}}=0,\text{ }for\text{  }n\ge 7 \\ \end{align}$$

Based on that, only $$\begin{align} {A}_{0}, {A}_{2}, {A}_{4} \end{align} $$ and $$\begin{align} {A}_{6} \end{align}$$ are non-zero.

(a).(2)
We know that

$$\begin{align} & {{P}_{0}}(x)=1 \\ & {{P}_{2}}(x)=\frac{3}{2}{{x}^{2}}-\frac{1}{2} \\ & {{P}_{4}}(x)=\frac{35}{8}{{x}^{4}}-\frac{15}{4}{{x}^{2}}+\frac{3}{8} \\ & {{P}_{6}}(x)=\frac{231}{16}{{x}^{6}}-\frac{315}{16}{{x}^{4}}+\frac{105}{16}{{x}^{2}}-\frac{5}{16} \\ & \\ \end{align}$$

Then

$${{A}_{n}}=\frac{2n+1}{2}=\frac{2n+1}{2}\int_{-1}^{1}{f(x){{P}_{n}}(x)dx}$$

So $$\begin{align} & {{A}_{0}}=\frac{1}{2}=\frac{1}{2}\int_{-1}^{1}{{{T}_{0}}{{(1-{{x}^{2}})}^{3}}dx} \\ & {{A}_{2}}=\frac{5}{2}=\frac{5}{2}\int_{-1}^{1}{{{T}_{0}}{{(1-{{x}^{2}})}^{3}}\left( \frac{3}{2}{{x}^{2}}-\frac{1}{2} \right)dx} \\ & {{A}_{4}}=\frac{9}{2}=\frac{9}{2}\int_{-1}^{1}{{{T}_{0}}{{(1-{{x}^{2}})}^{3}}\left( \frac{35}{8}{{x}^{4}}-\frac{15}{4}{{x}^{2}}+\frac{3}{8} \right)dx} \\ & {{A}_{6}}=\frac{13}{2}=\frac{13}{2}\int_{-1}^{1}{{{T}_{0}}{{(1-{{x}^{2}})}^{3}}\left( \frac{231}{16}{{x}^{6}}-\frac{315}{16}{{x}^{4}}+\frac{105}{16}{{x}^{2}}-\frac{5}{16} \right)dx} \\ \end{align}$$

Evaluating the above definite integrals via Matlab, we may get

$$\begin{align} & {{A}_{0}}=\frac{16}{35}{{T}_{0}} \\ & {{A}_{2}}=-\frac{16}{21}{{T}_{0}} \\ & {{A}_{4}}=\frac{144}{385}{{T}_{0}} \\ & {{A}_{6}}=-\frac{16}{231}{{T}_{0}} \\ & \\ \end{align}$$

(b).(1)
Define $$\begin{align}x=\theta \end{align}$$

then $$f(x)={{T}_{0}}\exp \left( -\frac{4{{x}^{2}}} \right)$$

and

$$\begin{align} & \mu =\sin \theta =\sin x \\ & {{P}_{n}}(\mu )={{P}_{n}}(\sin x) \\ \end{align}$$

Note that $$\begin{align}f(x)\end{align}$$ is an even function, along with the properties of $$\begin{align}{{P}_{n}}(\sin x)\end{align}$$, we have that

$$\begin{align} & =0 \\ & i.e.,\text{ }{{A}_{2k+1}}=0 \\ \end{align}$$

for k=0,1,2,...

Since $$\begin{align}f(x)\end{align}$$ is not any kind of polynomials,

$$\begin{align} & \ne 0 \\ & so \\ & {{A}_{2k}}\text{ }exist\text{  }for\text{  }k=0,1,2,... \\ \end{align}$$

(b).(2)
We have

$${{A}_{n}}=\frac{2n+1}{2}=\frac{2n+1}{2}\int_{-\pi /2}^{\pi /2}{f(x){{P}_{n}}(\sin x)dx}$$

Given

$$f(x)={{T}_{0}}\exp \left( -\frac{4{{x}^{2}}} \right)$$

and

$$\begin{align} & {{P}_{0}}(\sin x)=1 \\ & {{P}_{2}}(\sin x)=3/2{{\left( \sin \left( x \right) \right)}^{2}}-1/2 \\ & {{P}_{4}}(\sin x)=\frac{35}{8}{{\left( \sin \left( x \right) \right)}^{4}}-\frac{15}{4}{{\left( \sin \left( x \right) \right)}^{2}}+3/8 \\ & {{P}_{6}}(\sin x)=\frac{231}{16}{{\left( \sin \left( x \right) \right)}^{6}}-\frac{315}{16}{{\left( \sin \left( x \right) \right)}^{4}}+\frac{105}{16}{{\left( \sin \left( x \right) \right)}^{2}}-\frac{5}{16} \\ \end{align}$$

Evaluating the above definite integrals via Matlab, we may get

$$\begin{align} & {{A}_{0}}=1.1731086046{{T}_{0}} \\ & {{A}_{2}}=0.6393928815{{T}_{0}} \\ & {{A}_{4}}=0.7149018027{{T}_{0}} \\ & {{A}_{6}}=0.7261792127{{T}_{0}} \\ \end{align}$$

Note that we only calculated $$\begin{align}{{A}_{0}}\to {{A}_{6}}\end{align}$$ for demonstration.

As stated in (b).(1) that $$\begin{align}{{A}_{2k}}\text{ }exist\text{  }for\text{  }k=0,1,2,...\end{align}$$

=Problem 5 - Derivation of Inverse hyperbolic tangent function=

Given
hyperbolic tangent function

$$\tanh (x)=\frac{{{e}^{x}}-{{e}^{-x}}}{{{e}^{x}}+{{e}^{-x}}}$$

Find
Inverse hyperbolic tangent function as

$${{\tanh }^{-1}}(x)=\frac{1}{2}\log \left( \frac{1+x}{1-x} \right)$$

Solution
Give $$\tanh (x)=\frac{{{e}^{x}}-{{e}^{-x}}}{{{e}^{x}}+{{e}^{-x}}}$$

Consider

$$\tanh (\log (x))=\frac{{{e}^{\log x}}-{{e}^{-\log x}}}{{{e}^{\log x}}+{{e}^{-\log x}}}=\frac{x-\frac{1}{x}}{x+\frac{1}{x}}=\frac{{{x}^{2}}-1}{{{x}^{2}}+1}$$

and it follows that

$$\begin{align} & \tanh \left[ \frac{1}{2}\log \left( \frac{1+x}{1-x} \right) \right]=\tanh \left[ \log \sqrt{\frac{1+x}{1-x}} \right]=\frac{{{\left( \sqrt{\frac{1+x}{1-x}} \right)}^{2}}-1}{{{\left( \sqrt{\frac{1+x}{1-x}} \right)}^{2}}+1} \\ & =\frac{\frac{1+x}{1-x}-1}{\frac{1+x}{1-x}+1}=\frac{(1+x)-(1-x)}{(1+x)+(1-x)}=\frac{2x}{2}=x \\ \end{align}$$

Therefore

$${{\tanh }^{-1}}(x)=\frac{1}{2}\log \left( \frac{1+x}{1-x} \right)$$

Given
$$\begin{align} & {{P}_{n}}(x)=\sum\limits_{i=0}^{[n/2]}{{{(-1)}^{i}}\frac{(2n-2i)!{{x}^{n-2i}}}{{{2}^{n}}i!(n-i)!(n-2i)!}}\text{                                           (1)} \\ & {{Q}_{n}}(x)={{P}_{n}}(x){{\tanh }^{-1}}(x)-2\sum\limits_{j=1,3,5}^{J}{\frac{2n-2j+1}{(2n-j+1)j}}{{P}_{n-j}}(x)\text{                   (2)} \\ & J:=1+2\left[ \frac{n-1}{2} \right]\text{                                                                          (3)} \\ \end{align}$$

Find
Even-ness and odd-ness of Qn(x) depending on n

Solution
We know that $${{P}_{n}}(x)$$ is even when n is even (n=2k, k=0,1,2,...), and $${{P}_{n}}(x)$$ is odd when n is odd (n=2k+1, k=0,1,2,....)

Also note that $${{\tanh }^{-1}}(x)$$ is an odd function, because

$$\begin{align} & {{\tanh }^{-1}}(x)=\frac{1}{2}\log \left( \frac{1+x}{1-x} \right) \\ & {{\tanh }^{-1}}(-x)=\frac{1}{2}\log \left( \frac{1-x}{1+x} \right) \\ & =-\frac{1}{2}\log \left( \frac{1+x}{1-x} \right)=-{{\tanh }^{-1}}(x) \\ \end{align}$$

(1) Consider when n is odd, then

$${{P}_{n}}(x)\text{ }is\text{  }odd,\text{  }so\text{  }{{P}_{n}}(x){{\tanh }^{-1}}(x)\text{  }is\text{  }even$$,

n is odd and J is odd ---> n-j is even and $${{P}_{n-j}}(x)\text{ }is\text{  }even$$

Therefore, equation (2) is sum of even functions ---> $${{Q}_{n}}(x)$$ is even.

(2) Consider when n is even, then

$${{P}_{n}}(x)\text{ }is\text{  even},\text{  }so\text{  }{{P}_{n}}(x){{\tanh }^{-1}}(x)\text{  }is\text{  odd}$$,

n is even and J is odd ---> n-j is odd and $${{P}_{n-j}}(x)\text{ }is\text{  }odd$$

Therefore, equation (2) is sum of odd functions ---> $${{Q}_{n}}(x)$$ is odd.

Conclusion

(1) for n=2k, k=0,1,2,... $${{P}_{n}}(x)$$ is even and $${{Q}_{n}}(x)$$ is odd;

(2) for n=2k+1, k=0,1,2,... $${{P}_{n}}(x)$$ is odd and $${{Q}_{n}}(x)$$ is even.

Problem Statement
In the problem that formed the basis of the Legendre equation the distance between the centers of two attracting spheres was used to define the Newtonian Potential. The square of the distance between points is given as :

Required
Show equation 7.1.

Solution
First, recall that both points P and Q can be represented in both Cartesian and spherical coordinates:

Or putting equations 7.2 and 7.3 in a form that is more compatible with equation 7.1 (note: this is for the astronomical convention as specified in lecture):

To make the solution more tractable we will examine each component of the summation in equation 7.1:

Now the second term:

Finally the third term:

Now, if we combine all terms we obtain the following:

Equation 7.8 is relatively confusing so we will split it up again and examine terms independently. First we examine all terms with a common $$r_{Q}^{2}$$:

Now we will do the same for terms with $$r_{P}^{2}$$:

Now for the remaining terms:

Combining all simplified terms we obtain:

Which can be rearranged to the following form:

Problem Statement
The binomial theorem describes the algebraic expansion of powers of binomials. It can be represented generally as: :

Required
Derive the following variant of the binomial theorem:

Solution
First, let us re-examine equation 8.2 and consider the relation of the various terms with respect to the generalized binomial theorem in equation 8.1:

From equation we can clearly see the values to be used in equation 8.1, which are as follows:

We will now insert the above values back into equation 8.1, temporarily ignoring r choose k, and simplify a little:

Now since we want $${{x}^{i}}$$ and not $${{\left( -x \right)}^{i}}$$ so let’s factor out $${{\left( -1 \right)}^{i}}$$:

Now we turn our attention to r choose k:

Now, since there are i terms in the equation we must multiply by a factor of $${{\left( -2 \right)}^{i}}$$ in order to obtain a form similar to that given in equation 8.2:

We now recombine r choose k in equation 8.8 with the result of equation 8.6:

We now rearrange terms and cancel to obtain:

Now let’s expand the denominator to see how we can obtain the original equation:

Since there are i terms in the factorial and 2 is to the ith power we can push $${{2}^{i}}$$ into the factorial to obtain:

This is identical to 8.2.

Given
Reccurence relation of Legendre polynomials:

Legendre polynomials for $$n=0,1$$:

Find
Generate $$\scriptstyle \left\{ {{P}_{2}},{{P}_{3}},{{P}_{4}},{{P}_{5}},{{P}_{6}} \right\}$$ using recurrence relation starting from $$\scriptstyle {{P}_{0}}$$ and $$\scriptstyle {{P}_{1}}$$ and compare with [[media:2010_11_09_15_00_14.djvu|Eq.4-6 in page-2 Mtg-36]]

Solution
Eq. (9.1) can be written as:

Generate $$\displaystyle {{P}_{2}}$$

Let n=1 in  (1), we get

Generate $$\displaystyle {{P}_{3}}$$

Let n=2 in eq. (9.1), we get

Generate $$\displaystyle {{P}_{4}}$$

Let n=3 in eq. (9.1), we get

Generate $$\displaystyle {{P}_{5}}$$

Let n=4 in eq. (9.1), we get

Generate $$\displaystyle {{P}_{6}}$$

Let n=5 in eq. (9.1), we get

Conclusions

It is seen that $$\left\{ {{P}_{2}}\text{ }{{P}_{3}}\text{ }{{P}_{4}}\text{ }{{P}_{5}}\text{ }{{P}_{6}} \right\}$$ are the same as Eqs.4-6 given in 36-2.

= Problem 10 - Find Legendre Polynomials from $$\begin{align}P_3 \end{align}$$ to $$\begin{align}P_6 \end{align}$$ = From class note lecture 41_2 and class note lecture 40_3

Problem Statement
We have recurrence relations that

Binomial Theorem :

Thus,

Required
Continue power series expansion to find $$\begin{align}{P_3, P_4 , P_5 , P_6 } \end{align}$$, and compare the result to that obtained by a) (7) & (8) class note lecture 36_2

b) the result of HW 7.9

a)
We need the first 7 terms of the expansion

Using (10.5), we get

Therefore, we have confirmed two results are equivalent.

b)
Problem 9 results:

SAME!