text:
User talk:Baofeng

 Hello Baofeng, and welcome to Wikiversity! If you need help, feel free to visit my talk page, or contact us and ask questions. After you leave a comment on a talk page, remember to sign and date; it helps everyone follow the threads of the discussion. The signature icon in the edit window makes it simple. To get started, you may

 * Take a guided tour and learn to edit.
 * Visit a (kind of) random project.
 * Browse Wikiversity, or visit a portal corresponding to your educational level: pre-school, primary, secondary, tertiary, non-formal education.
 * Find out about research activities on Wikiversity.

 * Read an introduction for teachers and find out how to write an educational resource for Wikiversity.
 * Give feedback about your initial observations
 * Discuss Wikiversity issues or ask questions at the colloquium.
 * Chat with other Wikiversitans on #wikiversity-en.

And don't forget to explore Wikiversity with the links to your left. Be bold to contribute and to experiment with the sandbox or your userpage, and see you around Wikiversity! If you're a twitter user, please follow http://twitter.com/Wikiversity. Jtneill - Talk - c 22:41, 13 November 2009 (UTC)

 Hi! My name is WikiversityJack. I am a pumpkin and a Wikiversity mascot. My aunt told me that fun + learning = Wikiversity. Let me know if I can help you out.

title: User talk:Baofeng


text:
User:Egm6321.f09.Team1/HW6

 Nice overall organization and level of details in the work. Egm6321.f09 15:49, 23 November 2009 (UTC)

= Problem 1: Laplacian in Circular Cylindrical Coordinates =

From lecture slide 31-1.

Given
The equations for circular cylinder coordinates are given by:

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

\begin{array}{*{20}l} x_1 & = & r \cos \theta & = & \xi_1 \cos \xi_2 \\ x_2 & = & r \sin \theta & = & \xi_1 \sin \xi_2 \\ x_3 & = & z & = & \xi_3 & \end{array} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * }
 * }

Find
1. Find $$\displaystyle \{{\rm d} x_i\} = \{{\rm d} x_1, {\rm d} x_2, {\rm d} x_3\} $$ in terms of $$\displaystyle \{\xi_j\} = \{\xi_1, \xi_2, \xi_3\} $$ and $$\displaystyle \{{\rm d} \xi_k\} $$

2. Find $$\displaystyle {\rm d} s^2 = \sum_i ({\rm d} x_i)^2 = \sum_k (h_k)^2 ({\rm d} \xi_k)^2 $$. Identify $$\displaystyle \{h_i\}$$ in terms of $$\displaystyle \{ \xi_j \}$$.

3. Find the Laplacian in these curvilinear coordinates.

Solution
1. We can take the derivative of each $$\displaystyle \{x_i\}$$ in Eq. 1 with respect to $$\displaystyle \xi_i$$ as follows

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

{\rm d} x_1 = \frac{\partial x_1}{\partial \xi_1} {\rm d} \xi_1 + \frac{\partial x_1}{\partial \xi_2} {\rm d} \xi_2 + \frac{\partial x_1}{\partial \xi_3} {\rm d} \xi_3 = \cos \xi_2 {\rm d} \xi_1 - \xi_1 \sin \xi_2 {\rm d} \xi_2 + 0 {\rm d} \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * }
 * }

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

{\rm d} x_2 = \frac{\partial x_2}{\partial \xi_1} {\rm d}\xi_1 + \frac{\partial x_2}{\partial \xi_2} {\rm d}\xi_2 + \frac{\partial x_2}{\partial \xi_3} {\rm d}\xi_3 = \sin \xi_2 {\rm d}\xi_1 + \xi_1 \cos \xi_2 {\rm d} \xi_2 + 0 {\rm d} \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

{\rm d}x_3 = \frac{\partial x_3}{\partial \xi_1} {\rm d}\xi_1 + \frac{\partial x_3}{\partial \xi_2} {\rm d}\xi_2 + \frac{\partial x_3}{\partial \xi_3} {\rm d}\xi_3 = (0) {\rm d}\xi_1 + (0) {\rm d} \xi_2 + {\rm d} \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4)
 * }
 * }

Therefore,

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

$$\displaystyle \begin{array}{*{20}l} {\rm d}x_1 & = & \cos \xi_2 {\rm d}\xi_1 - \xi_1 \sin \xi_2 {\rm d} \xi_2 \\ {\rm d}x_2 & = & \sin \xi_2 {\rm d}\xi_1 + \xi_1 \cos \xi_2 {\rm d} \xi_2 \\ {\rm d}x_3 & = & {\rm d} \xi_3 \end{array} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle (Eq. 5)
 * }
 * }

2. Using the definition for $$\displaystyle {\rm d} s $$ gives

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

{\rm d}s^2 = \cos^2 \xi_2 \left({\rm d}\xi_1 \right)^2 - \cancel{2 \xi_1 \sin \xi_2 \cos \xi_2 {\rm d}\xi_1 {\rm d} \xi_2} + \xi_1^2 \sin^2 \xi_2 \left({\rm d} \xi_2\right)^2 + \sin^2 \xi_2 \left({\rm d}\xi_1 \right)^2 + \cancel{2 \xi_1 \sin \xi_2 \cos \xi_2 {\rm d}\xi_1 {\rm d} \xi_2} + \xi_1^2 \cos^2 \xi_2 \left({\rm d} \xi_2 \right)^2 + \left( {\rm d} \xi_3 \right)^2 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 6)
 * }
 * }

Simplifying Eq. 6 yields

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

$$\displaystyle {\rm d}s^2 = \left({\rm d}\xi_1 \right)^2 + \xi_1^2 \left({\rm d} \xi_2\right)^2 + \left( {\rm d} \xi_3 \right)^2 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle (Eq. 7)
 * }
 * }

Therefore,

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

$$\displaystyle h_1 = 1, \quad h_2 = \xi_1, \quad h_3 = 1 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle (Eq. 8)
 * }
 * }

3. The Laplacian operator over a function $$\displaystyle \psi$$ in 3-D curvilinear coordinates is given by

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

\Delta \psi= \nabla^2 \psi= \frac{1}{h_1 h_2 h_3} \sum_{i=1}^3 \frac{\partial}{\partial \xi_i} \left[ \frac{h_1 h_2 h_3}{h_i^2} \frac{\partial \psi}{\partial \xi_i} \right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 9)
 * }
 * }

Substituting the results given in Eq. 8 into Eq. 9 gives

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

\Delta \psi = \frac{1}{\xi_1} \left[ \frac{\partial}{\partial \xi_1} \left( \xi_1 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{\partial}{\partial \xi_2} \left( \frac{\xi_1}{\xi_1^2} \frac{\partial \psi}{\partial \xi_2} \right) + \frac{\partial}{\partial \xi_3} \left(\xi_1 \frac{\partial}{\partial \xi_3} \right) \right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 10)
 * }
 * }

Simplifying yields

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

$$\displaystyle \Delta \psi = \frac{1}{\xi_1} \frac{\partial}{\partial \xi_1} \left(\xi_1 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{1}{\xi_1^2} \frac{\partial^2 \psi}{\partial \xi_2^2} + \frac{\partial^2 \psi}{\partial \xi_3^2} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle (Eq. 11)
 * }
 * }

= Problem 2: Laplacian in Spherical Coordinates =

From lecture slide 31-1.

Given
The equations for spherical coordinates are given by:

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

\begin{array}{*{20}l} x_1 & = & r \cos \theta \cos \phi & = & \xi_1 \cos \xi_3 \cos \xi_2 \\ x_2 & = & r \cos \theta \sin \phi & = & \xi_1 \cos \xi_3 \sin \xi_2 \\ x_3 & = & r \sin \theta & = & \xi_1 \sin \xi_3 & \end{array} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * }
 * }

Find
1. Find $$\displaystyle \{{\rm d} x_i\} = \{{\rm d} x_1, {\rm d} x_2, {\rm d} x_3\} $$ in terms of $$\displaystyle \{\xi_j\} = \{\xi_1, \xi_2, \xi_3\} $$ and $$\displaystyle \{{\rm d} \xi_k\} $$

2. Find $$\displaystyle {\rm d} s^2 = \sum_i ({\rm d} x_i)^2 = \sum_k (h_k)^2 ({\rm d} \xi_k)^2 $$. Identify $$\displaystyle \{h_i\}$$ in terms of $$\displaystyle \{ \xi_j \}$$.

3. Find the Laplacian in these curvilinear coordinates.

Solution
1. We can take the derivative of each $$\displaystyle \{x_i\}$$ in Eq. 1 with respect to $$\displaystyle \xi_i$$ as follows

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

{\rm d} x_1 = \frac{\partial x_1}{\partial \xi_1} {\rm d} \xi_1 + \frac{\partial x_1}{\partial \xi_2} {\rm d} \xi_2 + \frac{\partial x_1}{\partial \xi_3} {\rm d} \xi_3 = \cos \xi _3 \cos \xi _2 {\rm d}\xi _1 - \xi _1 \cos \xi _3 \sin \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \cos \xi _2 {\rm d}\xi _3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * }
 * }

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

{\rm d} x_2 = \frac{\partial x_2}{\partial \xi_1} {\rm d}\xi_1 + \frac{\partial x_2}{\partial \xi_2} {\rm d}\xi_2 + \frac{\partial x_2}{\partial \xi_3} {\rm d}\xi_3 = \cos \xi _3 \sin \xi _2 {\rm d}\xi _1  + \xi _1 \cos \xi _3 \cos \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \sin \xi _2 {\rm d}\xi _3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

{\rm d}x_3 = \frac{\partial x_3}{\partial \xi_1} {\rm d}\xi_1 + \frac{\partial x_3}{\partial \xi_2} {\rm d}\xi_2 + \frac{\partial x_3}{\partial \xi_3} {\rm d}\xi_3 = \sin \xi _3 {\rm d}\xi _1 + (0){\rm d}\xi _2  + \xi _1 \cos \xi _3 {\rm d}\xi _3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 4)
 * }
 * }

Therefore,

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

$$\displaystyle \begin{array}{*{20}l} {\rm d}x_1 & = & \cos \xi _3 \cos \xi _2 {\rm d}\xi _1 - \xi _1 \cos \xi _3 \sin \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \cos \xi _2 {\rm d}\xi _3 \\ {\rm d}x_2 & = & \cos \xi _3 \sin \xi _2 {\rm d}\xi _1 + \xi _1 \cos \xi _3 \cos \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \sin \xi _2 {\rm d}\xi _3 \\ {\rm d}x_3 & = & \sin \xi _3 {\rm d}\xi _1 + \xi _1 \cos \xi _3 {\rm d}\xi _3 \end{array} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 5)
 * }
 * }

