You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* rename besselroots to approx_besselroots
* add warning for compatibility of besselroots
* use DocMeta.setdocmeta! instead of setup =
* add test for besselroots
* update benchmark.md to generate results automatically
* fix typo in besselroots.jl
* move some texts from README.md to docs/src/*.md
* update ci.yml to trigger ci with release
* update ci.yml for jldoctest
* update ci.yml again for jldoctest
* update autogeneration of benchmark
* add more (a)repl block
* bump version to v0.4.7
(The nodes near the endpoints coalesce in 16-digits of precision.)
54
-
55
-
## The algorithm for Gauss-Chebyshev
56
-
There are four kinds of Gauss-Chebyshev quadrature rules, corresponding to four weight functions:
57
-
58
-
1. 1st kind, weight function `w(x) = 1/sqrt(1-x^2)`
59
-
60
-
2. 2nd kind, weight function `w(x) = sqrt(1-x^2)`
61
-
62
-
3. 3rd kind, weight function `w(x) = sqrt((1+x)/(1-x))`
63
-
64
-
4. 4th kind, weight function `w(x) = sqrt((1-x)/(1+x))`
65
-
66
-
They are all have explicit simple formulas for the nodes and weights [[4]](https://books.google.co.jp/books?id=8FHf0P3to0UC).
67
-
68
-
## The algorithm for Gauss-Legendre
69
-
Gauss quadrature for the weight function `w(x) = 1`.
70
-
71
-
* For `n ≤ 5`: Use an analytic expression.
72
-
* For `n ≤ 60`: Use Newton's method to solve `Pₙ(x)=0`. Evaluate Legendre polynomials `Pₙ` and their derivatives `Pₙ'` by 3-term recurrence. Weights are related to `Pₙ'`.
73
-
* For `n > 60`: Use asymptotic expansions for the Legendre nodes and weights [[1]](http://epubs.siam.org/doi/abs/10.1137/140954969).
74
-
75
-
## The algorithm for Gauss-Jacobi
76
-
Gauss quadrature for the weight functions `w(x) = (1-x)^a(1+x)^b`, `a,b > -1`.
77
-
78
-
* For `n ≤ 100`: Use Newton's method to solve `Pₙ(x)=0`. Evaluate `Pₙ` and `Pₙ'` by three-term recurrence.
79
-
* For `n > 100`: Use Newton's method to solve `Pₙ(x)=0`. Evaluate `Pₙ` and `Pₙ'` by an asymptotic expansion (in the interior of `[-1,1]`) and the three-term recurrence `O(n^-2)` close to the endpoints. (This is a small modification to the algorithm described in [[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).)
80
-
* For `max(a,b) > 5`: Use the Golub-Welsch algorithm requiring `O(n^2)` operations.
81
-
82
-
## The algorithm for Gauss-Radau
83
-
Gauss quadrature for the weight function `w(x)=1`, except the endpoint `-1` is included as a quadrature node.
84
-
85
-
The Gauss-Radau nodes and weights can be computed via the `(0,1)` Gauss-Jacobi nodes and weights[[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).
86
-
87
-
## The algorithm for Gauss-Lobatto
88
-
Gauss quadrature for the weight function `w(x)=1`, except the endpoints `-1` and `1` are included as nodes.
89
-
90
-
The Gauss-Lobatto nodes and weights can be computed via the `(1,1)` Gauss-Jacobi nodes and weights[[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).
91
-
92
-
## The algorithm for Gauss-Laguerre
93
-
Gauss quadrature for the weight function `w(x) = exp(-x)` on `[0,Inf)`
94
-
95
-
* For `n < 128`: Use the Golub-Welsch algorithm.
96
-
* For `method=GLR`: Use the Glaser-Lui-Rohklin algorithm. Evaluate Laguerre polynomials `Lₙ` and their derivatives `Lₙ'` by using Taylor series expansions near roots generated by solving the second-order differential equation that `Lₙ` satisfies, see [[2]](http://epubs.siam.org/doi/pdf/10.1137/06067016X).
97
-
* For `n ≥ 128`: Use a Newton procedure on Riemann-Hilbert asymptotics of Laguerre polynomials, see [5], based on [8]. There are some heuristics to decide which expression to use, it allows a general weight `w(x) = x^alpha exp(-q_m x^m)` and this is O(sqrt(n)) when allowed to stop when the weights are below the smallest positive floating point number.
98
-
99
-
## The algorithm for Gauss-Hermite
100
-
Gauss quadrature for the weight function `w(x) = exp(-x^2)` on the real line.
101
-
102
-
* For `n < 200`: Use Newton's method to solve `Hₙ(x)=0`. Evaluate Hermite polynomials `Hₙ` and their derivatives `Hₙ'` by three-term recurrence.
103
-
* For `n ≥ 200`: Use Newton's method to solve `Hₙ(x)=0`. Evaluate `Hₙ` and `Hₙ'` by a uniform asymptotic expansion, see [[7]](http://arxiv.org/abs/1410.5286).
104
-
105
-
The paper [[7]](http://arxiv.org/abs/1410.5286) also derives an `O(n)` algorithm for generalized Gauss-Hermite nodes and weights associated to weight functions of the form `exp(-V(x))`, where `V(x)` is a real polynomial.
[1] I. Bogaert, ["Iteration-free computation of Gauss-Legendre quadrature nodes and weights"](http://epubs.siam.org/doi/abs/10.1137/140954969), SIAM J. Sci. Comput., 36(3), A1008-A1026, 2014.
120
-
121
-
[2] A. Glaser, X. Liu, and V. Rokhlin. ["A fast algorithm for the calculation of the roots of special functions."](http://epubs.siam.org/doi/pdf/10.1137/06067016X) SIAM J. Sci. Comput., 29 (2007), 1420-1438.
122
-
123
-
[3] N. Hale and A. Townsend, ["Fast and accurate computation of Gauss-Legendre and Gauss-Jacobi quadrature nodes and weights"](http://epubs.siam.org/doi/abs/10.1137/120889873), SIAM J. Sci. Comput., 2012.
124
-
125
-
[4] J. C. Mason and D. C. Handscomb, ["Chebyshev Polynomials"](https://books.google.co.jp/books?id=8FHf0P3to0UC), CRC Press, 2002.
126
-
127
-
[5] P. Opsomer, (in preparation).
128
-
129
-
[6] A. Townsend, [The race for high order Gauss-Legendre quadrature](http://pi.math.cornell.edu/~ajt/papers/QuadratureEssay.pdf), in SIAM News, March 2015.
130
-
131
-
[7] A. Townsend, T. Trogdon, and S. Olver, ["Fast computation of Gauss quadrature nodes and weights on the whole real line"](http://arxiv.org/abs/1410.5286), to appear in IMA Numer. Anal., 2014.
132
-
133
-
[8] M. Vanlessen, "Strong asymptotics of Laguerre-Type orthogonal polynomials and applications in Random Matrix Theory", Constr. Approx., 25:125-175, 2007.
Since [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl) doesn't have a method to calculate roots of [Bessel function](https://en.wikipedia.org/wiki/Bessel_function), we implemented `besselroots`.
3
+
Since [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl) doesn't have a method to calculate roots of [Bessel function](https://en.wikipedia.org/wiki/Bessel_function), we implemented `approx_besselroots`.
4
4
5
5
```@docs
6
-
besselroots(ν::Real, n::Integer)
6
+
approx_besselroots(ν::Real, n::Integer)
7
7
```
8
8
9
-
This method `besselroots` is used to calculate `gaussjacobi` and `gausslaguerre`.
9
+
This method `approx_besselroots` is used to calculate `gaussjacobi` and `gausslaguerre`.
Copy file name to clipboardExpand all lines: docs/src/gaussquadrature.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,36 @@
2
2
3
3
4
4
## Gauss-Legendre quadrature
5
+
Gauss quadrature for the weight function ``w(x) = 1``.
6
+
7
+
* For ``n ≤ 5``: Use an analytic expression.
8
+
* For ``n ≤ 60``: Use Newton's method to solve ``P_n(x)=0``. Evaluate Legendre polynomials ``P_n`` and their derivatives ``P_n'`` by 3-term recurrence. Weights are related to ``P_n'``.
9
+
* For ``n > 60``: Use asymptotic expansions for the Legendre nodes and weights [[1]](http://epubs.siam.org/doi/abs/10.1137/140954969).
5
10
6
11
```@docs
7
12
gausslegendre(n::Integer)
8
13
```
9
14
10
15
11
16
## Gauss-Hermite quadrature
17
+
Gauss quadrature for the weight function ``w(x) = \exp(-x^2)`` on the real line.
18
+
19
+
* For ``n < 200``: Use Newton's method to solve ``H_n(x)=0``. Evaluate Hermite polynomials ``H_n`` and their derivatives ``H_n'`` by three-term recurrence.
20
+
* For ``n ≥ 200``: Use Newton's method to solve ``H_n(x)=0``. Evaluate ``H_n`` and ``H_n'`` by a uniform asymptotic expansion, see [[7]](http://arxiv.org/abs/1410.5286).
21
+
22
+
The paper [[7]](http://arxiv.org/abs/1410.5286) also derives an ``O(n)`` algorithm for generalized Gauss-Hermite nodes and weights associated to weight functions of the form ``\exp(-V(x))``, where ``V(x)`` is a real polynomial.
12
23
13
24
```@docs
14
25
gausshermite(n::Integer)
15
26
```
16
27
17
28
18
29
## Gauss-Laguerre quadrature
30
+
Gauss quadrature for the weight function ``w(x) = \exp(-x)`` on ``[0,+\infty)``
31
+
32
+
* For ``n < 128``: Use the Golub-Welsch algorithm.
33
+
* For `method=GLR`: Use the Glaser-Lui-Rohklin algorithm. Evaluate Laguerre polynomials ``L_n`` and their derivatives ``L_n'`` by using Taylor series expansions near roots generated by solving the second-order differential equation that ``L_n`` satisfies, see [[2]](http://epubs.siam.org/doi/pdf/10.1137/06067016X).
34
+
* For ``n ≥ 128``: Use a Newton procedure on Riemann-Hilbert asymptotics of Laguerre polynomials, see [5], based on [8]. There are some heuristics to decide which expression to use, it allows a general weight ``w(x) = x^\alpha \exp(-q_m x^m)`` and this is ``O(\sqrt{n})`` when allowed to stop when the weights are below the smallest positive floating point number.
There are four kinds of Gauss-Chebyshev quadrature rules, corresponding to four weight functions:
47
+
48
+
* 1st kind, weight function ``w(x) = 1/\sqrt{1-x^2}``
49
+
* 2nd kind, weight function ``w(x) = \sqrt{1-x^2}``
50
+
* 3rd kind, weight function ``w(x) = \sqrt{(1+x)/(1-x)}``
51
+
* 4th kind, weight function ``w(x) = \sqrt{(1-x)/(1+x)}``
52
+
53
+
They are all have explicit simple formulas for the nodes and weights [[4]](https://books.google.co.jp/books?id=8FHf0P3to0UC).
30
54
31
55
```@docs
32
56
gausschebyshev(n::Integer, kind::Integer)
33
57
```
34
58
35
59
36
60
## Gauss-Jacobi quadrature
61
+
Gauss quadrature for the weight functions ``w(x) = (1-x)^\alpha(1+x)^\beta``, ``\alpha,\beta > -1``.
62
+
63
+
* For ``n ≤ 100``: Use Newton's method to solve ``P_n(x)=0``. Evaluate ``P_n`` and ``P_n'`` by three-term recurrence.
64
+
* For ``n > 100``: Use Newton's method to solve ``P_n(x)=0``. Evaluate ``P_n`` and ``P_n'`` by an asymptotic expansion (in the interior of ``[-1,1]``) and the three-term recurrence ``O(n^{-2})`` close to the endpoints. (This is a small modification to the algorithm described in [[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).)
65
+
* For ``max(a,b) > 5``: Use the Golub-Welsch algorithm requiring ``O(n^2)`` operations.
37
66
38
67
```@docs
39
68
gaussjacobi(n::Integer, α::Real, β::Real)
40
69
```
41
70
42
71
43
72
## Gauss-Radau quadrature
73
+
Gauss quadrature for the weight function ``w(x)=1``, except the endpoint ``-1`` is included as a quadrature node.
74
+
75
+
The Gauss-Radau nodes and weights can be computed via the ``(0,1)`` Gauss-Jacobi nodes and weights[[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).
44
76
45
77
```@docs
46
78
gaussradau(n::Integer)
47
79
```
48
80
49
81
50
82
## Gauss-Lobatto quadrature
83
+
Gauss quadrature for the weight function ``w(x)=1``, except the endpoints ``-1`` and ``1`` are included as nodes.
84
+
85
+
The Gauss-Lobatto nodes and weights can be computed via the ``(1,1)`` Gauss-Jacobi nodes and weights[[3]](http://epubs.siam.org/doi/abs/10.1137/120889873).
0 commit comments