Documentation

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 degreenand orderm = 0,1,...,n, evaluated for each element ofX。Argumentnmust be a positive integer, andXmust contain real values in the domain−1 ≤x≤ 1

IfXis a vector, thenPis an(n+1)-by-qmatrix, whereq = length(X)。Each elementP(m+1,i)corresponds to the associated Legendre function of degreenand ordermevaluated atX(i)

In general, the returned arrayPhas one more dimension thanX, and each elementP(m+1,i,j,k,...)contains the associated Legendre function of degreenand ordermevaluated atX(i,j,k,...)。注意第一行Pis 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

m = 0

-0.5000 -0.4850 -0.4400

m = 1

0 -0.2985 -0.5879

m = 2

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

collapse all

Associated Legendre Functions

The Legendre functions are defined by

P n m ( x ) = ( 1 ) m ( 1 x 2 ) m / 2 d m d x m P n ( x ) ,

where

P n ( x )

is the Legendre polynomial of degreen:

P n ( x ) = 1 2 n n ! [ d n d x n ( x 2 1 ) n ]

Schmidt Seminormalized Associated Legendre Functions

The Schmidt seminormalized associated Legendre functions are related to the nonnormalized associated Legendre functionsby

P n ( x ) for m = 0 , S n m ( x ) = ( 1 ) m 2 ( n m ) ! ( n + m ) ! P n m ( x ) for m > 0.

Fully Normalized Associated Legendre Functions

The fully normalized associated Legendre functions are normalized such that

1 1 ( N n m ( x ) ) 2 d x = 1

and are related to the unnormalized associated Legendre functionsby

N n m = ( 1 ) m ( n + 1 2 ) ( n m ) ! ( n + m ) ! P n m ( x )

Algorithms

legendreuses a three-term backward recursion relationship inm。This recursion is on a version of the Schmidt seminormalized associated Legendre functions Q n m ( x ) , which are complex spherical harmonics. These functions are related to the standard Abramowitz and Stegun[1]functions P n m ( x ) by

P n m ( x ) = ( n + m ) ! ( n m ) ! Q n m ( x )

They are related to the Schmidt form given previously by

m = 0 : S n m ( x ) = Q n 0 ( x ) m > 0 : S n m ( x ) = ( 1 ) m 2 Q n m ( x )

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.

Introduced before R2006a

Was this topic helpful?