2. Using the definition for $$\displaystyle {\rm d} s $$ gives

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

\begin{array}{*{20}l} {\rm d}s^2 & = & \quad \left(\cos \xi _3 \cos \xi _2 {\rm d}\xi _1 - \xi _1 \cos \xi _3 \sin \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \cos \xi _2 {\rm d}\xi _3 \right)^2\\ {} & {} & + \left(\cos \xi _3 \sin \xi _2 {\rm d}\xi _1 + \xi _1 \cos \xi _3 \cos \xi _2 {\rm d}\xi _2  - \xi _1 \sin \xi _3 \sin \xi _2 {\rm d}\xi _3 \right)^2 \\ {} & {} & + \left(\sin \xi _3 {\rm d}\xi _1 + \xi _1 \cos \xi _3 {\rm d}\xi _3 \right)^2 \end{array} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

Simplifying Eq. 6 yields

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

$$\displaystyle {\rm d}s^2 = \left({\rm d}\xi_1 \right)^2 + \xi_1^2 \cos^2 \xi_3 \left({\rm d} \xi_2\right)^2 + \xi_1^2 \left( {\rm d} \xi_3 \right)^2 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 7)
 * }
 * }

Therefore,

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

$$\displaystyle h_1 = 1, \quad h_2 = \xi_1 \cos \xi_3, \quad h_3 = \xi_1 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 8)
 * }
 * }

3. The Laplacian operator over a function $$\displaystyle \psi$$ in 3-D curvilinear coordinates is given by

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

\Delta \psi= \nabla^2 \psi= \frac{1}{h_1 h_2 h_3} \sum_{i=1}^3 \frac{\partial}{\partial \xi_i} \left[ \frac{h_1 h_2 h_3}{h_i^2} \frac{\partial \psi}{\partial \xi_i} \right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }

Substituting the results given in Eq. 8 into Eq. 9 gives

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

\Delta \psi = \frac{1}{\xi_1^2 \cos \xi_3} \left[ \frac{\partial}{\partial \xi_1} \left( \xi_1^2 \cos \xi_3 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{\partial}{\partial \xi_2} \left( \frac{\xi_1^2 \cos \xi_3}{\xi_1^2 \cos^2 \xi_3} \frac{\partial \psi}{\partial \xi_2} \right) + \frac{\partial}{\partial \xi_3} \left(\frac{\xi_1^2 \cos \xi_3}{\xi_1^2} \frac{\partial}{\partial \xi_3} \right) \right] $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 10)
 * }
 * }

Simplifying yields

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

$$\displaystyle \Delta \psi = \frac{1}{\xi_1^2} \frac{\partial}{\partial \xi_1} \left(\xi_1^2 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{1}{\xi_1^2 \cos^2 \xi_3} \frac{\partial^2 \psi}{\partial \xi_2^2} + \frac{1}{\xi_1^2 \cos \xi_3}\left(\cos \xi_3\frac{\partial^2 \psi}{\partial \xi_3^2} \right) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 11)
 * }
 * }

= Problem 3: Laplacian in Spherical Coordinates (Math/Phys. convention) = From lecture slide 31-2.

Given
The equations for spherical coordinates with Math/Phys. convention are given by:

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

\begin{array}{*{20}l} x_1 & = & r \sin {\bar \theta } \cos \phi & = & \xi_1 \sin {\bar \xi_3 } \cos \xi_2 \\ x_2 & = & r \sin {\bar \theta } \sin \phi & = & \xi_1 \sin {\bar \xi_3 } \sin \xi_2 \\ x_3 & = & r \cos {\bar \theta } & = & \xi_1 \cos {\bar \xi_3 } & \end{array} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Find
Find the Laplacian in these coordinates considering that

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

\bar \theta = \frac{\pi}{2} - \theta $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

Solution
Eq. 2 can be written as follows

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

\bar \xi_3 = \frac{\pi}{2} - \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }

Therefore,

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

\cos \xi_3 = \sin \bar \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

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

\sin \xi_3 = \cos \bar \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }

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

\partial \xi_3 = - \partial \bar \xi_3 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

Substituting Eqs. 4, 5 and 6 into Eq.11 from problem 2 gives

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

$$\displaystyle \Delta \psi = \frac{1}{\xi_1^2} \frac{\partial}{\partial \xi_1} \left( \xi_1^2 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{1}{\xi_1^2 \sin^2 \bar \xi_3} \frac{\partial^2 \psi}{\partial \xi_2^2} - \frac{1}{\xi_1^2 \sin \bar \xi_3} \frac{\partial}{\partial \bar \xi_3} \left[ \sin \bar \xi_3 \left(- \frac{\partial \psi}{\partial \bar \xi_3} \right) \right] $$ $$
 *
$$\displaystyle (Eq. 7)
 * }
 * }

Simplifying Eq. 7 yields

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

$$\displaystyle \Delta \psi = \frac{1}{\xi_1^2} \frac{\partial}{\partial \xi_1} \left( \xi_1^2 \frac{\partial \psi}{\partial \xi_1} \right) + \frac{1}{\xi_1^2 \sin^2 \bar \xi_3} \frac{\partial^2 \psi}{\partial \xi_2^2} + \frac{1}{\xi_1^2 \sin \bar \xi_3} \frac{\partial}{\partial \bar \xi_3} \left( \sin \bar \xi_3 \frac{\partial \psi}{\partial \bar \xi_3} \right) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 8)
 * }
 * }

= Problem 4: Heat problem in a sphere. Separation of variables =

From lecture slide 31-2.

Given
The following equation

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

\lambda ( \lambda + 1 ) = n(n+1) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Find
Find the two solutions

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

\lambda_1 = n $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\lambda_2 = -(n + 1) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }

Solution
Eq. 1 can be rewritten as follows

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

\lambda ^2 + \lambda - n(n+1) = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

The roots for this quadratic equation are given by

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

\lambda _{1,2} = \frac{2} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }

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

\lambda _{1,2} =  - \frac{1}{2} \pm \sqrt {\frac{1}{4} + n(n + 1)} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

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

\lambda _{1,2} =  - \frac{1}{2} \pm \left( {n + \frac{1}{2}} \right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }

Taking the positive and negative signs respectively in Eq. 7 yields

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

$$\displaystyle \lambda_1 = n $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 8)
 * }
 * }

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

$$\displaystyle \lambda_2 = -\left( n +1 \right) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 9)
 * }
 * }

= Problem 5: Legendre Polynomials, equations equivalence =

From lecture slide 31-3.

Given
The Legendre polynomials can generated as follows

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(-1)^i (2 n - 2 i)! x^{n - 2i}}{2^n i! (n-i)! (n-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

where $$\displaystyle [n/2]$$ is the integer part of $$\displaystyle n/2$$.

Find
Show that Eq. 1 is equivalent to

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

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

Solution
Eq. 1 can be re-written as follows:

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(2 n - 2 i)!}{2^n (n-i)! } \frac{(-1)^i x^{n-2i}}{i!(n-2i)!}
 * $$\displaystyle
 * $$\displaystyle

$$ $$
 *
$$\displaystyle (Eq. 3)
 * }
 * }

The denominator of the left fraction in Eq. 3 can be written as

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(2 n - 2 i)!}{2^i 2^{n-i} (n-i)! } \frac{(-1)^i x^{n-2i}}{i!(n-2i)!}
 * $$\displaystyle
 * $$\displaystyle

$$ $$
 *
$$\displaystyle (Eq. 4)
 * }
 * }

Rearrange Eq. 4 and substitute $$\displaystyle {\rm 2}^ = \prod\limits_{k = 1}^{n - i} 2 $$ and $$\displaystyle (n - i)! = \prod\limits_{k = 1}^{n - i} k $$

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(2 n - 2 i)!}{ 2^i \prod\limits_{k = 1}^{n - i} 2 \prod\limits_{k = 1}^{n - i} k } \frac{(-1)^i x^{n-2i}}{ i!(n-2i)!}
 * $$\displaystyle
 * $$\displaystyle

$$ $$
 *
$$\displaystyle (Eq. 5)
 * }
 * }

Since the products in the denominator of Eq. 5 have the same limits, we have that

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(2 n - 2 i)!}{2^i \prod\limits_{k = 1}^{n - i} 2k } \frac{(-1)^i x^{n-2i}}{ i!(n-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

Expanding the numerator and denominator in Eq. 6 gives

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{1 \cdot \cancel{2}\cdot 3 \cdot \cancel{4} \cdot 5 \cdots (2 n - 2 i-1) \cdot \cancel{2( n - i)}}{2^i \quad \cancel{2} \cdot \cancel{4} \cdots  \cancel{2(n-i)} } \frac{(-1)^i  x^{n-2i}}{ i!(n-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }

Simplifying Eq. 7 yields

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

$$\displaystyle P_n(x) = \sum_{i=0}^{[n/2]} \frac{1 \cdot 3 \cdot 5 \cdots  (2 n - 2 i-1) }{ 2^i i!(n-2i)! } (-1)^i x^{n-2i} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 8)
 * }
 * }

Since Eqs. 2 and 8 are the same, Eqs. 1 and 2 are equivalent.

= Problem 6: Legendre Polynomials, generating the first five polynomials =

From lecture slide 31-3.

Given
The first five Legendre polynomials are given by

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

P_0(x) = 1 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

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

P_1(x) = x $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

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

P_2(x) = \frac{1}{2} \left(3 x ^ 2 - 1\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }

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

P_3(x) = \frac{1}{2} \left(5 x ^ 3 - 3 x\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

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

P_4(x) = \frac{35}{8} x ^ 4 - \frac{15}{4} x ^ 2 + \frac{3}{8} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }

Find
Verify that Eqs. 1, 2, 3, 4, and 5 can be written as

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

