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
Copy file name to clipboardExpand all lines: docs/src/index.md
+83-27Lines changed: 83 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,14 @@ DocTestSetup = quote
5
5
end
6
6
```
7
7
8
-
#Introduction
8
+
## Definition
9
9
10
-
Compute [Legendre polynomials](https://en.wikipedia.org/wiki/Legendre_polynomials), [Associated Legendre polynomials](https://en.wikipedia.org/wiki/Associated_Legendre_polynomials), and their derivatives using a 3-term recursion relation (Bonnet’s recursion formula).
10
+
### Legendre polynomials
11
+
12
+
[Legendre polynomials](https://en.wikipedia.org/wiki/Legendre_polynomials) satisfy the differential equation
11
13
12
14
```math
13
-
P_\ell(x) = \left((2\ell-1) x P_{\ell-1}(x) - (\ell-1)P_{\ell - 2}(x)\right)/\ell
Optionally, normalized polynomials may be evaluated that have an L2 norm of `1`.
23
-
24
-
Analogous to Legendre polynomials, one may evaluate associated Legendre polynomials using a 3-term recursion relation. This is evaluated by iterating over the normalized associated Legendre functions, and multiplying the norm at the final stage. Such an iteration avoids floating-point overflow.
24
+
### Associated Legendre polynomials
25
25
26
-
The relation used in evaluating normalized associated Legendre polynomials ``\bar{P}_{\ell}^{m}\left(x\right)`` is
*[`Pl(x,l; [norm = Val(:standard)])`](@ref Pl): this evaluates the Legendre polynomial for a given degree `l` at the argument `x`. The argument needs to satisfy `-1 <= x <= 1`.
52
-
*[`collectPl(x; lmax, [lmin = 0], [norm = Val(:standard)])`](@ref collectPl): this evaluates all the polynomials for `l` lying in `0:lmax` at the argument `x`. As before the argument needs to lie in the domain of validity. Functionally this is equivalent to `Pl.(x, lmin:lmax)`, except `collectPl` evaluates the result in one pass, and is therefore faster. There is also the in-place version [`collectPl!`](@ref) that uses a pre-allocated array.
53
-
*[`Plm(x, l, m; [norm = Val(:standard)])`](@ref Plm): this evaluates the associated Legendre polynomial ``P_\ell^m(x)`` at the argument ``x``. The argument needs to satisfy `-1 <= x <= 1`.
54
-
*[`collectPlm(x; m, lmax, [lmin = abs(m)], [norm = Val(:standard)])`](@ref collectPlm): this evaluates the associated Legendre polynomials with coefficient `m` for `l = lmin:lmax`. There is also an in-place version [`collectPlm!`](@ref) that uses a pre-allocated array.
55
-
*[`dnPl(x, l, n)`](@ref dnPl): this evaluates the ``n``-th derivative of the Legendre polynomial ``P_\ell(x)`` at the argument ``x``. The argument needs to satisfy `-1 <= x <= 1`.
56
-
*[`collectdnPl(x; n, lmax)`](@ref collectdnPl): this evaluates the ``n``-th derivative of all the Legendre polynomials for `l = 0:lmax`. There is also an in-place version [`collectdnPl!`](@ref) that uses a pre-allocated array.
44
+
The Condon-Shortley phase is included by default, and may be toggled by using the keyword argument `csphase`.
57
45
58
-
# Quick Start
46
+
##Quick Start
59
47
60
48
Evaluate the Legendre polynomial for one `l` at an argument`x` as `Pl(x, l)`:
Compute [Legendre polynomials](https://en.wikipedia.org/wiki/Legendre_polynomials), [Associated Legendre polynomials](https://en.wikipedia.org/wiki/Associated_Legendre_polynomials), and their derivatives using a 3-term recursion relation (Bonnet’s recursion formula).
114
+
115
+
```math
116
+
P_\ell(x) = \left((2\ell-1) x P_{\ell-1}(x) - (\ell-1)P_{\ell - 2}(x)\right)/\ell
117
+
```
118
+
119
+
Analogous to Legendre polynomials, one may evaluate associated Legendre polynomials using a 3-term recursion relation. This is evaluated by iterating over the normalized associated Legendre functions, and multiplying the norm at the final stage. Such an iteration avoids floating-point overflow.
120
+
121
+
The relation used in evaluating normalized associated Legendre polynomials ``\bar{P}_{\ell}^{m}\left(x\right)`` is
*[`Pl(x,l; [norm = Val(:standard)])`](@ref Pl): this evaluates the Legendre polynomial for a given degree `l` at the argument `x`. The argument needs to satisfy `-1 <= x <= 1`.
149
+
*[`collectPl(x; lmax, [lmin = 0], [norm = Val(:standard)])`](@ref collectPl): this evaluates all the polynomials for `l` lying in `0:lmax` at the argument `x`. As before the argument needs to lie in the domain of validity. Functionally this is equivalent to `Pl.(x, lmin:lmax)`, except `collectPl` evaluates the result in one pass, and is therefore faster. There is also the in-place version [`collectPl!`](@ref) that uses a pre-allocated array.
150
+
*[`Plm(x, l, m; [norm = Val(:standard)], [csphase = true])`](@ref Plm): this evaluates the associated Legendre polynomial ``P_\ell^m(x)`` at the argument ``x``. The argument needs to satisfy `-1 <= x <= 1`.
151
+
*[`collectPlm(x; m, lmax, [lmin = abs(m)], [norm = Val(:standard)], [csphase = true])`](@ref collectPlm): this evaluates the associated Legendre polynomials with coefficient `m` for `l = lmin:lmax`. There is also an in-place version [`collectPlm!`](@ref) that uses a pre-allocated array.
152
+
*[`dnPl(x, l, n)`](@ref dnPl): this evaluates the ``n``-th derivative of the Legendre polynomial ``P_\ell(x)`` at the argument ``x``. The argument needs to satisfy `-1 <= x <= 1`.
153
+
*[`collectdnPl(x; n, lmax)`](@ref collectdnPl): this evaluates the ``n``-th derivative of all the Legendre polynomials for `l = 0:lmax`. There is also an in-place version [`collectdnPl!`](@ref) that uses a pre-allocated array.
154
+
155
+
## Normalization options
156
+
157
+
By default, the Legendre and associated Legendre polynomials are not normalized.
158
+
One may specify the normalization through the keyword argument `norm`.
159
+
The normalization options accepted are
160
+
161
+
*`norm = Val(:standard)`: standard, unnormalized polynomials. This is the default option. Choosing this option will lead to the standard Legendre or associated Legendre polynomials that satisfy ``P_\ell(0)=1`` and ``P_{\ell0}(0)=1``
162
+
*`norm = Val(:normalized)`: fully normalized polynomials, with an L2 norm of 1. These are defined as
*`norm = Val(:schmidtquasi)`: Schmidt quasi-normalized polynomials, also known as Schmidt semi-normalized polynomials. These have an L2 norm of ``\sqrt{2(2-\delta_{m0})/(2\ell+1)}``. These are defined as
By default, the Legendre and associated Legendre polynomials are not normalized.
8
-
One may specify the normalization through the keyword argument `norm`.
9
-
The normalization options accepted are
10
-
11
-
*`norm = Val(:standard)`: standard, unnormalized polynomials. This is the default option.
12
-
*`norm = Val(:normalized)`: fully normalized polynomials with an L2 norm of 1
13
-
14
-
!!! note
15
-
Irrespective of the norm specified, the 3-term recursion relations used are stable ones,
16
-
so polynomials of high degrees may be computed without overflow.
7
+
The norm of the polynomials may be specified through the keyword argument `norm`. The various normalization options are listed in the [Normalization options](@ref) section.
Starting from these, other normalization such as the [Ambix SN3D format](https://en.wikipedia.org/wiki/Ambisonic_data_exchange_formats#SN3D) may be constructed as
28
+
29
+
```julia
30
+
julia>Plmambix(x, l, m) =Plm(x, l, m, norm=Val(:schmidtquasi)) /√(4pi)
31
+
Plmambix (generic function with 1 method)
32
+
33
+
julia>Plmambix(0.5, 2, 1)
34
+
-0.21157109383040862
35
+
```
36
+
36
37
## Condon-Shortley phase
37
38
38
39
By default, the associated Legendre polynomials are computed by including the Condon-Shortley phase ``(-1)^m``.
0 commit comments