legendre
Associated Legendre functions
Syntax
P = legendre(n,X)
S = legendre(n,X,'sch')
N = legendre(n,X,'norm')
Description
P = legendre(n,X)
computes theassociated Legendre functionsof degreen
and orderm = 0,1,...,n
, evaluated for each element ofX
。Argumentn
must be a positive integer, andX
must contain real values in the domain−1 ≤x≤ 1。
IfX
is a vector, thenP
is an(n+1)
-by-q
matrix, whereq = length(X)
。Each elementP(m+1,i)
corresponds to the associated Legendre function of degreen
and orderm
evaluated atX(i)
。
In general, the returned arrayP
has one more dimension thanX
, and each elementP(m+1,i,j,k,...)
contains the associated Legendre function of degreen
and orderm
evaluated atX(i,j,k,...)
。注意第一行P
is the Legendre polynomial evaluated atX
, i.e., the case wherem
= 0.
S = legendre(n,X,'sch')
computes theSchmidt Seminormalized Associated Legendre Functions。
N = legendre(n,X,'norm')
computes theFully Normalized Associated Legendre Functions。
Examples
Example 1
The statementlegendre(2,0:0.1:0.2)
returns the matrix
x = 0 | x = 0.1 | x = 0.2 | |
---|---|---|---|
|
-0.5000 |
-0.4850 |
-0.4400 |
|
0 |
-0.2985 |
-0.5879 |
|
3.0000 |
2.9700 |
2.8800 |
Example 2
Given,
X = rand(2,4,5); n = 2; P = legendre(n,X)
then
size(P) ans = 3 2 4 5
and
P(:,1,2,3) ans = -0.2475 -1.1225 2.4950
is the same as
legendre(n,X(1,2,3)) ans = -0.2475 -1.1225 2.4950l
More About
Algorithms
legendre
uses a three-term backward recursion relationship inm
。This recursion is on a version of the Schmidt seminormalized associated Legendre functions
, which are complex spherical harmonics. These functions are related to the standard Abramowitz and Stegun[1]functions
by
They are related to the Schmidt form given previously by
References
[1] Abramowitz, M. and I. A. Stegun,Handbook of Mathematical Functions, Dover Publications, 1965, Ch.8.
[2] Jacobs, J. A.,Geomagnetism, Academic Press, 1987, Ch.4.