P_n(x) = \sum_{i=0}^{[n/2]} \frac{(-1)^i (2 n - 2 i)! x^{n - 2i}}{2^n i! (n-i)! (n-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

or

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

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

Solution
Since Eqs. 6 and 7 are equivalent we only need to verify that Eqs. 1 to 5 can be generated with one of them.

1. Substituting $$\displaystyle n=0$$ into Eq. 6 gives

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

P_0(x) = \sum_{i=0}^{[0/2]} \frac{(-1)^i (2 (0) - 2 i)! x^{0 - 2i}}{2^0 i! (0-i)! (0-2i)!}= \sum_{i=0}^{0} \frac{(-1)^i ( - 2 i)! x^{- 2i}}{i! (-i)! (-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 8)
 * }
 * }

Evaluating the sum gives

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

P_0(x) = \frac{0!}{0!0!0!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }

Evaluating Eq. 9 yields

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

$$\displaystyle P_0(x) = 1 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 10)
 * }
 * }

2. Substituting $$\displaystyle n=1$$ into Eq. 6 gives

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

P_1(x) = \sum_{i=0}^{[1/2]} \frac{(-1)^i (2 (1) - 2 i)! x^{1 - 2i}}{2^1 i! (1-i)! (1-2i)!}= \sum_{i=0}^{0} \frac{(-1)^i (2 - 2 i)! x^{1 - 2i}}{2 i! (1-i)! (1-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 11)
 * }
 * }

Evaluating the sum gives

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

P_1(x) = \frac{(-1)^0 \cancel{2!} x}{\cancel{2}0!1!1!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 12)
 * }
 * }

Evaluating Eq. 12 yields

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

$$\displaystyle P_1(x) = x $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 13)
 * }
 * }

3. Substituting $$\displaystyle n=2$$ into Eq. 6 gives

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

P_2(x) = \sum_{i=0}^{[2/2]} \frac{(-1)^i (2 (2) - 2 i)! x^{2 - 2i}}{2^2 i! (2-i)! (2-2i)!}= \sum_{i=0}^{1} \frac{(-1)^i (4 - 2 i)! x^{2 - 2i}}{4 i! (2-i)! (2-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 14)
 * }
 * }

Evaluating the sum gives

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

P_2(x) = \frac{1 \cdot 2 \cdot 3 \cdot 4 \cdot x^{2}}{4 \cdot 1 \cdot 2! \cdot 2!} - \frac{2!}{4 \cdot 1 \cdot 1 \cdot 1} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 15)
 * }
 * }

Evaluating Eq. 15 yields

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

$$\displaystyle P_2(x) = \frac{1}{2}(3x^2-1) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 16)
 * }
 * }

4. Substituting $$\displaystyle n=3$$ into Eq. 6 gives

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

P_3(x) = \sum_{i=0}^{[3/2]} \frac{(-1)^i (2 (3) - 2 i)! x^{3 - 2i}}{2^3 i! (3-i)! (3-2i)!}= \sum_{i=0}^{1} \frac{(-1)^i (6 - 2 i)! x^{3 - 2i}}{8 i! (3-i)! (3-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 17)
 * }
 * }

Evaluating the sum gives

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

P_3(x) = \frac{6! \cdot x^{3}}{8 \cdot 3! \cdot 3!} - \frac{4! \cdot x}{8 \cdot 2!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 18)
 * }
 * }

Evaluating Eq. 18 yields

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

$$\displaystyle P_3(x) = \frac{1}{2}(5x^3-3x) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 19)
 * }
 * }

5. Substituting $$\displaystyle n=4$$ into Eq. 6 gives

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

P_4(x) = \sum_{i=0}^{[4/2]} \frac{(-1)^i (2 (4) - 2 i)! x^{4 - 2i}}{2^4 i! (4-i)! (4-2i)!}= \sum_{i=0}^{2} \frac{(-1)^i (8 - 2 i)! x^{4 - 2i}}{16 i! (4-i)! (4-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 20)
 * }
 * }

Evaluating the sum gives

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

P_4(x) = \frac{ 8! \cdot x^{4}}{16 \cdot (4)! \cdot (4)!} -  \frac{6! \cdot x^{2}}{16 \cdot 3! \cdot 2!} +  \frac{ 4! }{16 \cdot 2! \cdot 2!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 21)
 * }
 * }

Evaluating Eq. 21 yields

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

$$\displaystyle P_4(x) = \frac{35}{8} x ^ 4 - \frac{15}{4} x ^ 2 + \frac{3}{8} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 22)
 * }
 * }

= Problem 7: Legendre Polynomials as solutions of the Legendre equation =

From lecture slide 32-1.

Given
The first 5 Legendre polynomials are (from lecture note slide 31-3
 * {| style="width:100%" border="0" align="left"

P_0(x) = 1 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

P_1(x) = x $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

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

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

P_4(x) = \frac{35}{8} x^4 - \frac{15}{4} x^2 + \frac{3}{8} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }

Find
Verify that $$\displaystyle P_0$$, $$\displaystyle P_1$$, $$\displaystyle P_2$$, $$\displaystyle P_3$$, and $$\displaystyle P_4$$ are solutions to the Legendre polynomial (from lecture slide 14-2)
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }

Solution
0. For $$\displaystyle n=0$$, we substitute Eq. 1 into Eq. 6
 * {| style="width:100%" border="0" align="left"

$$\displaystyle (1-x^2) y'' - 2 x y' + n(n+1) y = (1-x^2) 0 - 2 x 0 + 0(0+1) 1 = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 7)
 * }
 * }

1. For $$\displaystyle n=1$$, we substitute Eq. 2 into Eq. 6
 * {| style="width:100%" border="0" align="left"

$$\displaystyle (1-x^2) y'' - 2 x y' + n(n+1) y = (1-x^2) 0 - 2 x + 1(1+1) x = -2x + 2x = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 8)
 * }
 * }

2. For $$\displaystyle n=2$$, we substitute Eq. 3 into Eq. 6
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = (1-x^2) 3 - 6 x^2 + 2(2+1)\frac{1}{2} \left(3 x^2 - 1\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = 3-3 x^2 - 6 x^2 + 3 \left(3 x^2 - 1\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 10)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

$$\displaystyle (1-x^2) y'' - 2 x y' + n(n+1) y = \left(-3-6+9\right) x^2 + 3 - 3 = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 11)
 * }
 * }

3. For $$\displaystyle n=3$$, we substitute Eq. 4 into Eq. 6
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = (1-x^2) 15 x - 2 x \frac{1}{2} \left(15x^2 - 3\right)+ 3(3+1)\frac{1}{2} \left(5 x^3 - 3x\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 12)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = 15 x - 15 x^3 - 15x^3 + 3x + 30 x^3 - 18x $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 13)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

$$\displaystyle (1-x^2) y'' - 2 x y' + n(n+1) y = 18 x - 30 x^3 + 30 x^3 - 18x = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 14)
 * }
 * }

4. For $$\displaystyle n=4$$, we substitute Eq. 5 into Eq. 6
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = (1-x^2) \left(\frac{105}{2} x^2 - \frac{15}{2} \right) - 2 x \left(\frac{35}{2} x^3 - \frac{15}{2} x\right) + 4(4+1) \left(\frac{35}{8} x^4 - \frac{15}{4} x^2 + \frac{3}{8}\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 15)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

(1-x^2) y'' - 2 x y' + n(n+1) y = \frac{105}{2} x^2 - \frac{15}{2} - \frac{105}{2} x^4 + \frac{15}{2} x^2 - 35 x^4 + 15 x^2 +  \left(\frac{175}{2} x^4 - 75 x^2 + \frac{15}{2}\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 16)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

$$\displaystyle (1-x^2) y'' - 2 x y' + n(n+1) y = - \frac{105}{2} x^4 + \frac{175}{2} x^4 - 35 x^4 + \frac{105}{2} x^2 + \frac{15}{2} x^2  + 15 x^2 - 75 x^2 + \frac{15}{2}- \frac{15}{2} = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 17)
 * }
 * }

= Problem 8: Separation of variables for the Laplace equation and the Bessel differential equation =

From lecture slide 32-1.

Given
The Laplace Equation in circular cylinder coordinates $$\displaystyle \Delta \psi = 0 $$

Find
Obtain the separated equations for Laplace equation on circular cylinder coordinates, and identify the Bessel differential equation

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

x^2 y'' + x y' - (x^2 - \nu^2) y = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Solution
Assume the total solution of the Laplace equation is given by

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

f(\xi_1, \xi_2, \xi_3) = X_1(\xi_1) X_2(\xi_2) X_3(\xi_3) $$ $$ Using Laplace operator on the function $$\displaystyle f$$, we can write Laplace equation
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

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

\Delta f = \frac{1}{\xi_1} \frac{\partial}{\partial \xi_1} \left(\xi_1 \frac{\partial f}{\partial \xi_1} \right) + \frac{1}{\xi_1^2} \frac{\partial^2 f}{\partial \xi_2^2} + \frac{\partial^2 f}{\partial \xi_3^2} = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }

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

X_2 X_3 \frac{1}{\xi_1} \frac{\partial }{\partial \xi_1} \left(\xi_1 \frac{\partial X_1}{\partial \xi_1} \right) + X_1 X_3 \frac{1}{\xi_1^2} \frac{\partial^2 X_2}{\partial \xi_2^2} + X_1 X_2 \frac{\partial^2 X_3}{\partial \xi_3^2} = 0 $$ $$ Divide by $$\displaystyle X_1 X_2 X_3$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac{1}{\xi_1 X_1 } \frac{\partial }{\partial \xi_1} \left(\xi_1 \frac{\partial X_1}{\partial \xi_1} \right) + \frac{1}{\xi_1^2 X_2} \frac{\partial^2 X_2}{\partial \xi_2^2} + \frac{1}{X_3} \frac{\partial^2 X_3}{\partial \xi_3^2} = 0 $$ $$ The last term is only dependent on $$\displaystyle \xi_3$$, and is the only term dependent on $$\displaystyle \xi_3$$, hence it must be a constant. So we substitute
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac{1}{\xi_1 X_1 } \frac{\partial }{\partial \xi_1} \left(\xi_1 \frac{\partial X_1}{\partial \xi_1} \right) + \frac{1}{\xi_1^2 X_2} \frac{\partial^2 X_2}{\partial \xi_2^2} - \beta^2 = 0 $$ $$ where
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\beta^2 = -\frac{1}{X_3} \frac{\partial^2 X_3}{\partial \xi_3^2} $$ $$ Now, multiply by $$\displaystyle \xi_1^2$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac{\xi_1}{ X_1 } \frac{\partial }{\partial \xi_1} \left(\xi_1 \frac{\partial X_1}{\partial \xi_1} \right) + \frac{1}{X_2} \frac{\partial^2 X_2}{\partial \xi_2^2} - \xi_1^2 \beta^2 = 0 $$ $$ Now, the second term is only dependent on $$\displaystyle \xi_2$$, and it is the only term dependent on $$\displaystyle \xi_2$$. It must also be a constant. We can substitute
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 8)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\nu^2 = \frac{1}{X_2} \frac{\partial^2 X_2}{\partial \xi_2^2} $$ $$ So that
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac{\xi_1}{ X_1 } \frac{\partial }{\partial \xi_1} \left(\xi_1 \frac{\partial X_1}{\partial \xi_1} \right) + \nu^2 - \xi_1^2 \beta^2 = 0 $$ $$ Expand the first term
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac{\xi_1^2}{ X_1 } \frac{\partial^2 X_1}{\partial \xi_1^2} + \frac{\xi_1}{ X_1 } \frac{\partial X_1}{\partial \xi_1} + \nu^2 - \xi_1^2 \beta^2 = 0 $$ $$ Multiply by $$\displaystyle X_1$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 11)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\xi_1^2 \frac{\partial^2 X_1}{\partial \xi_1^2} + \xi_1 \frac{\partial X_1}{\partial \xi_1} - \left( \xi_1^2 \beta^2 - \nu^2 \right) X_1 = 0 $$ $$ Now, substitute $$\displaystyle x = \xi_1 \beta$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 12)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

