Friday, January 27, 2006
Legendre Polynomials
Legendre
>> help legendre
LEGENDRE Associated Legendre function.
P = LEGENDRE(N,X) computes the associated Legendre functions
of degree N and order M = 0, 1, ..., N, evaluated for each element
of X. N must be a scalar integer and X must contain real values
between -1 <= X <= 1.
If X is a vector, P is an (N+1)-by-L matrix, where L = length(X).
The P(M+1,i) entry corresponds to the associated Legendre function
of degree N and order M evaluated at X(i).
In general, the returned array has one more dimension than X.
Each element P(M+1,i,j,k,...) contains the associated Legendre
function of degree N and order M evaluated at X(i,j,k,...).
There are three possible normalizations, LEGENDRE(N,X,normalize)
where normalize is 'unnorm','sch' or 'norm'.
The default, unnormalized associated Legendre functions are:
P(N,M;X) = (-1)^M * (1-X^2)^(M/2) * (d/dX)^M { P(N,X) },
where P(N,X) is the Legendre polynomial of degree N. Note that
the first row of P is the Legendre polynomial evaluated at X
(the M == 0 case).
SP = LEGENDRE(N,X,'sch') computes the Schmidt semi-normalized
associated Legendre functions SP(N,M;X). These functions are
related to the unnormalized associated Legendre functions
P(N,M;X) by:
SP(N,M;X) = P(N,X), M = 0
= (-1)^M * sqrt(2*(N-M)!/(N+M)!) * P(N,M;X), M > 0
NP = LEGENDRE(N,X,'norm') computes the fully-normalized
associated Legendre functions NP(N,M;X). These functions are
normalized such that
/1
|
| [NP(N,M;X)]^2 dX = 1 ,
|
/-1
and are related to the unnormalized associated Legendre
functions P(N,M;X) by:
NP(N,M;X) = (-1)^M * sqrt((N+1/2)*(N-M)!/(N+M)!) * P(N,M;X)
Examples:
1. legendre(2, 0.0:0.1:0.2) returns the matrix:
| x = 0 x = 0.1 x = 0.2
------|---------------------------------------------
m = 0 | -0.5000 -0.4850 -0.4400
m = 1 | 0 -0.2985 -0.5879
m = 2 | 3.0000 2.9700 2.8800
2. X = rand(2,4,5); N = 2;
P = legendre(N,X);
so that size(P) is 3x2x4x5 and
P(:,1,2,3) is the same as legendre(N,X(1,2,3)).