Line 629:
Line 629:
({{EquationRef|Eq 7-3}}) then becomes <ref>http://ice.uchicago.edu/2012_presentations/Faculty/Judd/Quadrature_ICE11.pdf</ref>:
({{EquationRef|Eq 7-3}}) then becomes <ref>http://ice.uchicago.edu/2012_presentations/Faculty/Judd/Quadrature_ICE11.pdf</ref>:
{{NumBlk|::|<math>\int_{a}^{+\infty} e^{-y} g(y)\,dx \approx e^{-a} \sum_{i=1}^n w_i \, g(x_i+a) </math> |{{EquationRef|Eq 7-7}}|}}
{{NumBlk|::|<math>\int_{a}^{+\infty} e^{-y} g(y)\,dy \approx e^{-a} \sum_{i=1}^n w_i \, g(x_i+a) </math> |{{EquationRef|Eq 7-7}}|}}
⚫
A numerical python (NumPy) script was written to test the quadrature for
this integral. The source code is given below:
⚫
A numerical python (NumPy) script was written to test the quadrature for
the integral
in ({{EquationRef|Eq 7-1}}) . The source code is given below:
(Note: NumPy is an opensource
<source lang="python">
<source lang="python">
#################################################################################
#################################################################################
Line 714:
Line 714:
plt.show()
plt.show()
</source>
</source>
Script terminal output:
<pre>
n=4
0.145107525093
n=16
0.162236347114
n=100
0.172558662198
exact
0.195247541983
</pre>
Plot generated by script:
[[image:LogarithmicConvergence.png|frame|center|Figure 7.1: Convergence of ({{EquationRef| 7-1}}) with increasing integration points]]
The above script uses NumPy's Laguerre module quadrature routine: numpy.polynomial.laguerre.laggauss(deg). This routine solves the roots of the Laguerre polynomials by first finding the eigenvalues of the [https://en.wikipedia.org/wiki/Companion_matrix Companion Matrix], and then applying an iteration of [https://en.wikipedia.org/wiki/Newton%27s_method Newton's Method] to improve accuracy.
[http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.polynomial.laguerre.laggauss.html#numpy.polynomial.laguerre.laggauss Documentation]
[https://github.com/numpy/numpy/blob/master/numpy/polynomial/laguerre.py#L1647 source]
The above script uses ({{EquationRef| 7-5}}) to calculate ({{EquationRef| 7-1}}).
{{NumBlk|::|<math>\int_{2}^{+\infty} e^{-y} \left ( e^{-y} \frac{1}{y \log^2(y)} \right ) \,dy \approx e^{-2} \sum_{i=1}^n w_i \, g(x_i+2) </math> |{{EquationRef|Eq 7-8}}|}}
The script above compares favourably with values calculated by Dr. Burkardt <ref>http://people.sc.fsu.edu/~%20jburkardt/c_src/test_int_laguerre/test_int_laguerre_prb_output.txt</ref>.
<center><table class="wikitable">
<tr>
<td width="20%" align="center">''n''</td>
<td width="40%" align="center">''Python Script''</td>
<td align="center">''Dr. Burkardt''</td>
</tr>
<tr>
<td width="20%" align="center">4</td>
<td width="40%" align="center">0.145107525093</td>
<td align="center">0.145108</td>
</tr>
<tr>
<td width="20%" align="center">16</td>
<td width="40%" align="center">0.162236347114</td>
<td align="center">0.162236</td>
</tr>
<caption>Table 7.1 Comparison of quadrature calculations</caption>
</table>
</center>
As can be seen in Figure 1, even at 100 integration points there is still significant error or around 12 percent.
====Part b====
=Contributing Team Members=
=Contributing Team Members=
Report 2 PEA 2 Spring 2014 Team 2
Problems are given in lecture notes Sec66a
Problem 1
Here is a sample equation and a sample in-text reference to the equation.
P
N
(
u
)
=
u
+
∑
n
=
2
N
(
−
1
)
n
−
1
(
N
−
1
)
(
N
−
2
)
.
.
.
(
N
−
n
+
1
)
n
!
(
n
−
1
)
!
u
n
,
N
≥
2
{\displaystyle P_{N}(u)=u+\sum _{n=2}^{N}{(-1)^{n-1}{\frac {(N-1)(N-2)...(N-n+1)}{n!\,(n-1)!}}u^{n}},N\geq 2}
(Eq 1-1 )
Here is a link to (Eq 1-1 )
Problem Statement
The atomic-resolution TEM figure on p.66-16 is not obvious (not easy to see and to understand); search the literature (web, pdf papers, pdf reports, etc.) for better (good quality) figure(s) that show the dislocation at atomic level with a burger vector. for example, here is an image web search for “dislocation atomic TEM burger vector”.
Solution
R2.2 Roots of Associated Laguerre Polynomials
Problem Statement
Plot the associated Laguerre polynomials for
n
=
3
{\displaystyle n=3}
and
α
=
0
,
−
1
,
−
2
,
−
3
,
−
4
{\displaystyle \alpha =0,-1,-2,-3,-4}
. Use MATLAB to find the roots of
L
n
(
−
1
)
(
x
)
{\displaystyle L_{n}^{(-1)}(x)}
for
n
=
7
,
8
{\displaystyle n=7,8}
, and verify the numbers in the table on p.66a-7
Note: If you already have the plots made in report R1, you simply copy and paste these plots in report R2; the task then is only to find the roots of these polynomials.
Find
(a): Associated Laguerre polynomial plots
(b): Roots of Laguerre polynomials
(c): Verify numbers in the table on p.66-7
Solution
Part (a): Associated Laguerre Polynomial Plots
The plot was created using the Python scripting language.
Figure 1: Associated Laguerre Polynomial
L
3
(
α
)
{\displaystyle L_{3}^{(\alpha )}}
([1] )
Part (b): Roots of Associated Laguerre Polynomials
The roots of the associated Laguerre polynomial were computed using Wolfram Alpha. The syntax for creating associated Laguerre polynomials in Wolfram Alpha: LaguerreL[n,k,x] where n is the degree, k is the family of Laguerre polynomials, and x is the independent variable.
The Laguerre polynomial given by,
L
3
(
0
)
=
1
6
(
6
−
18
x
+
9
x
2
−
x
3
)
{\displaystyle L_{3}^{(0)}={\frac {1}{6}}(6-18x+9x^{2}-x^{3})}
(Eq 2-1 )
Has three roots. The approximate roots of the polynomial are:
x
≈
0.41577
{\displaystyle x\approx 0.41577}
x
≈
2.2943
{\displaystyle x\approx 2.2943}
x
≈
6.2899
{\displaystyle x\approx 6.2899}
The Laguerre polynomial given by,
L
3
(
−
1
)
=
1
6
(
−
6
x
+
6
x
2
−
x
3
)
{\displaystyle L_{3}^{(-1)}={\frac {1}{6}}(-6x+6x^{2}-x^{3})}
(Eq 2-2 )
Has three roots. The roots of the polynomial are:
x
=
0
{\displaystyle x=0}
x
=
3
−
(
3
)
{\displaystyle x=3-{\sqrt {(}}3)}
x
=
3
+
(
3
)
{\displaystyle x=3+{\sqrt {(}}3)}
The Laguerre polynomial given by,
L
3
(
−
2
)
=
1
6
(
3
x
2
−
x
3
)
{\displaystyle L_{3}^{(-2)}={\frac {1}{6}}(3x^{2}-x^{3})}
(Eq 2-3 )
Has three roots. The roots of the polynomial are:
x
=
0
{\displaystyle x=0}
x
=
0
{\displaystyle x=0}
x
=
3
{\displaystyle x=3}
The Laguerre polynomial given by,
L
3
(
−
3
)
=
−
x
3
6
{\displaystyle L_{3}^{(-3)}=-{\frac {x^{3}}{6}}}
(Eq 2-4 )
Has three roots. The roots of the polynomial are:
x
=
0
{\displaystyle x=0}
x
=
0
{\displaystyle x=0}
x
=
0
{\displaystyle x=0}
The Laguerre polynomial given by,
L
3
(
−
4
)
=
1
6
(
−
6
−
6
x
−
3
x
2
−
x
3
)
{\displaystyle L_{3}^{(-4)}={\frac {1}{6}}(-6-6x-3x^{2}-x^{3})}
(Eq 2-5 )
Has three roots. The roots of the polynomial are:
x
≈
−
1.5961
{\displaystyle x\approx -1.5961}
x
≈
−
0.7020
−
1.8073
i
{\displaystyle x\approx -0.7020-1.8073i}
x
≈
−
0.7020
+
1.8073
i
{\displaystyle x\approx -0.7020+1.8073i}
Part (c): Two Sets of Roots of Associated Laguerre Polynomials For
n
=
7
,
8
{\displaystyle n=7,8}
In this section we are asked to compute the roots of the associated Laguerre polynomials with
α
=
−
1
and
n
=
7
,
8
{\displaystyle \alpha =-1{\text{ and }}n=7,8}
. We are then asked to compare these results to previously tabulated results.
The Laguerre polynomial given by,
L
7
(
−
1
)
=
−
5040
x
+
15120
x
2
−
12600
x
3
+
4200
x
4
−
630
x
5
+
42
x
6
−
x
7
5040
{\displaystyle L_{7}^{(-1)}={\frac {-5040x+15120x^{2}-12600x^{3}+4200x^{4}-630x^{5}+42x^{6}-x^{7}}{5040}}}
(Eq 2-6 )
The following roots:
Associated Laguerre Polynomial Roots of
L
7
(
−
1
)
{\displaystyle L_{7}^{(-1)}}
Root #
Root
x
1
{\displaystyle x_{1}}
0
x
2
{\displaystyle x_{2}}
0.5277
x
3
{\displaystyle x_{3}}
1.796
x
4
{\displaystyle x_{4}}
3.877
x
5
{\displaystyle x_{5}}
6.919
x
6
{\displaystyle x_{6}}
11.235
x
7
{\displaystyle x_{7}}
17.65
The Laguerre polynomial given by,
L
8
(
−
1
)
=
−
40320
x
+
141120
x
2
−
141120
x
3
+
58800
x
4
−
11760
x
5
+
1176
x
6
−
56
x
7
+
x
8
40320
{\displaystyle L_{8}^{(-1)}={\frac {-40320x+141120x^{2}-141120x^{3}+58800x^{4}-11760x^{5}+1176x^{6}-56x^{7}+x^{8}}{40320}}}
(Eq 2-7 )
The following roots:
Associated Laguerre Polynomial Roots of
L
8
(
−
1
)
{\displaystyle L_{8}^{(-1)}}
Root #
Root
x
1
{\displaystyle x_{1}}
0
x
2
{\displaystyle x_{2}}
0.4610
x
3
{\displaystyle x_{3}}
1.564
x
4
{\displaystyle x_{4}}
3.352
x
5
{\displaystyle x_{5}}
5.916
x
6
{\displaystyle x_{6}}
9.421
x
7
{\displaystyle x_{7}}
14.19
x
8
{\displaystyle x_{8}}
21.09
Problem 3
(Eq 3-1 ) was given for the value of PN (u) and (Eq 3-2 ) through (Eq 3-4 ) were given for the Laguerre polynomials written with the same variables as (Eq 3-1 ) for comparisons.
P
N
(
u
)
=
u
+
∑
n
=
2
N
(
−
1
)
n
−
1
(
N
−
1
)
(
N
−
2
)
.
.
.
(
N
−
n
+
1
)
(
n
−
1
)
!
n
!
u
n
{\displaystyle P_{N}(u)=u+\sum _{n=2}^{N}{\dfrac {(-1)^{n-1}(N-1)(N-2)...(N-n+1)}{(n-1)!n!}}u^{n}}
(Eq 3-1 )
L
N
(
α
)
(
u
)
=
∑
n
=
0
N
(
α
+
n
+
1
)
N
−
n
(
N
−
n
)
!
n
!
(
−
u
)
n
{\displaystyle L_{N}^{(\alpha )}(u)=\sum _{n=0}^{N}{\dfrac {(\alpha +n+1)_{N-n}}{(N-n)!n!}}(-u)^{n}}
(Eq 3-2 )
L
N
(
α
)
(
u
)
=
∑
n
=
0
N
(
−
1
)
n
(
N
+
α
N
−
n
)
1
n
!
u
n
{\displaystyle L_{N}^{(\alpha )}(u)=\sum _{n=0}^{N}(-1)^{n}{N+\alpha \choose N-n}{\dfrac {1}{n!}}u^{n}}
(Eq 3-3 )
L
N
(
α
)
(
u
)
=
∑
n
=
0
N
(
−
u
)
n
(
N
n
)
∏
k
=
n
+
1
N
(
α
+
k
)
{\displaystyle L_{N}^{(\alpha )}(u)=\sum _{n=0}^{N}(-u)^{n}{N \choose n}\prod _{k=n+1}^{N}(\alpha +k)}
(Eq 3-4 )
Problem Statement
Compare (Eq 3-1 ) to the various finite power series expressions for the associated Laguerre polynomials in (Eq 3-2 ) through (Eq 3-4 ) as specified in R2.3: sec.66a, Pb-66-6.
Solution
On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.
The falling factorial term in (Eq 3-1 ) can be rewritten with a Pochhammer symbol .
P
N
(
u
)
=
u
+
∑
n
=
2
N
(
−
1
)
n
−
1
(
N
)
n
N
n
!
(
n
−
1
)
!
u
n
,
N
≥
2
{\displaystyle P_{N}(u)=u+\sum _{n=2}^{N}{(-1)^{n-1}{\frac {(N)_{n}}{N\,n!\,(n-1)!}}u^{n}},N\geq 2}
(Eq 3-5 )
Where,
(
N
)
n
=
N
(
N
−
1
)
(
N
−
2
)
.
.
.
(
N
−
n
+
1
)
{\displaystyle (N)_{n}=N(N-1)(N-2)...(N-n+1)}
(Eq 3-6 )
The Pochhammer symbol can be related to a binomial coefficient by the equation:
(
N
)
n
n
!
=
(
N
n
)
{\displaystyle {\frac {(N)_{n}}{n!}}={\binom {N}{n}}}
(Eq 3-7 )
Plugging (Eq 3-7 ) into (Eq 3-5 ) results in:
P
N
(
u
)
=
u
+
∑
n
=
2
N
(
N
n
)
(
−
1
)
n
−
1
N
(
n
−
1
)
!
u
n
{\displaystyle P_{N}(u)=u+\sum _{n=2}^{N}{\binom {N}{n}}{\frac {(-1)^{n-1}}{N(n-1)!}}u^{n}}
(Eq 3-8 )
The binomial coefficient has the following closed form for integer arguments:[ 1]
(
N
n
)
=
{
N
!
n
!
(
N
−
n
)
!
0
≤
n
≤
N
0
otherwise
{\displaystyle {\binom {N}{n}}=\left\{{\begin{matrix}{\frac {N!}{n!\,(N-n)!}}&0\leq n\leq N\\0&{\text{otherwise}}\end{matrix}}\right.}
(Eq 3-9 )
Substituting the closed form in (Eq 3-9 ) into (Eq 3-8 ) gives:
P
N
(
u
)
=
u
+
∑
n
=
2
N
(
N
−
1
)
!
(
−
1
)
n
−
1
(
N
−
n
)
!
(
n
−
1
)
!
n
!
u
n
{\displaystyle P_{N}(u)=u+\sum _{n=2}^{N}{\frac {(N-1)!\,(-1)^{n-1}}{(N-n)!\,(n-1)!\,n!}}u^{n}}
(Eq 3-10 )
For the the case where
α
=
−
1
{\displaystyle \alpha =-1}
, (Eq 3-3 ) has the form:
L
N
(
−
1
)
(
u
)
=
∑
n
=
0
N
(
N
−
1
N
−
n
)
(
−
1
)
n
n
!
(
−
u
)
n
{\displaystyle L_{N}^{(-1)}(u)=\sum _{n=0}^{N}{\binom {N-1}{N-n}}{\frac {(-1)^{n}}{n!}}(-u)^{n}}
(Eq 3-11 )
Using the expression (Eq 3-7 ) for the binomial term in (Eq 3-11 ) yields:
(
N
−
1
N
−
n
)
=
{
(
N
−
1
)
!
(
N
−
n
)
!
(
n
−
1
)
!
0
≤
N
−
n
≤
N
−
1
0
otherwise
{\displaystyle {\binom {N-1}{N-n}}=\left\{{\begin{matrix}{\frac {(N-1)!}{(N-n)!\,(n-1)!}}&0\leq N-n\leq N-1\\0&{\text{otherwise}}\end{matrix}}\right.}
(Eq 3-12 )
Plugging (Eq 3-12 ) into (Eq 3-11 ) gives:
L
N
(
−
1
)
(
u
)
=
∑
n
=
1
N
(
N
−
1
)
!
(
−
1
)
n
(
N
−
n
)
!
(
n
−
1
)
!
n
!
u
n
{\displaystyle L_{N}^{(-1)}(u)=\sum _{n=1}^{N}{\frac {(N-1)!\,(-1)^{n}}{(N-n)!\,(n-1)!\,n!}}u^{n}}
(Eq 3-13 )
It should be noted that the summation index in (Eq 1-13 ) changes from
n
=
0
{\displaystyle n=0}
to
n
=
1
{\displaystyle n=1}
. This is because when
n
=
0
{\displaystyle n=0}
the binomial coefficient is zero and cannot be represented by the factorial expression. This term must be brought outside of the sum, but since the term is zero, all that results is an index change.
The first term of (Eq 3-13 ) is brought outside the summation. To reproduce (Eq 3-8 )
L
N
(
−
1
)
(
u
)
=
u
+
∑
n
=
2
N
(
N
−
1
)
!
(
−
1
)
n
(
N
−
n
)
!
(
n
−
1
)
!
n
!
u
n
{\displaystyle L_{N}^{(-1)}(u)=u+\sum _{n=2}^{N}{\frac {(N-1)!\,(-1)^{n}}{(N-n)!\,(n-1)!\,n!}}u^{n}}
(Eq 3-14 )
Problem 4
The following equation is given for ds2<\sup>:
d
s
2
=
∑
i
=
1
3
(
d
x
i
)
2
{\displaystyle ds^{2}=\sum _{i=1}^{3}(dx_{i})^{2}}
(Eq 4-1 )
xi is written in spherical coordinates in (Eq 4-2 ) through (Eq 4-4 ).
x
1
=
r
c
o
s
θ
c
o
s
φ
{\displaystyle x_{1}=rcos{\theta }cos{\varphi }}
(Eq 4-2 )
x
2
=
r
c
o
s
θ
s
i
n
φ
{\displaystyle x_{2}=rcos{\theta }sin{\varphi }}
(Eq 4-3 )
x
3
=
r
s
i
n
θ
{\displaystyle x_{3}=rsin{\theta }}
(Eq 4-4 )
Problem Statement
Show that the infinitesimal length ds2 in (Eq 4-1 ) can be written in spherical coordinates, (Eq 4-5 ), as given in Pb.R*7.3 on pp.39-[1,3] of sec.39
of the notes.
d
s
2
=
d
r
2
+
r
2
d
θ
2
+
r
2
c
o
s
2
θ
d
φ
2
{\displaystyle ds^{2}=dr^{2}+r^{2}d{\theta }^{2}+r^{2}cos^{2}{\theta }d{\varphi }^{2}}
(Eq 4-5 )
Solution
On our honor, we did this assignment on our own, without looking at the solutions in previous semesters or other online solutions.
The derivatives of xi are given in (Eq 4-6 ) through (Eq 4-8 ).
d
x
1
=
c
o
s
θ
c
o
s
φ
d
r
−
r
s
i
n
θ
c
o
s
φ
d
θ
−
r
c
o
s
θ
s
i
n
φ
d
φ
{\displaystyle dx_{1}=cos{\theta }cos{\varphi }dr-rsin{\theta }cos{\varphi }d{\theta }-rcos{\theta }sin{\varphi }d{\varphi }}
(Eq 4-6 )
d
x
2
=
c
o
s
θ
s
i
n
φ
d
r
−
r
s
i
n
θ
s
i
n
φ
d
θ
+
r
c
o
s
θ
c
o
s
φ
d
φ
{\displaystyle dx_{2}=cos{\theta }sin{\varphi }dr-rsin{\theta }sin{\varphi }d{\theta }+rcos{\theta }cos{\varphi }d{\varphi }}
(Eq 4-7 )
d
x
3
=
s
i
n
θ
d
r
+
r
c
o
s
θ
d
θ
{\displaystyle dx_{3}=sin{\theta }dr+rcos{\theta }d{\theta }}
(Eq 4-8 )
(Eq 4-9 ) was developed by substituting the squared derivatives in the summation of (Eq 4-1 ) and combining like terms.
d
s
2
=
(
s
i
n
2
θ
(
c
o
s
2
φ
+
s
i
n
2
φ
)
+
c
o
s
2
θ
)
d
r
2
+
(
2
r
s
i
n
θ
c
o
s
θ
−
2
r
s
i
n
θ
c
o
s
θ
(
s
i
n
2
φ
+
c
o
s
2
φ
)
)
d
r
d
θ
+
(
r
2
(
s
i
n
2
θ
(
s
i
n
2
φ
+
c
o
s
2
φ
)
+
c
o
s
2
θ
)
d
θ
2
+
(
r
2
c
o
s
2
θ
(
s
i
n
2
φ
+
c
o
s
2
φ
)
)
d
φ
2
{\displaystyle ds^{2}=(sin^{2}{\theta }(cos^{2}{\varphi }+sin^{2}{\varphi })+cos^{2}{\theta })dr^{2}+(2rsin{\theta }cos{\theta }-2rsin{\theta }cos{\theta }(sin^{2}{\varphi }+cos^{2}{\varphi }))drd{\theta }+(r^{2}(sin^{2}{\theta }(sin^{2}{\varphi }+cos^{2}{\varphi })+cos^{2}{\theta })d{\theta }^{2}+(r^{2}cos^{2}{\theta }(sin^{2}{\varphi }+cos^{2}{\varphi }))d{\varphi }^{2}}
(Eq 4-9 )
Using the Pythagorean Trigonometric Identity, (Eq 4-9 ) reduces to (Eq 4-10 ).
d
s
2
=
d
r
2
+
r
2
d
θ
2
+
r
2
c
o
s
2
d
φ
2
{\displaystyle ds^{2}=dr^{2}+r^{2}d{\theta }^{2}+r^{2}cos^{2}d{\varphi }^{2}}
(Eq 4-10 )
Problem 5
The following equation is given for P2 (x), the Legendre Polynomial of degree n=2:
P
2
(
x
)
=
1
2
(
3
x
2
−
1
)
{\displaystyle P_{2}(x)={\dfrac {1}{2}}(3x^{2}-1)}
(Eq 5-1 )
Problem Statement
Using variation of parameters, show that Equation 5-2 is a second solution to the Legendre differential equation in Equation 5-3 as given in Pb.R*6.11 on pp.37-4 in sec.37
of the notes.
Q
2
(
x
)
=
1
4
(
3
x
2
−
1
)
l
o
g
(
1
+
x
1
−
x
)
−
3
2
x
{\displaystyle Q_{2}(x)={\dfrac {1}{4}}(3x^{2}-1)log({\dfrac {1+x}{1-x}})-{\dfrac {3}{2}}x}
(Eq 5-2 )
Solution
The Legendre differential equation of degree n=2 is given in equation 5-3.
(
1
−
x
2
)
y
″
−
2
x
y
′
+
6
y
=
0
{\displaystyle (1-x^{2})y''-2xy'+6y=0}
(Eq 5-3 )
Using reduction of order, some function, v, times P2 (x) and the first two derivatives of the product are substituted into the Legendre differential equation in equation 5-7. Furthermore, since P2 (x) is a solution to the Legendre equation the coefficient of the first order term, v, reduces to zero. Since the lowest order term cancels out, the second order differential equation is reduced to a first order differential equation where w=v' and w'=v in Equation 5-8 which can be solved through separation of variables.
R
2
(
x
)
=
v
(
3
2
x
2
−
1
2
)
{\displaystyle R_{2}(x)=v({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})}
(Eq 5-4 )
R
2
′
(
x
)
=
v
′
(
3
2
x
2
−
1
2
)
+
v
(
3
x
)
{\displaystyle R'_{2}(x)=v'({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})+v(3x)}
(Eq 5-5 )
R
2
″
(
x
)
=
v
″
(
3
2
x
2
−
1
2
)
+
6
v
′
x
+
3
v
{\displaystyle R''_{2}(x)=v''({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})+6v'x+3v}
(Eq 5-6 )
(
1
−
x
2
)
(
3
2
x
2
−
1
2
)
v
″
+
(
6
x
(
1
−
x
2
)
−
2
x
(
3
2
x
2
−
1
2
)
)
v
′
+
(
3
(
1
−
x
2
)
−
2
x
(
3
x
)
+
6
(
3
2
x
2
−
1
2
)
)
v
=
0
{\displaystyle (1-x^{2})({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})v''+(6x(1-x^{2})-2x({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}}))v'+(3(1-x^{2})-2x(3x)+6({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}}))v=0}
(Eq 5-7 )
d
w
w
=
(
6
x
(
1
−
x
2
)
−
2
x
(
3
2
x
2
−
1
2
)
)
d
x
(
1
−
x
2
)
(
3
2
x
2
−
1
2
)
{\displaystyle {\dfrac {dw}{w}}={\dfrac {(6x(1-x^{2})-2x({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}}))dx}{(1-x^{2})({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})}}}
(Eq 5-7 )
Through partial fraction decomposition, the integral is
∫
d
w
w
=
∫
−
6
x
3
2
x
2
d
x
−
1
2
+
∫
2
x
1
−
x
2
d
x
{\displaystyle \int {\dfrac {dw}{w}}=\int {\dfrac {-6x}{{\dfrac {3}{2}}x^{2}dx-{\dfrac {1}{2}}}}+\int {\dfrac {2x}{1-x^{2}}}dx}
(Eq 5-8 )
Through integration
l
o
g
(
w
)
=
−
2
l
o
g
(
3
2
x
2
−
1
2
)
−
l
o
g
(
1
−
x
2
)
{\displaystyle log(w)=-2log({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})-log(1-x^{2})}
(Eq 5-9 )
Using properties of the natural logarithm and then inverting it using the exponential function, equation 5-9 becomes
w
=
1
(
3
2
x
2
−
1
2
)
(
1
−
x
2
)
{\displaystyle w={\dfrac {1}{({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})(1-x^{2})}}}
(Eq 5-10 )
Substituting v' back into Equation 5-10 and again using partial fraction decomposition
∫
d
v
=
∫
d
x
4
(
1
−
x
2
)
−
3
4
∫
(
3
x
2
+
1
)
(
3
2
x
2
−
1
2
)
2
{\displaystyle \int {dv}=\int {\dfrac {dx}{4(1-x^{2})}}-{\dfrac {3}{4}}\int {\dfrac {(3x^{2}+1)}{({\dfrac {3}{2}}x^{2}-{\dfrac {1}{2}})^{2}}}}
(Eq 5-11 )
Completing the integration
v
=
−
1
8
l
o
g
(
1
+
x
1
−
x
)
−
3
4
x
3
x
2
−
1
{\displaystyle v={\dfrac {-1}{8}}log({\dfrac {1+x}{1-x}})-{\dfrac {3}{4}}{\dfrac {x}{3x^{2}-1}}}
(Eq 5-12 )
Substituting v multiplied by the arbitrary constant 8 back into Equation 5-4 then identifying the new solution as Q2
Q
2
(
x
)
=
1
4
(
3
x
2
−
1
)
l
o
g
(
1
+
x
1
−
x
)
−
3
x
2
{\displaystyle Q_{2}(x)={\dfrac {1}{4}}(3x^{2}-1)log({\dfrac {1+x}{1-x}})-{\dfrac {3x}{2}}}
(Eq 5-12 )
Problem 6
The following equations are given for heat conduction on a cylinder
x
=
r
cos
θ
=
ξ
1
cos
ξ
2
{\displaystyle x=r\cos \theta =\xi _{1}\,\cos {\xi _{2}}}
(Eq 6-1 )
y
=
r
sin
θ
=
ξ
1
sin
ξ
2
{\displaystyle y=r\sin \theta =\xi _{1}\,\sin {\xi _{2}}}
(Eq 6-2 )
z
=
ξ
3
{\displaystyle z=\xi _{3}}
(Eq 6-3 )
Problem Statement
(a) Find
{
d
x
i
}
=
{
d
x
1
,
d
x
2
,
d
x
3
}
{\displaystyle \left\{dx_{i}\right\}=\left\{dx_{1},dx_{2},dx_{3}\right\}}
(Eq 6-4 )
in terms of
{
ξ
j
}
=
{
ξ
1
,
ξ
2
,
ξ
3
}
{\displaystyle \left\{\xi _{j}\right\}=\left\{\xi _{1},\xi _{2},\xi _{3}\right\}}
(Eq 6-5 )
and
{
d
ξ
k
}
=
{
d
ξ
1
,
d
ξ
2
,
d
ξ
3
}
{\displaystyle \left\{d\xi _{k}\right\}=\left\{d\xi _{1},d\xi _{2},d\xi _{3}\right\}}
(Eq 6-6 )
(b) Find
d
s
2
=
∑
i
(
d
x
i
)
2
=
∑
k
(
h
k
)
2
(
d
ξ
k
)
2
{\displaystyle ds^{2}=\sum _{i}(dx_{i})^{2}=\sum _{k}(h_{k})^{2}(d\xi _{k})^{2}}
(Eq 6-7 )
Identify
{
h
i
}
{\displaystyle \{h_{i}\}}
in terms of
{
ξ
i
}
{\displaystyle \{\xi _{i}\}}
(c) Find
Δ
u
{\displaystyle \Delta u}
in terms of cylindrical coordinates
(d) Use separation of variable to find the separated equations of Laplace's equation in cylindrical coordinates and compare to the Bessel equation:
x
2
d
2
y
d
x
2
+
x
d
y
d
x
+
(
x
2
−
α
2
)
y
=
0
{\displaystyle x^{2}{\frac {d^{2}y}{dx^{2}}}+x{\frac {dy}{dx}}+(x^{2}-\alpha ^{2})y=0}
(Eq 6-8 )
Solution
Part a
The total differential of
x
{\displaystyle x}
can be written as:
d
x
=
∂
x
∂
ξ
1
d
ξ
1
+
∂
x
∂
ξ
2
d
ξ
2
+
∂
x
∂
ξ
3
d
ξ
3
{\displaystyle dx={\frac {\partial x}{\partial \xi _{1}}}d\xi _{1}+{\frac {\partial x}{\partial \xi _{2}}}d\xi _{2}+{\frac {\partial x}{\partial \xi _{3}}}d\xi _{3}}
(Eq 6-9 )
Similar expressions can be written for
y
{\displaystyle y}
and
z
{\displaystyle z}
.
d
y
=
∂
y
∂
ξ
1
d
ξ
1
+
∂
y
∂
ξ
2
d
ξ
2
+
∂
y
∂
ξ
3
d
ξ
3
{\displaystyle dy={\frac {\partial y}{\partial \xi _{1}}}d\xi _{1}+{\frac {\partial y}{\partial \xi _{2}}}d\xi _{2}+{\frac {\partial y}{\partial \xi _{3}}}d\xi _{3}}
(Eq 6-10 )
d
z
=
∂
z
∂
ξ
1
d
ξ
1
+
∂
z
∂
ξ
2
d
ξ
2
+
∂
z
∂
ξ
3
d
ξ
3
{\displaystyle dz={\frac {\partial z}{\partial \xi _{1}}}d\xi _{1}+{\frac {\partial z}{\partial \xi _{2}}}d\xi _{2}+{\frac {\partial z}{\partial \xi _{3}}}d\xi _{3}}
(Eq 6-11 )
Plugging in the expressions from (Eq 6-1 ), (Eq 6-2 ) and (Eq 6-3 ):
d
x
=
cos
ξ
2
d
ξ
1
−
ξ
1
sin
ξ
2
d
ξ
2
{\displaystyle dx=\cos {\xi _{2}}\,d\xi _{1}-\xi _{1}\,\sin {\xi _{2}}\,d\xi _{2}}
(Eq 6-12 )
d
y
=
sin
ξ
2
d
ξ
1
+
ξ
1
cos
ξ
2
d
ξ
2
{\displaystyle dy=\sin {\xi _{2}}\,d\xi _{1}+\xi _{1}\,\cos {\xi _{2}}\,d\xi _{2}}
(Eq 6-13 )
d
z
=
d
ξ
3
{\displaystyle dz=d\xi _{3}}
(Eq 6-14 )
Part b
Plugging in (Eq 6-12 ), (Eq 6-13 ), and (Eq 6-14 ) into (Eq 6-7 ).
d
s
2
=
(
h
1
)
2
(
cos
ξ
2
d
ξ
1
−
ξ
1
sin
ξ
2
d
ξ
2
)
2
+
(
h
2
)
2
(
sin
ξ
2
d
ξ
1
+
ξ
1
cos
ξ
2
d
ξ
2
)
2
+
(
h
3
)
2
(
d
ξ
3
)
2
{\displaystyle ds^{2}=(h_{1})^{2}(\cos {\xi _{2}}\,d\xi _{1}-\xi _{1}\sin {\xi _{2}}\,d\xi _{2})^{2}+(h_{2})^{2}(\sin {\xi _{2}}\,d\xi _{1}+\xi _{1}\cos {\xi _{2}}\,d\xi _{2})^{2}+(h_{3})^{2}(d\xi _{3})^{2}}
(Eq 6-15 )
Expanding (Eq 6-14 ) out, and applying the following trig identity:
sin
2
ξ
2
+
cos
2
ξ
2
=
1
{\displaystyle \sin ^{2}{\xi _{2}}+\cos ^{2}{\xi _{2}}=1}
(Eq 6-16 )
Results in the following expression:
d
s
2
=
(
d
ξ
1
)
2
+
(
ξ
1
)
2
(
d
ξ
2
)
2
+
(
d
ξ
3
)
2
{\displaystyle ds^{2}=(d\xi _{1})^{2}+(\xi _{1})^{2}(d\xi _{2})^{2}+(d\xi _{3})^{2}}
(Eq 6-17 )
Comparing (Eq 6-17 ) to the left hand side of (Eq 6-7 ):
h
1
=
1
{\displaystyle h_{1}=1}
(Eq 6-18 )
h
2
=
ξ
2
{\displaystyle h_{2}=\xi _{2}}
(Eq 6-19 )
h
3
=
1
{\displaystyle h_{3}=1}
(Eq 6-20 )
Part c
The Laplacian operator for a scalar function
u
{\displaystyle u}
in general curvilinear coordinates is defined as[ 2] :
Δ
u
=
1
h
1
h
2
h
3
[
∂
∂
ξ
1
(
h
2
h
3
h
1
∂
∂
ξ
1
)
+
∂
∂
ξ
2
(
h
1
h
3
h
2
∂
∂
ξ
2
)
+
∂
∂
ξ
3
(
h
1
h
2
h
3
∂
∂
ξ
3
)
]
u
{\displaystyle \Delta u={\frac {1}{h_{1}h_{2}h_{3}}}\left[{\frac {\partial }{\partial \xi _{1}}}\left({\frac {h_{2}h_{3}}{h_{1}}}{\frac {\partial }{\partial \xi _{1}}}\right)+{\frac {\partial }{\partial \xi _{2}}}\left({\frac {h_{1}h_{3}}{h_{2}}}{\frac {\partial }{\partial \xi _{2}}}\right)+{\frac {\partial }{\partial \xi _{3}}}\left({\frac {h_{1}h_{2}}{h_{3}}}{\frac {\partial }{\partial \xi _{3}}}\right)\right]u}
(Eq 6-21 )
Plugging in (Eq 6-18 ), (Eq 6-19 ) and (Eq 6-20 ).
Δ
u
=
1
ξ
1
[
∂
∂
ξ
1
(
ξ
1
∂
∂
ξ
1
)
+
∂
∂
ξ
2
(
1
ξ
1
∂
∂
ξ
2
)
+
∂
∂
ξ
3
(
ξ
1
h
1
h
2
h
3
∂
∂
ξ
3
)
]
u
{\displaystyle \Delta u={\frac {1}{\xi _{1}}}\left[{\frac {\partial }{\partial \xi _{1}}}\left(\xi _{1}{\frac {\partial }{\partial \xi _{1}}}\right)+{\frac {\partial }{\partial \xi _{2}}}\left({\frac {1}{\xi _{1}}}{\frac {\partial }{\partial \xi _{2}}}\right)+{\frac {\partial }{\partial \xi _{3}}}\left(\xi _{1}{\frac {h_{1}h_{2}}{h_{3}}}{\frac {\partial }{\partial \xi _{3}}}\right)\right]u}
(Eq 6-22 )
Δ
u
=
1
ξ
1
∂
u
∂
ξ
1
+
∂
2
u
∂
ξ
1
2
+
1
ξ
1
2
∂
2
u
∂
ξ
2
2
+
∂
2
u
∂
ξ
3
2
{\displaystyle \Delta u={\frac {1}{\xi _{1}}}{\frac {\partial u}{\partial \xi _{1}}}+{\frac {\partial ^{2}u}{\partial \xi _{1}^{2}}}+{\frac {1}{\xi _{1}^{2}}}{\frac {\partial ^{2}u}{\partial \xi _{2}^{2}}}+{\frac {\partial ^{2}u}{\partial \xi _{3}^{2}}}}
(Eq 6-23 )
Δ
u
=
1
r
∂
u
∂
r
+
∂
2
u
∂
r
2
+
1
r
2
∂
2
u
∂
θ
2
+
∂
2
u
∂
z
2
{\displaystyle \Delta u={\frac {1}{r}}{\frac {\partial u}{\partial r}}+{\frac {\partial ^{2}u}{\partial r^{2}}}+{\frac {1}{r^{2}}}{\frac {\partial ^{2}u}{\partial \theta ^{2}}}+{\frac {\partial ^{2}u}{\partial z^{2}}}}
(Eq 6-24 )
Part d
Laplace's equation in cylindrical coordinates is:
Δ
u
=
0
{\displaystyle \Delta u=0}
(Eq 6-25 )
1
r
∂
u
∂
r
+
∂
2
u
∂
r
2
+
1
r
2
∂
2
u
∂
θ
2
+
∂
2
u
∂
z
2
=
0
{\displaystyle {\frac {1}{r}}{\frac {\partial u}{\partial r}}+{\frac {\partial ^{2}u}{\partial r^{2}}}+{\frac {1}{r^{2}}}{\frac {\partial ^{2}u}{\partial \theta ^{2}}}+{\frac {\partial ^{2}u}{\partial z^{2}}}=0}
(Eq 6-26 )
Assume a solution to (Eq 6-26 ) has the following form:
u
(
r
,
θ
,
z
)
=
R
(
r
)
Θ
(
θ
)
Z
(
z
)
{\displaystyle u(r,\theta ,z)=R(r)\Theta (\theta )Z(z)}
(Eq 6-27 )
Plugging (Eq 6-27 ) into (Eq 6-26 ):
Θ
(
θ
)
Z
(
z
)
1
r
d
R
(
r
)
d
r
+
Θ
(
θ
)
Z
(
z
)
d
2
R
(
r
)
d
r
2
+
R
(
r
)
Z
(
z
)
1
r
2
d
2
Θ
(
θ
)
d
θ
2
+
R
(
r
)
Θ
(
θ
)
d
2
Z
(
z
)
d
z
2
=
0
{\displaystyle \Theta (\theta )Z(z){\frac {1}{r}}{\frac {dR(r)}{dr}}+\Theta (\theta )Z(z){\frac {d^{2}R(r)}{dr^{2}}}+R(r)Z(z){\frac {1}{r^{2}}}{\frac {d^{2}\Theta (\theta )}{d\theta ^{2}}}+R(r)\Theta (\theta ){\frac {d^{2}Z(z)}{dz^{2}}}=0}
(Eq 6-28 )
Dividing by
u
{\displaystyle u}
1
r
R
(
r
)
d
R
(
r
)
d
r
+
1
R
(
r
)
d
2
R
(
r
)
d
r
2
+
1
Θ
(
θ
)
1
r
2
d
2
Θ
(
θ
)
d
θ
2
+
1
Z
(
z
)
(
θ
)
d
2
Z
(
z
)
d
z
2
=
0
{\displaystyle {\frac {1}{rR(r)}}{\frac {dR(r)}{dr}}+{\frac {1}{R(r)}}{\frac {d^{2}R(r)}{dr^{2}}}+{\frac {1}{\Theta (\theta )}}{\frac {1}{r^{2}}}{\frac {d^{2}\Theta (\theta )}{d\theta ^{2}}}+{\frac {1}{Z(z)}}(\theta ){\frac {d^{2}Z(z)}{dz^{2}}}=0}
(Eq 6-29 )
The terms in z are then "seperated" and set equal to a constant:
λ
2
{\displaystyle \lambda ^{2}}
.
1
r
R
(
r
)
d
R
(
r
)
d
r
+
1
R
(
r
)
d
2
R
(
r
)
d
r
2
+
1
Θ
(
θ
)
1
r
2
d
2
Θ
(
θ
)
d
θ
2
+
λ
2
=
0
{\displaystyle {\frac {1}{rR(r)}}{\frac {dR(r)}{dr}}+{\frac {1}{R(r)}}{\frac {d^{2}R(r)}{dr^{2}}}+{\frac {1}{\Theta (\theta )}}{\frac {1}{r^{2}}}{\frac {d^{2}\Theta (\theta )}{d\theta ^{2}}}+\lambda ^{2}=0}
(Eq 6-30 )
Multiplying by
r
2
{\displaystyle r^{2}}
:
r
R
(
r
)
d
R
(
r
)
d
r
+
r
2
R
(
r
)
d
2
R
(
r
)
d
r
2
+
1
Θ
(
θ
)
d
2
Θ
(
θ
)
d
θ
2
+
(
λ
r
)
2
=
0
{\displaystyle {\frac {r}{R(r)}}{\frac {dR(r)}{dr}}+{\frac {r^{2}}{R(r)}}{\frac {d^{2}R(r)}{dr^{2}}}+{\frac {1}{\Theta (\theta )}}{\frac {d^{2}\Theta (\theta )}{d\theta ^{2}}}+(\lambda r)^{2}=0}
(Eq 6-31 )
Now the
θ
{\displaystyle \theta }
term can be separated and set to
−
α
2
{\displaystyle -\alpha ^{2}}
.
r
R
(
r
)
d
R
(
r
)
d
r
+
r
2
R
(
r
)
d
2
R
(
r
)
d
r
2
+
−
α
2
+
(
λ
r
)
2
=
0
{\displaystyle {\frac {r}{R(r)}}{\frac {dR(r)}{dr}}+{\frac {r^{2}}{R(r)}}{\frac {d^{2}R(r)}{dr^{2}}}+-\alpha ^{2}+(\lambda r)^{2}=0}
(Eq 6-32 )
Making a change of variable:
ρ
(
r
)
=
λ
r
{\displaystyle \rho (r)=\lambda r}
(Eq 6-33 )
d
R
(
r
)
d
r
=
λ
d
R
(
ρ
)
d
ρ
{\displaystyle {\frac {dR(r)}{dr}}=\lambda {\frac {dR(\rho )}{d\rho }}}
(Eq 6-34 )
d
2
R
(
r
)
d
r
2
=
λ
2
d
2
R
(
ρ
)
d
ρ
2
{\displaystyle {\frac {d^{2}R(r)}{dr^{2}}}=\lambda ^{2}{\frac {d^{2}R(\rho )}{d\rho ^{2}}}}
(Eq 6-35 )
Plugging the above change of variable into (Eq 6-32 ) and multiplying by
R
(
ρ
)
{\displaystyle R(\rho )}
gives:
ρ
2
d
2
R
(
ρ
)
d
r
2
+
ρ
d
R
(
ρ
)
d
r
+
(
ρ
2
−
α
2
)
R
(
ρ
)
=
0
{\displaystyle \rho ^{2}{\frac {d^{2}R(\rho )}{dr^{2}}}+\rho {\frac {dR(\rho )}{dr}}+(\rho ^{2}-\alpha ^{2})R(\rho )=0}
(Eq 6-36 )
Which is Bessel's equation given in (Eq 6-8 ).
Problem 7
The following equations is given
e
−
2
∫
2
∞
1
x
log
2
(
x
)
d
x
{\displaystyle e^{-2}\int _{2}^{\infty }{\frac {1}{x\log ^{2}(x)}}\,dx}
(Eq 7-1 )
and
e
−
2
∫
2
∞
1
x
log
2
(
x
)
d
x
=
e
−
2
1
log
2
{\displaystyle e^{-2}\int _{2}^{\infty }{\frac {1}{x\log ^{2}(x)}}\,dx=e^{-2}{\frac {1}{\log {2}}}}
(Eq 7-1 ) is motivated by quadrature tests written by Dr. John Burkardt found here:
http://people.sc.fsu.edu/~%20jburkardt/c_src/test_int_laguerre/test_int_laguerre.html
Problem Statement
(a) Find the values of the integral of the function (7-1) by other means (exact or approximate), then evaluate these integrals with the Gauss-Laguerre quadrature for comparison.
(b) Find and appropriate transformation to show the equality of (7-2) and (7-3). Find the value of
J
0
(
1
/
2
)
{\displaystyle J_{0}(1/2)}
in some table and use the Gauss-Laguerre quadrature to find an approximate value of the integral to compare.
Solution
Part a
e
−
2
∫
2
∞
1
x
log
2
(
x
)
d
x
=
e
−
2
1
log
2
{\displaystyle e^{-2}\int _{2}^{\infty }{\frac {1}{x\log ^{2}(x)}}\,dx=e^{-2}{\frac {1}{\log {2}}}}
Gauss-Laguerre quadrature is a Gaussian quadrature that integrates a function
g
(
x
)
{\displaystyle g(x)}
over the interval
[
0
,
∞
]
{\displaystyle [0,\infty ]}
with the weighting factor
e
−
x
{\displaystyle e^{-x}}
.
∫
0
+
∞
e
−
x
g
(
x
)
d
x
≈
∑
i
=
1
n
w
i
g
(
x
i
)
{\displaystyle \int _{0}^{+\infty }e^{-x}g(x)\,dx\approx \sum _{i=1}^{n}w_{i}\,g(x_{i})}
(Eq 7-3 )
Since the integral in (Eq 7-3 ) has the weighting term
e
−
x
{\displaystyle e^{-x}}
in it, a transformation can be applied to integrate an arbitrary function of interest.
f
(
x
)
=
e
−
x
(
e
x
f
(
x
)
)
=
e
−
x
g
(
x
)
{\displaystyle f(x)=e^{-x}\left(e^{x}f(x)\right)=e^{-x}g(x)}
(Eq 7-4 )
The integration points
x
i
{\displaystyle x_{i}}
are found to be the roots of the Laguerre polynomial
P
n
{\displaystyle P_{n}}
, and the weights
w
i
{\displaystyle w_{i}}
are found by the following expression [ 3] :
w
i
=
x
i
(
n
+
1
)
2
[
L
n
+
1
(
x
i
)
]
2
.
{\displaystyle w_{i}={\frac {x_{i}}{(n+1)^{2}[L_{n+1}(x_{i})]^{2}}}.}
(Eq 7-5 )
Since the integral in (Eq 7-1 ) has a lower limit of 2 instead of zero, a change of variable is needed.
x
=
y
−
a
{\displaystyle x=y-a}
(Eq 7-6 )
(Eq 7-3 ) then becomes [ 4] :
∫
a
+
∞
e
−
y
g
(
y
)
d
y
≈
e
−
a
∑
i
=
1
n
w
i
g
(
x
i
+
a
)
{\displaystyle \int _{a}^{+\infty }e^{-y}g(y)\,dy\approx e^{-a}\sum _{i=1}^{n}w_{i}\,g(x_{i}+a)}
(Eq 7-7 )
A numerical python (NumPy) script was written to test the quadrature for the integral in (Eq 7-1 ). The source code is given below:
(Note: NumPy is an opensource
#################################################################################
# Name: gausslagtest.py
# Author: Cameron Stewart
# Date: 2/5/2014
# Purpose: This script uses Gauss-Laguerre quad to integrate the integral:
# exp(-2) Integral (2 to infinity) (1/(x*log(x)^2)
#################################################################################
import numpy as np
import matplotlib.pyplot as plt
#################################################################################
# Function name: TestFunction
# Input: a value, or array of values of x
# Output: g(x) at given points
# f(x)=exp(-2)/(x*log(x)*log(x); g(x)=f(x)*(e^x)
# Function f(x) that is desired to be integrated this function is multiplied by
# e^x to account for the weighting function e^-x in G-L Quad
#################################################################################
def TestFunction ( x ):
y = np . exp ( x ) * 1 / ( x * np . log ( x ) * np . log ( x )) * np . exp ( - 2 )
return y
#################################################################################
# Uses the numpy Laguerre Gauss quadrature routine:
# numpy.polynomial.laguerre.laggauss(deg) to find roots and weight points.
# Output is tuple of 1d arrays for the weights and integration points.
# Note: Not tested for deg>100
#################################################################################
weight = ( np . polynomial . laguerre . laggauss ( 4 ))
# weight[0] contains the roots/integration points
# weight[1] contains the weights at said points
# COV: y=x+a to account for lower limit of
# integration
a = 2
func = TestFunction ( weight [ 0 ] + a )
integ = weight [ 1 ] * func
integ = np . exp ( - a ) * np . sum ( integ )
print ( 'n=4' )
print ( integ )
weight = ( np . polynomial . laguerre . laggauss ( 16 ))
func = TestFunction ( weight [ 0 ] + a )
integ = weight [ 1 ] * func
integ = np . exp ( - a ) * np . sum ( integ )
print ( 'n=16' )
print ( integ )
weight = ( np . polynomial . laguerre . laggauss ( 100 ))
func = TestFunction ( weight [ 0 ] + a )
integ = weight [ 1 ] * func
integ = np . exp ( - a ) * np . sum ( integ )
print ( 'n=100' )
print ( integ )
# Exact value computed from analytic solution
exact = np . exp ( - 2 ) * 1. / ( np . log ( 2 ))
print ( 'exact' )
print ( exact )
#################################################################################
# Plot to show the convergence with increasing integration points
#################################################################################
t = np . linspace ( 2 , 100 , 99 )
error = []
for i in range ( 2 , 101 ):
weight = ( np . polynomial . laguerre . laggauss ( i ))
func = TestFunction ( weight [ 0 ] + a )
integ = weight [ 1 ] * func
integ = np . exp ( - a ) * np . sum ( integ )
error . append (( np . abs ( integ - exact )) \
/ exact * 100. )
plt . plot ( t , error )
plt . title ( 'Convergence test for Gauss-Laguerre quadrature: logarithmic integral' )
plt . xlabel ( r 'Integration points: $n$' )
plt . ylabel ( r 'Error %' )
plt . show ()
Script terminal output:
n=4
0.145107525093
n=16
0.162236347114
n=100
0.172558662198
exact
0.195247541983
Plot generated by script:
Figure 7.1: Convergence of ( 7-1 ) with increasing integration points
The above script uses NumPy's Laguerre module quadrature routine: numpy.polynomial.laguerre.laggauss(deg). This routine solves the roots of the Laguerre polynomials by first finding the eigenvalues of the Companion Matrix , and then applying an iteration of Newton's Method to improve accuracy.
Documentation
source
The above script uses ( 7-5 ) to calculate ( 7-1 ).
∫
2
+
∞
e
−
y
(
e
−
y
1
y
log
2
(
y
)
)
d
y
≈
e
−
2
∑
i
=
1
n
w
i
g
(
x
i
+
2
)
{\displaystyle \int _{2}^{+\infty }e^{-y}\left(e^{-y}{\frac {1}{y\log ^{2}(y)}}\right)\,dy\approx e^{-2}\sum _{i=1}^{n}w_{i}\,g(x_{i}+2)}
(Eq 7-8 )
The script above compares favourably with values calculated by Dr. Burkardt [ 5] .
n
Python Script
Dr. Burkardt
4
0.145107525093
0.145108
16
0.162236347114
0.162236
Table 7.1 Comparison of quadrature calculations
As can be seen in Figure 1, even at 100 integration points there is still significant error or around 12 percent.
Part b
Contributing Team Members
Problem Assignments
Problem #
Solved by
Reviewed by
1
Neal, Christopher
all
2
Neal, Christopher
all
3
Bartlett, Elizabeth
all
4
Stewart, Cameron
all
5
Bartlett, Elizabeth
all
6
Bartlett, Elizabeth
all
7
Bartlett, Elizabeth
all
References