x^2 \frac{\partial^2 X_1}{\partial x^2} + x \frac{\partial X_1}{\partial x} - \left( x^2 - \nu^2 \right) X_1 = 0 $$ $$ Then, with $$\displaystyle X_1 = y(x)$$, we get
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 13)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

x^2 \frac{\partial^2 y}{\partial x^2} + x \frac{\partial y}{\partial x} - \left( x^2 - \nu^2 \right) y = 0 $$ $$ or
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 14)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle x^2 y'' + x y' - \left( x^2 - \nu^2 \right) y = 0 $$ $$ which is the same as Eq. 1, i.e. the Bessel differential equation.
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 15)
 * }
 * }

= Problem 9: Sums of Even and Odd Functions =

From lecture slide 33-3

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

f = \sum_i g_i $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Find
Show that: 1. if the family $$\displaystyle \{g_i\}$$ is odd, then $$\displaystyle f$$ is odd.

2. if the family $$\displaystyle \{g_i\}$$ is even, then $$\displaystyle f$$ is even.

Solution
1. The definition of an odd function is that $$\displaystyle f(x) = -f(-x)$$.
 * {| style="width:100%" border="0" align="left"

$$\displaystyle f(x) = \sum_i g_i(x) = \sum_i \left[-g_i(-x)\right] = -\sum_i g_i(-x) = -f(-x) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 2)
 * }
 * }

2. The definition of an even function is that $$\displaystyle f(x) = f(-x)$$. So, if every $$\displaystyle g_i$$ is even, then
 * {| style="width:100%" border="0" align="left"

$$\displaystyle f(x) = \sum_i g_i(x) = \sum_i g_i(-x) = f(-x) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 3)
 * }
 * }

= Problem 10: Legendre Polynomials' Evenness and Oddness =

From lecture slide 33-3

Given
The Legendre polynomials are given by
 * {| style="width:100%" border="0" align="left"

P_n(x) = \sum_{i=0}^{[n/2]} (-1)^i \frac{(2 n - 2 i)! x^{n - 2i}}{2^n i! (n-i)! (n-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Find
Show that, with $$\displaystyle k = 0,1,2,...$$,

1. $$\displaystyle P_{2k}(x)$$ is even

2. $$\displaystyle P_{2k+1}(x)$$ is odd

Solution
1. The definition of an even function is that $$\displaystyle f(x) = f(-x)$$. Substitute $$\displaystyle n=2k$$ in Eq. 1
 * {| style="width:100%" border="0" align="left"

P_{2k}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k - 2 i)! x^{2k - 2i}}{2^{2k} i! (2k-1)! (2k-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

P_{2k}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k - 2 i)! \left[(x)^2\right]^{k - i}}{2^{2k} i! (2k-1)! (2k-2i)!} $$ $$ Then, since both $$\displaystyle i$$ and $$\displaystyle k$$ are integers,
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle P_{2k}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k - 2 i)! \left[(-x)^2\right]^{k - i}}{2^{2k} i! (2k-1)! (2k-2i)!} = P_{2k}(-x) $$ $$ 2. The definition of an odd function is that $$\displaystyle f(x) = -f(-x)$$. Substitute $$\displaystyle n=2k+1$$ in Eq. 1
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 4)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

P_{2k+1}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k + 2 - 2 i)! x^{2k + 1 - 2i}}{2^{2k+1} i! (2k)! (2k+1-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

P_{2k+1}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k + 2 - 2 i)! (x) \left[(x)^2\right]^{k - i}}{2^{2k+1} i! (2k)! (2k+1-2i)!} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

P_{2k+1}(x) = \sum_{i=0}^{k} (-1)^i \frac{(4k + 2 - 2 i)! (x) \left[(-x)^2\right]^{k - i}}{2^{2k+1} i! (2k)! (2k+1-2i)!} $$ $$ But Eq. 6 at $$\displaystyle -x$$ is
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

P_{2k+1}(-x) = \sum_{i=0}^{k} (-1)^i \frac{(4k + 2 - 2 i)! (-x) \left[(-x)^2\right]^{k - i}}{2^{2k+1} i! (2k)! (2k+1-2i)!} $$ $$ Comparing Eqs. 7 and 8 shows that
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 8)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle P_{2k+1}(x) = -P_{2k+1}(-x) $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 9)
 * }
 * }

= Problem 11: Computation of Legendre Coefficients Using the Gram Matrix Method =

From lecture slide 33-4

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

q(x) = \sum_{i=0}^4 c_i x^i $$ $$ with the coefficients
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

c_0 = 3, \quad c_1 = 10, \quad c_2 = 15, \quad c_3 = -1, \quad c_4 = 5 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

Find
1. Find the coefficients $$\displaystyle \{ a_i \}$$ s.t. $$\displaystyle q(x) = \sum_{i=0}^4 a_i P_i(x)$$, where $$\displaystyle P_i(x)$$ are Legendre polynomials.

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

q = \sum_i c_i x^i $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

q = \sum_i a_i P_i(x) $$ $$ to verify that they are equal.
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

Solution
1. The first 5 Legendre polynomials are
 * {| style="width:100%" border="0" align="left"

\underbrace{ \left\{ \begin{matrix} P_0(x) \\ P_1(x) \\ P_2(x) \\ P_3(x) \\ P_4(x) \end{matrix} \right\} }_{\mathbf{P}(x)} = \left\{ \begin{matrix} 1 \\ x \\ \frac{1}{2} \left(3 x^2 - 1\right) \\ \frac{1}{2} \left(5 x^3 - 3 x\right) \\ \frac{35}{8} x^4 - \frac{15}{4} x^2 + \frac{3}{8} \end{matrix} \right\} = \underbrace{ \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ -\frac{1}{2} & 0 & \frac{3}{2} & 0 & 0 \\ 0 & -\frac{3}{2} & 0 & \frac{5}{2} & 0 \\ \frac{3}{8} & 0 & -\frac{15}{4} & 0 & \frac{35}{8} \end{matrix} \right] }_{A} \underbrace{ \left\{ \begin{matrix} 1 \\ x \\ x^2 \\ x^3 \\ x^4 \end{matrix} \right\} }_{\mathbf{x}} $$ $$ Then we have that
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

q(x) = \mathbf{a} \cdot \mathbf{P}(x) = \mathbf{a}^T A \mathbf{x} = \mathbf{c}^T \mathbf{x} $$ $$ the above is true for all $$\displaystyle \mathbf{x}$$ if
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mathbf{a}^T A = \mathbf{c}^T $$ $$ or
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mathbf{a}^T = \mathbf{c}^T A^{-1} $$ $$ The inverse of $$\displaystyle A$$ is
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 8)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

A^{-1} = \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ \frac{1}{3} & 0 & \frac{2}{3} & 0 & 0 \\ 0 & \frac{3}{5} & 0 & \frac{2}{5} & 0 \\ \frac{1}{5} & 0 & \frac{4}{7} & 0 & \frac{8}{35} \end{matrix} \right] $$ $$ Hence
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mathbf{a}^T = \left\{ \begin{matrix} 3 \\ 10 \\ 15 \\ -1 \\ 5 \end{matrix} \right\}^T \left[ \begin{matrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ \frac{1}{3} & 0 & \frac{2}{3} & 0 & 0 \\ 0 & \frac{3}{5} & 0 & \frac{2}{5} & 0 \\ \frac{1}{5} & 0 & \frac{4}{7} & 0 & \frac{8}{35} \end{matrix} \right] = \left\{ \begin{matrix} 9 \\ \frac{47}{5} \\ \frac{90}{7} \\ -\frac{2}{5} \\ \frac{8}{7} \end{matrix} \right\}^T $$ $$ So the answer is
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \mathbf{a} = \left\{ \begin{matrix} 9 \\ \frac{47}{5} \\ \frac{90}{7} \\ -\frac{2}{5} \\ \frac{8}{7} \end{matrix} \right\} \approx \left\{ \begin{matrix} 9 \\ 9.4 \\ 12.8571 \\ -0.4 \\ 1.1429 \end{matrix} \right\} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 11)
 * }
 * }

2. The two functions are plotted

Matlab source code:

= Problem 12: L2-ODE-VC = From lecture slides 22-2, 22-3. If you did this in homework 4, just link to it.

Given
From, p. 28, problem 1.1b.
 * {| style="width:100%" border="0" align="left"

x y'' + 2 y' + xy = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

Find
1. Verify the exactness of Eq. 1.

2. Try the following trial solutions

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

y(x) = e^{rx} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

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

y(x) = x e^{rx} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }

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

y(x) = \frac{1}{x} e^{rx} $$ $$ where $$\displaystyle r$$ is a (possibly complex) constant.
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

3. Use undetermined factor method to find $$\displaystyle u_2(x)$$, knowing $$\displaystyle u_1(x)$$. Compare to the above results.

