User:Egm6341.s11.team4.yang/hw2

=Homework 2.5= Refer to lecture slide [[media:nm1.s11.mtg7.djvu|mtg-7]] for the problem statement.

Given
Gauss-legendre quadrature:

Objectives
Verify this table against NIST handbook (lecture plan).

Solution
According to the Legendre polynomial in lecture note [[media:nm1.s11.mtg8.djvu|mtg-8]], {  Xi, i=1….n }  is the root of Legendre Polynomial of order n, and the associated weight with Xi is :
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{W_i} = \frac

$$     (Eq 5.1 ) where the Legendre Polynomial is:
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_n}(x) = \sum\limits_{i = 0}^{[n/2]} \frac

$$     (Eq 5.2 )
 * 
 * }.
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_1}(x) = x

$$     (Eq 5.3 )
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

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

$$     (Eq 5.4 )
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_3}(x) = \frac{1}{2}(5{x^3} - 3x)

$$     (Eq 5.5)
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

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

$$     (Eq 5.6)
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_5}(x) = \frac{8}{x^5} - \frac{8}{x^3} + \frac{8}x

$$     (Eq 5.7 )
 * 
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_6}(x) = \frac{x^6} - \frac{x^4} + \frac{x^2} - \frac{5}

$$     (Eq 5.8 )
 * 
 * }

1). When n=1, the root of P1(x)=0 is:
 * {| style="width:100%" border="0"

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

{x_{1}} = 0

$$     (Eq 5.9 )
 * 
 * }

