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
* normalized legendre polynomials
* separate iterations for Pl and Plm
* bugfix in Pl, fix docs
* update docs
* remove unused function normtype
* remove lmax from iterator
* accept lmin in collectPl* functions
* embarrassing bugfix in Pl norm
* Add logfactorial caches
* Add tests for norm
* update docs
* Optionally set the CS phase
* Add test for non-overflow
* promote lmin/lmax in collectPl*
* Add test for large-degree Pl
* Accept negative orders
* Add norm tests for negative order
* update docs for negative m
* Add precision tests for BigFloat
* Add tests for parity
Optionally, normalized polynomials may be evaluated that have an L2 norm of `1`.
23
23
24
-
*[`Pl(x,l)`](@ref Pl): this evaluates the Legendre polynomial for a given degree `l` at the argument `x`. The argument needs to satisfy `-1 <= x <= 1`.
25
-
*[`collectPl(x; lmax)`](@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, 0: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.
26
-
*[`Plm(x, l, m)`](@ref Plm): this evaluates the associated Legendre polynomial ``P_\ell,m(x)`` at the argument ``x``. The argument needs to satisfy `-1 <= x <= 1`.
27
-
*[`collectPlm(x; m, lmax)`](@ref collectPlm): this evaluates the associated Legendre polynomials with coefficient `m` for `l = 0:lmax`. There is also an in-place version [`collectPlm!`](@ref) that uses a pre-allocated array.
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.
25
+
26
+
The relation used in evaluating normalized associated Legendre polynomials ``\bar{P}_{\ell}^{m}\left(x\right)`` is
*[`Pl(x,l; [norm])`](@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, [norm])`](@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, 0: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])`](@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, [norm])`](@ref collectPlm): this evaluates the associated Legendre polynomials with coefficient `m` for `l = abs(m):lmax`. There is also an in-place version [`collectPlm!`](@ref) that uses a pre-allocated array.
28
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`.
29
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.
30
57
@@ -33,15 +60,21 @@ There are six main functions:
33
60
Evaluate the Legendre polynomial for one `l` at an argument`x` as `Pl(x, l)`:
34
61
35
62
```jldoctest
36
-
julia> Pl(0.5, 3)
63
+
julia> p = Pl(0.5, 3)
37
64
-0.4375
65
+
66
+
julia> p ≈ -7/16 # analytical value
67
+
true
38
68
```
39
69
40
70
Evaluate the associated Legendre Polynomial one `l,m` pair as `Plm(x, l, m)`:
41
71
42
72
```jldoctest
43
-
julia> Plm(0.5, 3, 2)
44
-
5.625
73
+
julia> p = Plm(0.5, 3, 2)
74
+
5.624999999999997
75
+
76
+
julia> p ≈ 45/8 # analytical value
77
+
true
45
78
```
46
79
47
80
Evaluate the `n`th derivative for one `l` as `dnPl(x, l, n)`:
@@ -51,7 +84,8 @@ julia> dnPl(0.5, 3, 2)
51
84
7.5
52
85
```
53
86
54
-
Evaluate all the polynomials for `l` in `0:lmax` as `collectPl(x; lmax)`
87
+
Evaluate the Legendre polynomials for `l` in `lmin:lmax` as `collectPl(x; lmin, lmax)`.
88
+
By default `lmin` is chosen to be `0`, and may be omitted.
0 commit comments