Solution
1. Assume
 * {| style="width:100%" border="0" align="left"

F(x, y, y', y'') = \frac{{\rm} d \phi(x, y, y')}{{\rm d}x} = \underbrace{\phi_x + \phi_y y'}_{g} + \underbrace{\phi_{y'}}_{f} y'' $$ $$ and $$\displaystyle p=y'$$. Then
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

f(x) = x $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

g(x) = 2 p + x y $$ $$ Then, for the differential equation to be exact, we need that (from lecture slide 10-2)
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

f_{xx} + 2p f_{xy} + p^2 f_{yy} = g_{xp} + p g_{yp} - g_y $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 8)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

f_{xp} + p f_{yp} + 2 f_{y} = g_{pp} $$ $$ The only non-zero derivative in the above equations is
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle g_y = x $$ $$ hence, Eq. 8 is not fulfilled. We need to multiply Eq. 5 with an integrating factor $$\displaystyle x^a y^b p^c$$, so we get
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\tilde f(x) = x^{a+1} y^b p^c $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 11)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

g(x) = 2 x^a y^b p^{c+1} + x^{a+1} y^{b+1} p^c $$ $$ Eqs. 8 and 9 then become
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 12)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

(a+1)ax^{a-1} y^b p^c + 2 (a+1) b p x^{a} y^{b-1} p^c + b (b-1) p^2 x^{a+1} y^{b-2} p^c $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= 2 a(c+1) x^{a-1} y^b p^{c} + (a+1) c x^{a} y^{b+1} p^{c-1} + 2 b (c+1) x^a y^{b-1} p^{c+1} + (b+1) c x^{a+1} y^{b} p^c + - 2 b x^a y^{b-1} p^{c+1} - (b+1) x^{a+1} y^{b} p^c $$ $$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 13)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

(a+1) c x^{a} y^b p^{c-1} + b c x^{a+1} y^{b-1} p^c + 2 b x^{a+1} y^{b-1} p^c = 2 c (c+1) x^a y^b p^{c-1} + c(c-1) x^{a+1} y^{b+1} p^{c-2} $$ $$ Divide 13 with $$\displaystyle x^{a-1} y^{b-1} p^{c-1}$$ and group terms
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 14)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

(a+1)a y p + 2 (a+1) b x p^2 + b (b-1) p^3 x^1 y^{-1} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= 2 a(c+1) y p + (a+1) c x y^2 p + 2 b (c+1) x p^{2} + (b+1) c x^{2} y p - 2 b x p^{2} - (b+1) x^{2} y p $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 15)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

\left\{ ay \left[a -  2 c - 1\right] - (b+1) x^{2} y \left[c -  1\right] \right\}p + \left\{ a - c + 1 \right\} 2 b p^2 x + b (b-1) p^3 x^1 y^{-1} = (a+1) c x y^2 + $$ $$ For the above equation to be satisfied, we need $$\displaystyle b=0$$ or $$\displaystyle b=1$$, and we are left with
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 16)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\left\{ ay \left[a -  2 c - 1\right] - (b+1) x^{2} y \left[c -  1\right] \right\}p + \left\{ a - c + 1 \right\} 2 b p^2 x = (a+1) c x y^2 $$ $$ Then, for the second term in the first parenthesis to vanish, we need $$\displaystyle c = 1$$, so that
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 17)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\left\{ ay \left[a - 3\right] \right\}p + \left\{ a \right\} 2 b p^2 x = (a+1) x y^2 $$ $$ Then if we choose $$\displaystyle b=0$$, we get
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 18)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \left\{ ay \left[a - 3\right] \right\}p = (a+1) x y^2 $$ $$ We only have $$\displaystyle a$$ left to choose, and it cannot be chosen to satisfy the above equation. Hence, Eq. 8 cannot be satisfied using an integrating factor of the form $$\displaystyle x^a y^b z^c$$.
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 19)
 * }
 * }

2.1. Differentiate Eq. 2 twice:
 * {| style="width:100%" border="0" align="left"

y'(x) = r e^{rx} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 20)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

y''(x) = r^2 e^{rx} $$ $$ Substitute into Eq. 1
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 21)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

x r^2 e^{rx} + 2 r e^{rx} + x e^{rx} = 0 $$ $$ Divide by $$\displaystyle e^{rx} x$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 22)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

r^2 + \frac{2}{x} r + 1 = 0 $$ $$ Then $$\displaystyle r$$ is
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 23)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle r = - x^{-1} \pm \sqrt{x^{-2} - 1} $$ $$ $$\displaystyle r$$ was assumed to be a constant while differentiating Eq. 2, which it clearly can't be.
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 24)
 * }
 * }

2.2. Differentiate Eq. 3 twice
 * {| style="width:100%" border="0" align="left"

y'(x) = e^{rx} + r x e^{rx} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 25)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

y''(x) = 2 r e^{rx} + r^2 x e^{rx} $$ $$ Substitute into Eq. 1
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 26)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

2 r x e^{rx} + r^2 x^2 e^{rx} + 2 e^{rx} + 2 r x e^{rx} + + x^2 e^{rx} = 0 $$ $$ Divide by $$\displaystyle x^2 e^{rx}$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 27)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

r^2 + 4 r x^{-1} + 2 x^{-2} + 1 = 0 $$ $$ Solve for $$\displaystyle r$$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 28)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

r = - 2 x^{-1} \pm \sqrt{4 x^{-2} - 2 x^{-2} - 1} = - 2 x^{-1} \pm \sqrt{2 x^{-2} - 1} $$ $$ $$\displaystyle r$$ was assumed to be a constant while differentiating Eq. 3, which it clearly can't be.
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 29)
 * }
 * }

2.3. Differentiate Eq. 4 twice
 * {| style="width:100%" border="0" align="left"

y'(x) = -\frac{1}{x^2} e^{rx} + \frac{r}{x} e^{rx} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 30)
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

y''(x) = \frac{2}{x^3} e^{rx} -\frac{2 r}{x^2} e^{rx} + \frac{r^2}{x} e^{rx} $$ $$ Substitute into Eq. 1
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 31)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\left( \frac{2}{x^2} -\frac{2 r}{x} + r^2 - \frac{2}{x^2} + \frac{2 r}{x} + 1 \right) e^{rx} = 0 $$ $$ Divide by $$\displaystyle e^{rx}$$ and remove canceling terms
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 32)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

r^2 + 1 = 0 $$ $$ Hence $$\displaystyle r = \pm \sqrt{1} = \pm i$$ and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 33)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle y = A \frac{e^{i x}}{x} + B \frac{e^{- i x}}{x} = C_1 \frac{\sin x}{x} + C_2 \frac{\cos x}{x} $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 34)
 * }
 * }

3. See Homework 4, Problem 4, part 2

= Problem 13: Legendre Polynomials' Orthogonality = From lecture slide 34-2

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

\psi(1,\theta) = f(\theta) = T_0 \cos \theta $$ $$ where
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

f(\mu) = T_0 \sqrt{1 - \mu^2} $$ $$ is even, and
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\mu = \sin \theta $$ $$ Eq. 5 from lecture slide 33-2
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

A_n = \frac{2n + 1}{2} <f, P_n> $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 4)
 * }
 * }

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

\begin{cases} A_{2k} = 0 \\ A_{2k+1} = 0 \end{cases} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 5)
 * }
 * }

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

2a. Analytical, using either $$\displaystyle \theta$$ or $$\displaystyle \mu$$ as integrating variable

2b. Numerically, using Gauss-Legendre, accurately within $$\displaystyle 5\%$$

Solution
1. Eq. 3 from lecture slide 33-1
 * {| style="width:100%" border="0" align="left"

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

<f, P_n> = \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. 7)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<f, P_{2k+1}> = \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. 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
 *
$$\displaystyle (Eq. 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
 *
$$\displaystyle (Eq. 10)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle A_{2k+1} = \frac{2k + 2}{2} <f, P_{2k+1}> = 0 $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 11)
 * }
 * }

2.

2a.

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 \sqrt{1-\mu^2} $$.

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

(i.) 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 \sqrt{1-\mu^2} d\mu

$$ $$
 *
$$\displaystyle (Eq. 12)

 * }.
 * }.

Using definite integrals in Matlab, we get,

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

 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \sqrt{1-\mu^2} d\mu = \left[ \frac{\pi}{2} \right]

$$ $$
 *
$$\displaystyle (Eq. 13)

 * }.
 * }.

Substituting equation (13) in (12),

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow A_0 = \frac{T_0}{2} \left[ \frac{\pi}{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 = \frac{\pi T_0}{4}

$$ $$
 * style= |
 *
$$\displaystyle (Eq. 14)
 * }.
 * }.

(ii.) 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 \sqrt{1-\mu^2} \left[\frac{1}{2} (3\mu^2 - 1) \right]d\mu

$$ $$
 *
$$\displaystyle (Eq. 15)

 * }.
 * }.

Using definite integrals in Matlab, we get,

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

 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \sqrt{1-\mu^2}\left[\frac{1}{2} (3\mu^2 - 1) \right] d\mu = \left[ \frac{-\pi}{16} \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[ \frac{-\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_2 = \frac{-5\pi T_0}{32}

$$ $$
 * style= |
 *
$$\displaystyle (Eq. 17)
 * }.
 * }.

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

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

 * $$\displaystyle
 * $$\displaystyle

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

$$ $$
 *
$$\displaystyle (Eq. 18)

 * }.
 * }.

Using definite integrals in Matlab, we get,

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

 * $$\displaystyle
 * $$\displaystyle

\int_{-1}^{1} \sqrt{1-\mu^2}\left[\frac{35}{8} \mu^4 - \frac{15}{4} \mu^2 + \frac{3}{8} \right] d\mu = \left[ \frac{-\pi}{128} \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[ \frac{-\pi}{128} \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 = \frac{-9\pi T_0}{256}

$$ $$
 * style= |
 *
$$\displaystyle (Eq. 20)
 * }.
 * }.

2b. 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_{-1}^{1} f(\mu)P_n(\mu)d\mu \\ & = \frac{2n+1}{2} \sum_{j=1}^{m} w_jf(x_j)P_n(x_j) \end{align} $$
 * $$\displaystyle
 * $$\displaystyle

 * }
 * }

where,

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

w_j = \frac{-2}{(n+1)P'_m(x_j)P_{m+1}(x_j)} $$
 * $$\displaystyle
 * $$\displaystyle

 * }.
 * }.