And the weight is:
 * {| style="width:100%" border="0"

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

{{W}_{1}}=\frac{-2}{(1+1)[P_{1}^{'}({{x}_{1}}){{P}_{2}}({{x}_{1}})]}=\frac{-2}{(1+1)[1\centerdot (3{{x}_{1}}^{2}-1)/2]}=\frac{-2}{(1+1)[1\centerdot (3\centerdot 0-1)/2]}=1

$$     (Eq 5.10 )
 * 
 * }

2). When n=2, the root of P2(x)=0 is:
 * {| style="width:100%" border="0"

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

{x_{1,2}} = \pm 1/\sqrt 3

$$     (Eq 5.11 )
 * 
 * }

And the weight is:
 * {| style="width:100%" border="0"

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

{{W}_{1}}=\frac{-2}{(2+1)[P_{2}^{'}({{x}_{1}}){{P}_{3}}({{x}_{1}})]}=\frac{-2}{(2+1)[(3{{x}_{1}})\centerdot (5{{x}_{1}}^{3}-3{{x}_{1}})/2]}=1

$$     (Eq 5.12 )
 * 
 * }
 * {| style="width:100%" border="0"

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

{{W}_{2}}=\frac{-2}{(2+1)[P_{2}^{'}({{x}_{2}}){{P}_{3}}({{x}_{2}})]}=\frac{-2}{(2+1)[(3{{x}_{2}})\centerdot (5{{x}_{2}}^{3}-3{{x}_{2}})/2]}=1

$$     (Eq 5.13 )
 * 
 * }

3). When n=3, the root of P3(x)=0 is:
 * {| style="width:100%" border="0"

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

{x_1} = 0,\begin{array}{ccccccccccccccc} {}&{{x_{2,3}} = \pm \sqrt {15} /5} \end{array}

$$     (Eq 5.14 )
 * 
 * }

And the weight is:
 * {| style="width:100%" border="0"

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

{{W}_{1}}=\frac{-2}{(3+1)[P_{3}^{'}({{x}_{1}}){{P}_{4}}({{x}_{1}})]}=\frac{-2}{(3+1)[(15{{x}_{1}}^{2}-3)/2\centerdot (\frac{35}{8}{{x}_{1}}^{4}-\frac{15}{4}{{x}_{1}}^{2}+\frac{3}{8})]}=\frac{8}{9}

$$     (Eq 5.15 )
 * 
 * }
 * {| style="width:100%" border="0"

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

{{W}_{2}}=\frac{-2}{(3+1)[P_{3}^{'}({{x}_{2}}){{P}_{4}}({{x}_{2}})]}=\frac{-2}{(3+1)[(15{{x}_{2}}^{2}-3)/2\centerdot (\frac{35}{8}{{x}_{2}}^{4}-\frac{15}{4}{{x}_{2}}^{2}+\frac{3}{8})]}=\frac{5}{9}

$$     (Eq 5.16)
 * 
 * }
 * {| style="width:100%" border="0"

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

{{W}_{3}}=\frac{-2}{(3+1)[P_{3}^{'}({{x}_{3}}){{P}_{4}}({{x}_{3}})]}=\frac{-2}{(3+1)[(15{{x}_{3}}^{2}-3)/2\centerdot (\frac{35}{8}{{x}_{3}}^{4}-\frac{15}{4}{{x}_{3}}^{2}+\frac{3}{8})]}=\frac{5}{9}

$$     (Eq 5.17)
 * <p style="text-align:right">
 * }

4). When n=4, the root of P4(x)=0 is:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

\frac{8}{x^4} - \frac{4}{x^2} + \frac{3}{8} = 0

$$     (Eq 5.18)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{x^2} = (3 \pm 2\sqrt {6/5} )/7

$$     (Eq 5.19)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{x_{1,2}} = \pm \sqrt {(3 + 2\sqrt {6/5} )/7}

$$     (Eq 5.20 )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{x_{3,4}} = \pm \sqrt {(3 - 2\sqrt {6/5} )/7}

$$     (Eq 5.21 )
 * <p style="text-align:right">
 * }

And the weight is:
 * {| style="width:100%" border="0"

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

{{W}_{1}}=\frac{-2}{(4+1)[P_{4}^{'}({{x}_{1}}){{P}_{5}}({{x}_{1}})]}=\frac{-2}{(4+1)[(\frac{35}{2}{{x}_{1}}^{3}-\frac{15}{2}{{x}_{1}})\centerdot (\frac{63}{8}{{x}_{1}}^{5}-\frac{70}{8}{{x}_{1}}^{3}+\frac{15}{8}{{x}_{1}})]}=(18-\sqrt{30})/36

$$     (Eq 5.22 )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{W}_{2}}=\frac{-2}{(4+1)[P_{4}^{'}({{x}_{2}}){{P}_{5}}({{x}_{2}})]}=\frac{-2}{(4+1)[(\frac{35}{2}{{x}_{2}}^{3}-\frac{15}{2}{{x}_{2}})\centerdot (\frac{63}{8}{{x}_{2}}^{5}-\frac{70}{8}{{x}_{2}}^{3}+\frac{15}{8}{{x}_{2}})]}=(18-\sqrt{30})/36

$$     (Eq 5.23 )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{W}_{3}}=\frac{-2}{(4+1)[P_{4}^{'}({{x}_{3}}){{P}_{5}}({{x}_{3}})]}=\frac{-2}{(4+1)[(\frac{35}{2}{{x}_{3}}^{3}-\frac{15}{2}{{x}_{3}})\centerdot (\frac{63}{8}{{x}_{3}}^{5}-\frac{70}{8}{{x}_{3}}^{3}+\frac{15}{8}{{x}_{3}})]}=(18+\sqrt{30})/36

$$     (Eq 5.24)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{W}_{4}}=\frac{-2}{(4+1)[P_{4}^{'}({{x}_{4}}){{P}_{5}}({{x}_{4}})]}=\frac{-2}{(4+1)[(\frac{35}{2}{{x}_{4}}^{3}-\frac{15}{2}{{x}_{4}})\centerdot (\frac{63}{8}{{x}_{4}}^{5}-\frac{70}{8}{{x}_{4}}^{3}+\frac{15}{8}{{x}_{4}})]}=(18+\sqrt{30})/36

$$     (Eq 5.25)
 * <p style="text-align:right">
 * }

5). When n=5, the root of P5(x)=0 is:
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{P_5}(x) = \frac{8}{x^5} - \frac{8}{x^3} + \frac{8}x

$$     (Eq 5.26)
 * <p style="text-align:right">
 * }


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

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{x_1} = 0,\begin{array}{ccccccccccccccc} {}&{{{({x_{2,3,4,5}})}^2} = (5 \pm 2\sqrt {10/7} )/9} \end{array}

$$     (Eq 5.27)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{x_{2,3}} = \pm \sqrt {(5 + 2\sqrt {10/7} )} /3

$$     (Eq 5.28)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{x_{4,5}} = \pm \sqrt {(5 - 2\sqrt {10/7} )} /3

$$     (Eq 5.29)
 * <p style="text-align:right">
 * }

And the weight is:
 * {| style="width:100%" border="0"

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

\begin{align} & {{W}_{1}}=\frac{-2}{(5+1)[P_{5}^{'}({{x}_{1}}){{P}_{6}}({{x}_{1}})]}=\frac{-2}{(5+1)[(\frac{315}{8}{{x}_{1}}^{4}-\frac{210}{8}{{x}_{1}}^{2}+\frac{15}{8})\centerdot (\frac{231}{16}{{x}_{1}}^{6}-\frac{315}{16}{{x}_{1}}^{4}+\frac{105}{16}{{x}_{1}}^{2}-\frac{5}{16})]} \\ & =128/225 \\ \end{align}

$$     (Eq 5.30)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

\begin{align} & {{W}_{2}}=\frac{-2}{(5+1)[P_{5}^{'}({{x}_{2}}){{P}_{6}}({{x}_{2}})]}=\frac{-2}{(5+1)[(\frac{315}{8}{{x}_{2}}^{4}-\frac{210}{8}{{x}_{2}}^{2}+\frac{15}{8})\centerdot (\frac{231}{16}{{x}_{2}}^{6}-\frac{315}{16}{{x}_{2}}^{4}+\frac{105}{16}{{x}_{2}}^{2}-\frac{5}{16})]} \\ & =(322-13\sqrt{70})/900 \\ \end{align}

$$     (Eq 5.31)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

\begin{align} & {{W}_{3}}=\frac{-2}{(5+1)[P_{5}^{'}({{x}_{3}}){{P}_{6}}({{x}_{3}})]}=\frac{-2}{(5+1)[(\frac{315}{8}{{x}_{3}}^{4}-\frac{210}{8}{{x}_{3}}^{2}+\frac{15}{8})\centerdot (\frac{231}{16}{{x}_{3}}^{6}-\frac{315}{16}{{x}_{3}}^{4}+\frac{105}{16}{{x}_{3}}^{2}-\frac{5}{16})]} \\ & =(322-13\sqrt{70})/900 \\ \end{align}

$$     (Eq 5.32)
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

\begin{align} & {{W}_{4}}=\frac{-2}{(5+1)[P_{5}^{'}({{x}_{4}}){{P}_{6}}({{x}_{4}})]}=\frac{-2}{(5+1)[(\frac{315}{8}{{x}_{4}}^{4}-\frac{210}{8}{{x}_{4}}^{2}+\frac{15}{8})\centerdot (\frac{231}{16}{{x}_{4}}^{6}-\frac{315}{16}{{x}_{4}}^{4}+\frac{105}{16}{{x}_{4}}^{2}-\frac{5}{16})]} \\ & =(322+13\sqrt{70})/900 \\ \end{align}

$$     (Eq 5.33 )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

\begin{align} & {{W}_{5}}=\frac{-2}{(5+1)[P_{5}^{'}({{x}_{5}}){{P}_{6}}({{x}_{5}})]}=\frac{-2}{(5+1)[(\frac{315}{8}{{x}_{5}}^{4}-\frac{210}{8}{{x}_{5}}^{2}+\frac{15}{8})\centerdot (\frac{231}{16}{{x}_{5}}^{6}-\frac{315}{16}{{x}_{5}}^{4}+\frac{105}{16}{{x}_{5}}^{2}-\frac{5}{16})]} \\ & =(322+13\sqrt{70})/900 \\ \end{align}

$$     (Eq 5.34)
 * <p style="text-align:right">
 * }

=Homework 2.6=

Refer to lecture slide [[media:nm1.s11.mtg8.djvu|mtg-8]] for the problem statement.

Given
Legendre polynomial is given by:


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

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{{P}_{n}}(x)=\sum\limits_{i=0}^{[n/2]}\frac{(2n-2i)!{{x}^{n-2i}}}{{{2}^{n}}i!(n-2i)!(n-i)!}

$$     (Eq 6.1)
 * <p style="text-align:right">
 * }

Where [ n/2 ] denotes the integer part of n/2, e.g. n=5, [ n/2 ] =2.
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{{P}_{0}}(x)=1

$$     (Eq )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{{P}_{1}}(x)=x

$$     (Eq )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{{P}_{2}}(x)=\frac{1}{2}(3{{x}^{2}}-1)

$$     (Eq )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

{{P}_{3}}(x)=\frac{1}{2}(5{{x}^{3}}-3x)

$$     (Eq )
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ \displaystyle
 * style="width:95%" |
 * style="width:95%" |

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

$$     (Eq )
 * <p style="text-align:right">
 * }

Objectives
Verify P0(x) – P4(x) using the Legendre polynomial.

Solutions
1). When n=0, [ n/2 ] =0, the Equation (6-1) becomes:
 * {| style="width:100%" border="0"

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

{{P}_{0}}(x)={{(-1)}^{0}}\frac{0!{{x}^{0}}}{{{2}^{0}}\centerdot 0!\centerdot 0!}=1

$$     (Eq 6.2 ) 2). When n=1, [ n/2 ] =0, the Equation (6-1) becomes:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{P}_{1}}(x)={{(-1)}^{0}}\frac{2!{{x}^{1}}}{{{2}^{1}}\centerdot 0!\centerdot 0!}=x

$$     (Eq 6.3) 3). When n=2, [ n/2 ] =1, the Equation (6-1) becomes:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{P}_{2}}(x)={{(-1)}^{0}}\frac{4!{{x}^{2}}}{{{2}^{2}}\centerdot 2!\centerdot 2!}+{{(-1)}^{1}}\frac{2!{{x}^{0}}}{{{2}^{2}}\centerdot 1!\centerdot 0!}=\frac{1}{2}(3{{x}^{2}}-1)

$$     (Eq 6.4) 4). When n=3, [ n/2 ] =1, the Equation (6-1) becomes:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{P}_{3}}(x)={{(-1)}^{0}}\frac{6!{{x}^{3}}}{{{2}^{3}}\centerdot 3!\centerdot 3!}+{{(-1)}^{1}}\frac{4!{{x}^{0}}}{{{2}^{3}}\centerdot 1!\centerdot 1!\centerdot 2!}=\frac{1}{2}(5{{x}^{3}}-3x)

$$     (Eq 6.5) 5). When n=4, [ n/2 ] =2, the Equation (6-1) becomes:
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

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

{{P}_{4}}(x)={{(-1)}^{0}}\frac{8!{{x}^{4}}}{{{2}^{4}}\centerdot 4!\centerdot 4!}+{{(-1)}^{1}}\frac{6!{{x}^{2}}}{{{2}^{4}}\centerdot 1!\centerdot 2!\centerdot 3!}+{{(-1)}^{2}}\frac{4!{{x}^{0}}}{{{2}^{4}}\centerdot 2!\centerdot 0!\centerdot 2!}=\frac{35}{8}{{x}^{4}}-\frac{15}{4}{{x}^{2}}+\frac{3}{8}

$$     (Eq 6.6)
 * <p style="text-align:right">
 * }