(i.) For n = 0 and m = 20 we get,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_0 = 1

$$

 * }
 * }

and,

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

\begin{align} \Rightarrow A_0 & = \frac{2(0)+1}{2} \sum_{j=1}^{20} T_0 w_j \sqrt{1-x_{j}^{2}}\\ & = \frac{T_0}{2} \left[ 1.570892146048340 \right] \end{align} $$
 * $$\displaystyle
 * $$\displaystyle

 * }.
 * }.

 * {| 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 = 7.854460730241699\cdot 10^{-1} \cdot T_0

$$ $$
 * style= |
 *
$$\displaystyle (Eq. 21)
 * }.
 * }.

(ii.) For n = 2 and m = 20 we get,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_2 = \frac{1}{2} (3x^2-2)

$$

 * }
 * }

and,

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

\begin{align} \Rightarrow A_2 & = \frac{2(2)+1}{2} \sum_{j=1}^{20} T_0 w_j (\frac{1}{2}) (3x_{j}^{2}-2) \sqrt{1-x_{j}^{2}}\\ & = \frac{5T_0}{2} \left[ -1.962526165998847\cdot 10^{-1} \right] \end{align} $$
 * $$\displaystyle
 * $$\displaystyle

 * }.
 * }.

 * {| 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 = -4.906315414997119\cdot 10^{-1} \cdot T_0

$$ $$
 * style= |
 *
$$\displaystyle (Eq. 22)
 * }.
 * }.

(iii.) For n = 4 and m = 20 we get,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_4 = \frac{35}{8} x^4 - \frac{15}{4} x^2 + \frac{3}{8}

$$

 * }
 * }

and,

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

\begin{align} \Rightarrow A_4 & = \frac{2(4)+1}{2} \sum_{j=1}^{20} T_0 w_j \left(\frac{35}{8} x_{j}^{4} - \frac{15}{4} x_{j}^{2} + \frac{3}{8} \right) \sqrt{1-x_{j}^{2}}\\ & = \frac{9T_0}{2} \left[ -2.444412881080017 \cdot 10^{-2} \right] \end{align} $$
 * $$\displaystyle
 * $$\displaystyle

 * }.
 * }.

 * {| 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 = -1.099985796486008 \cdot 10^{-1}\cdot T_0

$$ $$ These numerical solutions are all less than 1 % from the exact solution.
 * style= |
 *
$$\displaystyle (Eq. 23)
 * }.
 * }.

 Matlab Code:

Please refer and download matlab files from Gauss-Legendre Matlab Central. Below is the file functions.m that will be called by gausslege.m function.

Below is the function call to find the numerical integrals every time after modifying the functions.m file for corresponding n values [This is done at the command line or can be done as script].

= Problem 14: Gauss-Legendre Quadrature = From lecture slide 35-3

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

 * },
 * },

and from lecture slide 35-2, weights $$\displaystyle w_j $$ of the Legendre Polynomial $$\displaystyle P_n(x)$$ are given by,

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

w_j = \frac{-2}{(n+1)P'_n(x_j)P_{n+1}(x_j)} $$ \left[\forall j=1,2,...,n \right] $$ where each $$\displaystyle x_j $$ are the roots of $$\displaystyle P_n(x) = 0 $$.
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.
 * }.

Find
1. Verify the expressions on Wikipedia for the Legendre polynomials $$\displaystyle P_n$$ with $$\displaystyle n = 0, 1,..., 6$$. (See homework on lecture slide 31-3)

2. Verify the table for Gauss-Legendre quadrature in Wikipedia, analytical expressions of $$\displaystyle \{x_j\}$$ and $$\displaystyle \{w_j\}$$, $$\displaystyle j=1,...,5$$, and $$\displaystyle n=1,...,5$$, where $$\displaystyle n$$ is the number of integration points.

3. Evaluate numerically $$\displaystyle \{x_j\}$$ and $$\displaystyle \{w_j\}$$ and compare results with Abramovitz & Stegum. See [http://en.wikiversity.org/wiki/User:Egm6321.f09/Lecture_plan lecture plan].

Solution
1. The 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)

 * }.
 * }.

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

Substituting $$\displaystyle n=5$$ into Eq. 1 gives,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_5(x) = \sum_{i=0}^{\lfloor 5/2 \rfloor} \frac{1 \cdot 3 \dots \left(2n - 2i - 1\right)}{2^i i!(n-2i)!}(-1)^i x^{n - 2i}

$$

 * }.
 * }.

The sum is then expanded,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_5(x)  = \frac{1 \cdot 3 \cdot 5 \cdot 7 \cdot 9} {1 \cdot 2 \cdot 3 \cdot 4 \cdot 5} x^5 + \frac{1 \cdot 3 \cdot 5 \cdot 7 } {2 \cdot (3!)} (-1)x^3 +  \frac{1 \cdot 3 \cdot 5} {2^2 \cdot (2!)} (-1)^2 x

$$ $$
 *
$$\displaystyle (Eq. 2)
 * }.
 * }.

Equation (2) is then,

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

$$\displaystyle \Rightarrow P_5(x) = \frac{63}{8} x^5 - \frac{35}{4} x^3 + \frac{15}{8} x $$ $$.
 * style="width:30%; padding:10px; border:2px solid #8888aa" |
 * style="width:30%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 3)
 * }
 * }

Substituting $$\displaystyle n=6$$ into Eq. 1 gives,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_6(x) = \sum_{i=0}^{\lfloor 6/2 \rfloor} \frac{1 \cdot 3 \cdot \cdot \cdot \left(2n - 2i - 1\right)}{2^i i!(n-2i)!}(-1)^i x^{n - 2i}

$$

 * }.
 * }.

The sum is then expanded,

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

 * $$\displaystyle
 * $$\displaystyle

\Rightarrow P_6(x)  = \frac{1 \cdot 3 \cdot 5 \cdot 7 \cdot 9 \cdot 11} {1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6} x^6 + \frac{1 \cdot 3 \cdot 5 \cdot 7 \cdot 9} {2 \cdot (4!)} (-1)x^4 +  \frac{1 \cdot 3 \cdot 5 \cdot 7} {2^2 \cdot (2!) \cdot (2!)} (-1)^2 x^2 +  \frac{1 \cdot 3 \cdot 5} {2^3 \cdot (3!)} (-1)^3 x^0

$$ $$
 *
$$\displaystyle (Eq. 4)
 * }.
 * }.

Equation (4) is then,

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

$$\displaystyle \Rightarrow P_6(x) = \frac{231}{16} x^6 - \frac{315}{16} x^4 + \frac{105}{16} x^2 - \frac{5}{16} $$ $$
 * style="width:30%; padding:10px; border:2px solid #8888aa" |
 * style="width:30%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 5)
 * }.
 * }.

The equations (3), (5) and equations (10), (13), (16), (19), (22) of Problem 6 match the equations in Wikipedia.

2. The weights $$\displaystyle w_j $$ of the Legendre Polynomial $$\displaystyle P_n(x)$$ are given by,

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

w_j = \frac{-2}{(n+1)P'_n(x_j)P_{n+1}(x_j)} $$ \left[\forall j=1,2,...,n \right] $$ $$ where each $$\displaystyle x_j $$ are the roots of $$\displaystyle P_n(x) = 0 $$.
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 6)
 * }.
 * }.

(i). When $$\displaystyle n = 1 $$,

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

P_1(x) = x;\ P'_1(x) = 1; \ P_2(x) = \frac{1}{2}(3x^2-1);when\ P_1(x) = 0 \Rightarrow\ x_1 = 0; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 7)
 * }
 * }

Substituting values of Equation (7) into (6)

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

w_1 = \frac{-2}{(1+1)(1)(1/2)(-1)} = 2 $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

And so,

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

$$\displaystyle x_1 = 0;\ w_1 = 2 $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 8)
 * }.
 * }.

(ii). When $$\displaystyle n = 2 $$,

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

P_2(x) = \frac{1}{2}(3x^2-1);\ P'_2(x) = 3x; P_3(x) = \frac{1}{2}(5x^3-3x);when\ P_2(x) = 0 \Rightarrow\ x_{1,2} = \bigg\{\frac{-1}{\sqrt{3}},\frac{1}{\sqrt{3}} \bigg\}; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 9)
 * }
 * }

Substituting values of Equation (9) into (6),

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

w_1 = \frac{-2}{3(3)(\frac{-1}{\sqrt{3}})(\frac{1}{2})\left[5(-1/\sqrt{3})^3 - 3(-1/\sqrt{3})\right]} = \frac{4}{-5+9} = 1 $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * }

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

w_2 = \frac{-2}{3(3)(\frac{1}{\sqrt{3}})(\frac{1}{2})\left[5(1/\sqrt{3})^3 - 3(1/\sqrt{3})\right]} = \frac{-4}{5-9} = 1 $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

And so,

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

$$\displaystyle x_{1,2} = \bigg\{\frac{-1}{\sqrt{3}},\frac{1}{\sqrt{3}} \bigg\};\ w_{1,2} = \bigg\{1,1 \bigg\} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 10)
 * }.
 * }.

(iii). When $$\displaystyle n = 3 $$,

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

P_3(x) = \frac{1}{2}(5x^3-3x);\ P'_3(x) = \frac{1}{2}(15x^2-3);\ P_4(x) = \frac{35}{8}x^4 - \frac{15}{4}x^2 + \frac{3}{8}; when\ P_3(x) = 0 \Rightarrow\ x_{1,2,3} = \bigg\{-\sqrt{\frac{3}{5}},0,\sqrt{\frac{3}{5}} \bigg\}; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 11)
 * }
 * }

Substituting values of Equation (11) into (6),

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

w_1 = w_3 = \frac{-2}{4(1/2)\left[15(3/5) - 3 \right]\left[(35/8)(9/25) - (15/4)(3/5) + (3/8) \right]} = \frac{5}{9} $$
 * $$\displaystyle
 * $$\displaystyle
 * }
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

w_2 = \frac{-2}{2(-3)\frac{3}{8}} = \frac{8}{9} $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

And so,

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

$$\displaystyle x_{1,2,3} = \bigg\{-\sqrt{\frac{3}{5}},0,\sqrt{\frac{3}{5}} \bigg\};\ w_{1,2,3} = \bigg\{\frac{5}{9},\frac{8}{9} ,\frac{5}{9}\bigg\} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 12)
 * }.
 * }.

(iv). When $$\displaystyle n = 4 $$,

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

 * $$\displaystyle
 * $$\displaystyle

P_4(x) = \frac{35}{8}x^4 - \frac{15}{4}x^2 + \frac{3}{8}

$$ $$
 *
$$\displaystyle (Eq. 13)
 * }
 * }

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

P'_4(x) = \frac{35}{2}x^3 - \frac{15}{2}x; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 14)
 * }
 * }

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

P_5(x) = \frac{63}{8} x^5 - \frac{35}{4} x^3 + \frac{15}{8} x; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 15)
 * }.
 * }.

Substituting (13), (14), (15) into equation (6),

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

w_j = \frac{-2}{(5)(\frac{5{x_j}^2}{16})(7{x_j}^2-3)(63{x_j}^4-70{x_j}^2+15)}; \forall j = 1,2,3,4 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 16)
 * }.
 * }.

When $$\displaystyle P_4(x) = 0 $$,

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

\Rightarrow\ x_1 = - \sqrt{\frac{3+2\sqrt{6/5}}{7}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 17)
 * }
 * }

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

\Rightarrow\ x_2 = - \sqrt{\frac{3-2\sqrt{6/5}}{7}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 18)
 * }
 * }

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

\Rightarrow\ x_3 = \sqrt{\frac{3-2\sqrt{6/5}}{7}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 19)
 * }
 * }

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

\Rightarrow\ x_4 = \sqrt{\frac{3+2\sqrt{6/5}}{7}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 20)
 * }.
 * }.

Substituting equations (18) and (19) into (16),

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

$$\displaystyle \Rightarrow\ w_{2,3} = \frac{18+\sqrt{30}}{36} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 21)
 * }.
 * }.

Substituting equations (18) and (19) into (16),

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

$$\displaystyle \Rightarrow\ w_{1,4} = \frac{18-\sqrt{30}}{36} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 22)
 * }.
 * }.

(v). When $$\displaystyle n = 5 $$,

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

 * $$\displaystyle
 * $$\displaystyle

P_5(x) = \frac{63}{8}x^5 - \frac{35}{4}x^3 + \frac{15}{8}x

$$ $$
 *
$$\displaystyle (Eq. 23)
 * }
 * }

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

P'_5(x) = \frac{315}{8}x^4 - \frac{105}{4}x^2+\frac{15}{8}; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 24)
 * }
 * }

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

P_6(x) = \frac{231}{16} x^6 - \frac{315}{16} x^4 + \frac{105}{16} x^2 - \frac{5}{16}; $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 25)
 * }.
 * }.

Substituting (23), (24), (25) into equation (6),

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

w_j = \frac{-2}{6(\frac{315}{8}x^4 - \frac{105}{4}x^2+\frac{15}{8})(\frac{231}{16} x^6 - \frac{315}{16} x^4 + \frac{105}{16} x^2 - \frac{5}{16})}; \forall j = 1,2,3,4,5 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 26)
 * }.
 * }.

When $$\displaystyle P_5(x) = 0 $$,

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

\Rightarrow\ x_1 = - \sqrt{\frac{35+\sqrt{280}}{63}} = - \frac{1}{3}\sqrt{5+2\sqrt{\frac{10}{7}}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 27)
 * }
 * }

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

\Rightarrow\ x_2 = - \sqrt{\frac{35-\sqrt{280}}{63}} = - \frac{1}{3}\sqrt{5-2\sqrt{\frac{10}{7}}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 28)
 * }
 * }

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

\Rightarrow\ x_3 = 0 $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 29)
 * }
 * }

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

\Rightarrow\ x_4 = \sqrt{\frac{35-\sqrt{280}}{63}} = \frac{1}{3}\sqrt{5-2\sqrt{\frac{10}{7}}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 30)
 * }
 * }

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

\Rightarrow\ x_5 = \sqrt{\frac{35+\sqrt{280}}{63}} = \frac{1}{3}\sqrt{5+2\sqrt{\frac{10}{7}}} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 31)
 * }.
 * }.

Substituting equations (29) into (26),

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

$$\displaystyle \Rightarrow\ w_3 = \frac{128}{225} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 32)
 * }.
 * }.

Substituting equations (28) and (30) into (26),

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

$$\displaystyle \Rightarrow\ w_{2,4} = \frac{322+13\sqrt{70}}{900} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 32)
 * }.
 * }.

Substituting equations (27) and (31) into (26),

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

$$\displaystyle \Rightarrow\ w_{1,5} = \frac{322-13\sqrt{70}}{900} $$ $$
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style="width:15%; padding:10px; border:2px solid #8888aa" |
 * style= |
 *
$$\displaystyle (Eq. 32)
 * }.
 * }.

3.

(i). The numerical values when $$\displaystyle n = 1 $$ are given by equation (8).

(ii). The numerical values when $$\displaystyle n = 2 $$ are,

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

x_{1,2} = \bigg\{\frac{-1}{\sqrt{3}},\frac{1}{\sqrt{3}} \bigg\};\ w_{1,2} = \bigg\{1,1 \bigg\} $$
 * $$\displaystyle
 * $$\displaystyle

 * }
 * }

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} x_1 \\ x_2 \\ \end{bmatrix} = \begin{bmatrix} \frac{-1}{\sqrt{3}} \\ \frac{1}{\sqrt{3}} \\ \end{bmatrix} = \begin{bmatrix} -5.773502691896258 \cdot 10^{-1} \\ 5.773502691896258 \cdot 10^{-1} \\ \end{bmatrix}

$$ $$
 *
$$\displaystyle (Eq. 33)
 * },
 * },

and,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} w_1 \\ w_2 \\ \end{bmatrix} = \begin{bmatrix} 1.0000000000000000 \\ 1.0000000000000000 \\ \end{bmatrix} $$ $$
 *
$$\displaystyle (Eq. 34)
 * }.
 * }.

(iii). When $$\displaystyle n = 3 $$,

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

w_j = \frac{-2}{(4)(\frac{1}{2})(15x^2-3)(\frac{35}{8}x^4 - \frac{15}{4}x^2 + \frac{3}{8})} $$
 * $$\displaystyle
 * $$\displaystyle

$$
 *
$$\displaystyle (Eq. 35)
 * },
 * },

the numerical values are calculated to be,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ \end{bmatrix} = \begin{bmatrix} -7.745966692414834 \cdot 10^{-1} \\ 0.000000000000000 \\   7.745966692414834 \cdot 10^{-1} \\ \end{bmatrix}

$$ $$
 *
$$\displaystyle (Eq. 36)
 * },
 * },

and,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} w_1 \\ w_2 \\ w_3 \\ \end{bmatrix} = \begin{bmatrix} 5.555555555555554 \cdot 10^{-1} \\ 8.888888888888888 \cdot 10^{-1} \\ 5.555555555555554 \cdot 10^{-1} \\ \end{bmatrix} $$ $$
 *
$$\displaystyle (Eq. 37)
 * }.
 * }.

Matlab source code:

.

(iv). When $$\displaystyle n = 4 $$, the expression for $$\displaystyle w_j $$ is given by equation (16) and the numerical values are,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ \end{bmatrix} = \begin{bmatrix} -8.611363115940526 \cdot 10^{-1} \\ -3.399810435848563 \cdot 10^{-1} \\ 3.399810435848563 \cdot 10^{-1} \\ 8.611363115940526 \cdot 10^{-1} \\ \end{bmatrix}

$$ $$
 *
$$\displaystyle (Eq. 38)
 * },
 * },

and,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \\ \end{bmatrix} = \begin{bmatrix} 3.478548451374542 \cdot 10^{-1}\\ 6.521451548625461 \cdot 10^{-1}\\ 6.521451548625461 \cdot 10^{-1}\\ 3.478548451374542 \cdot 10^{-1}\\ \end{bmatrix} $$ $$
 *
$$\displaystyle (Eq. 39)
 * }.
 * }.

Matlab source code:

.

(v). When $$\displaystyle n = 5 $$, the expression for $$\displaystyle w_j $$ is given by equation (26) and the numerical values are,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ \end{bmatrix} = \begin{bmatrix} -9.061798459386641 \cdot 10^{-1} \\ -5.384693101056831 \cdot 10^{-1} \\ 0 \\   5.384693101056831 \cdot 10^{-1} \\ 9.061798459386641 \cdot 10^{-1} \\ \end{bmatrix}

$$ $$
 *
$$\displaystyle (Eq. 40)
 * },
 * },

and,

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

\Rightarrow
 * $$\displaystyle
 * $$\displaystyle

\begin{bmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \\ w_5 \\ \end{bmatrix} = \begin{bmatrix} 2.369268850561896 \cdot 10^{-1} \\ 4.786286704993663 \cdot 10^{-1} \\ 5.688888888888889 \cdot 10^{-1} \\ 4.786286704993663 \cdot 10^{-1} \\ 2.369268850561896 \cdot 10^{-1} \\ \end{bmatrix} $$ $$
 *
$$\displaystyle (Eq. 41)
 * }.
 * }.

Matlab source code:

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

The equations (8), (33), (34), (36), (37), (38), (39), (40) and (41) match the numerical values given by Abramovitz & Stegum's table.
 * style="width:78%; padding:10px; border:2px solid #8888aa" |
 * style="width:78%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * }.
 * }.

= Problem 15: Second Solution to the 0th Legendre Polynomial = From lecture slide 36-4

Given
The second solution to the 0th Legendre polynomial is
 * {| style="width:100%" border="0" align="left"

Q_0 = \frac{1}{2} \log \left(\frac{1 + x}{1 - x}\right) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 1)
 * }
 * }

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

Q_0 = \frac{1}{2} \log \left(\frac{1 + x}{1 - x}\right) = \tanh^{-1}(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 2)
 * }
 * }

Solution
We have that
 * {| style="width:100%" border="0" align="left"

\tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} $$ $$ If Eq. 2 holds, then $$\displaystyle \tanh(Q_0) = x$$. Hence, we substitute Eq. 1 into Eq. 3
 * $$\displaystyle
 * $$\displaystyle
 *
$$\displaystyle (Eq. 3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\tanh(Q_0) = \frac{e^{Q_0} - e^{-Q_0}}{e^{Q_0} + e^{-Q_0}} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

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

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

= \frac{\sqrt{\frac{1+x}{1-x}} - \sqrt{\frac{1-x}{1+x}}} {\sqrt{\frac{1+x}{1-x}} + \sqrt{\frac{1-x}{1+x}}} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= \frac{\sqrt{\frac{(1+x)^2}{1-x^2}} - \sqrt{\frac{(1-x)^2}{1-x^2}}} {\sqrt{\frac{(1+x)^2}{1-x^2}} + \sqrt{\frac{(1-x)^2}{1-x^2}}} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= \frac{\sqrt{(1+x)^2} - \sqrt{(1-x)^2}} {\sqrt{(1+x)^2} + \sqrt{(1-x)^2}} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= \frac{1+x -1 +x} {1+x +1-x} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

= \frac{2x} {2} $$
 * $$\displaystyle
 * $$\displaystyle
 *

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

$$\displaystyle = x $$ $$
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 * style="width:2%; padding:10px; border:2px solid #8888aa" |
 *
$$\displaystyle (Eq. 4)
 * }.
 * }.

= Notes and references =

= Contributing Team Members =

Egm6321.f09.Team1.vasquez 04:51, 14 November 2009 (UTC)

Egm6321.f09.Team1.sallstrom 21:01, 14 November 2009 (UTC)

Egm6321.f09.Team1.AH 18:55, 16 November 2009 (UTC)

Egm6321.f09.Team1.andy 04:54, 17 November 2009 (UTC)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: User:Egm6321.f09.Team1/HW6


text:
User:Higherground

Space for rent.

title: User:Higherground


text:
UTPA STEM/CBI Courses/Computer Networks/Socket Programming

Course Title: Computer Networks

Lecture Topic: Socket Programming

Instructor: Fang Liu

Institution: University of Texas - Pan American

Backwards Design
Course Objectives

 * Primary Objectives- By the next class period students will be able to:
 * Build a client/server networking program with TCP/IP socket programming

 * Sub Objectives- The objectives will require that students be able to:
 * Understand the concept of a client-server model
 * Understand how to identify communicating processes
 * Understand the differences in TCP and UDP
 * Understand how to request a port number and find out what the assigned port number is.
 * Understand the existence of different data representation formats in different computer systems and the necessity to convert to the standard form before sending out data onto the internet.

 * Difficulties- Students may have difficulty:
 * Allowing a server to accept multiple clients
 * Sending message to multiple clients.

 * Real-World Contexts- There are many ways that students can use this material in the real-world, such as:
 * Online/networking chatting programs are used every day. Examples include msn messenger, yahoo messenger, etc. Students will have a better understanding of the client-server model, the TCP/UDP transport protocols, BSD socket programming after building their own conferencing programs.

Model of Knowledge

 * Concept Map
 * Identification of processes with sockets.
 * Understanding sockets are the interface to call for transport layer services.
 * Understanding the functions supported by transport layer.
 * Understanding the difference between TCP and UDP transport service.

 * Content Priorities
 * Enduring Understanding
 * Understand how to establish client/server communications with socket programming.
 * Important to Do and Know
 * Become familiar with BSD sockets.
 * Worth Being Familiar with
 * Understand the client/server communication model.

Assessment of Learning

 * Formative Assessment
 * In Class (groups)
 * Discussion of the client/server model.
 * Discussion of the identification of processes with sockets.
 * Discussion of the difference between TCP and UDP.
 * Homework (individual)
 * Development of a simple TCP-based client/server communication system.
 * Internet based search of existent client/server applications developed with BSD sockets.

 * Summative Assessment
 * Group discussion the conclusions.

Legacy Cycle
OBJECTIVE

By the next class period, students will be able to: The objectives will require that students be able to:
 * Understand how to call BSD sockets to enable the communication between clients and servers.
 * Explain how the web messengers (e.g. msn, yahoo, google talk, etc.) allow the communications among online users.

THE CHALLENGE

Suppose you are required to build a conferencing program (like msn/yahoo messenger) that enables conversation between multiple conference users. All the connected users can receive all the messages transmitted by any of the users. The group communication is facilitated by a conference server. A user sends a message to the server, and the server relays that text to all the other clients. Each user receives the text relayed by the server and displays it on the screen. How would you do it?

GENERATE IDEAS

 * Students will investigate one of the popular web messengers and how it works.
 * Students will investigate how to request a socket port number and identify a socket.
 * Students will investigate how to allow a server to listen to multiple clients.

MULTIPLE PERSPECTIVES

Students will discuss their ideas through brain storming before developing their own web programs.

RESEARCH & REVISE

Once data is collected, students will discuss their methods in developing their own conferencing programs and draw conclusions.

TEST YOUR METTLE

Students will compare their results against their peers’ observations and conclusions.

GO PUBLIC

Students will discuss their results among themselves and in front of the class.

Test Your Mettle Quiz
True or False?

 * 1) Sockets provide an application programming interface (API) for the TCP/IP protocol stack.
 * 2) Sockets allow the delivery of incoming data packets to the appropriate application process or thread based on a combination of local and remote IP addresses and port numbers.
 * 3) A process associates with a particular port to send and receive data.
 * 4) A socket is created by the process and bound to a socket address which consists of a combination of a port number and an IP address.
 * 5) A port number is a 32-bit unsigned integer.
 * 6) High port numbers are usually used by applications implementing common services.
 * 7) The port number of a server is usually publicly known, while the clients need to notify the server about their port numbers.
 * 8) Stream sockets, also known as connectionless sockets, use User Datagram Protocol (UDP).
 * 9) Datagram sockets, also known as connection-oriented sockets, use Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP).
 * 10) A TCP server may not serve several clients concurrently.
 * 11) UDP provides reliable, ordered delivery of a stream of bytes from a program on one computer to another program on another computer.
 * 12) TCP is a connectionless protocol with no guarantee of delivery.
 * 13) A blocking socket will not return control until it has sent (or received) all data specified for the operation.
 * 14) Socket creates a new socket of a certain socket type, identified by an integer number, and allocates system resources to it.
 * 15) Bind is typically used on the client side, and associates a socket with a socket address structure, i.e. a specified local port number and IP address.
 * 16) Listen is used on the client side, and causes a bound TCP socket to enter listening state.
 * 17) Connect is used on the client side, and assigns a free local port number to a socket.
 * 18) Accept is used on the server side. It accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection.
 * 19) Close causes the system to release resources allocated to a socket. In case of TCP, the connection is terminated.
 * 20) Select is used to prune a provided list of sockets for those that are ready to read, ready to write or have errors.


text:
User talk:Musicfan~enwikiversity

 Hello Musicfan, and welcome to Wikiversity! If you need help, feel free to visit my talk page, or contact us and ask questions. After you leave a comment on a talk page, remember to sign and date; it helps everyone follow the threads of the discussion. The signature icon in the edit window makes it simple. To get started, you may

 * Take a guided tour and learn to edit.
 * Visit a (kind of) random project.
 * Browse Wikiversity, or visit a portal corresponding to your educational level: pre-school, primary, secondary, tertiary, non-formal education.
 * Find out about research activities on Wikiversity.

 * Read an introduction for teachers and find out how to write an educational resource for Wikiversity.
 * Give feedback about your initial observations
 * Discuss Wikiversity issues or ask questions at the colloquium.
 * Chat with other Wikiversitans on #wikiversity-en.

And don't forget to explore Wikiversity with the links to your left. Be bold to contribute and to experiment with the sandbox or your userpage, and see you around Wikiversity! If you're a twitter user, please follow http://twitter.com/Wikiversity. --Mu301Bot 08:17, 14 November 2009 (UTC)

Feel free to leave a message on my talk page if you have any questions or need help. --mikeu talk 08:17, 14 November 2009 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Musicfan. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Musicfan~enwikiversity that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:39, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 06:16, 19 April 2015 (UTC)

title: User talk:Musicfan~enwikiversity


text:
User talk:Meryle

 Hello Meryle, and welcome to Wikiversity! If you need help, feel free to visit my talk page, or contact us and ask questions. After you leave a comment on a talk page, remember to sign and date; it helps everyone follow the threads of the discussion. The signature icon in the edit window makes it simple. To get started, you may

 * Take a guided tour and learn to edit.
 * Visit a (kind of) random project.
 * Browse Wikiversity, or visit a portal corresponding to your educational level: pre-school, primary, secondary, tertiary, non-formal education.
 * Find out about research activities on Wikiversity.

 * Read an introduction for teachers and find out how to write an educational resource for Wikiversity.
 * Give feedback about your initial observations
 * Discuss Wikiversity issues or ask questions at the colloquium.
 * Chat with other Wikiversitans on #wikiversity-en.

And don't forget to explore Wikiversity with the links to your left. Be bold to contribute and to experiment with the sandbox or your userpage, and see you around Wikiversity! If you're a twitter user, please follow http://twitter.com/Wikiversity. --Mu301Bot 08:18, 14 November 2009 (UTC)

Feel free to leave a message on my talk page if you have any questions or need help. --mikeu talk 08:18, 14 November 2009 (UTC)

title: User talk:Meryle


text:
User talk:Babalon~enwikiversity

 Hello Babalon, and welcome to Wikiversity! If you need help, feel free to visit my talk page, or contact us and ask questions. After you leave a comment on a talk page, remember to sign and date; it helps everyone follow the threads of the discussion. The signature icon in the edit window makes it simple. To get started, you may

 * Take a guided tour and learn to edit.
 * Visit a (kind of) random project.
 * Browse Wikiversity, or visit a portal corresponding to your educational level: pre-school, primary, secondary, tertiary, non-formal education.
 * Find out about research activities on Wikiversity.

 * Read an introduction for teachers and find out how to write an educational resource for Wikiversity.
 * Give feedback about your initial observations
 * Discuss Wikiversity issues or ask questions at the colloquium.
 * Chat with other Wikiversitans on #wikiversity-en.

And don't forget to explore Wikiversity with the links to your left. Be bold to contribute and to experiment with the sandbox or your userpage, and see you around Wikiversity! If you're a twitter user, please follow http://twitter.com/Wikiversity. --Mu301Bot 08:18, 14 November 2009 (UTC)

Feel free to leave a message on my talk page if you have any questions or need help. --mikeu talk 08:18, 14 November 2009 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Babalon. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Babalon~enwikiversity that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:29, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 06:03, 19 April 2015 (UTC)

title: User talk:Babalon~enwikiversity