Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 the associated Legendre functions of degree n and order m = 0,1,...,n, evaluated for each element of X. Argument n must be a scalar integer, and X must contain real values in the domain −1 ≤ x ≤ 1.

If X is a vector, then P is an (n+1)-by-q matrix, where q = length(X). Each element P(m+1,i) corresponds to the associated Legendre function of degree n and order m evaluated at X(i).

In general, the returned array P has one more dimension than X, and 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,...). Note that the first row of P is the Legendre polynomial evaluated at X, i.e., the case where m = 0.

S = legendre(n,X,'sch') computes the Schmidt Seminormalized Associated Legendre Functions.

N = legendre(n,X,'norm') computes the Fully Normalized Associated Legendre Functions.

Examples

Example 1

The statement legendre(2,0:0.1:0.2) returns the matrix

 x = 0x = 0.1x = 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

Pnm(x)=(1)m(1x2)m/2dmdxmPn(x),

where

Pn(x)

is the Legendre polynomial of degree n:

Pn(x)=12nn![dndxn(x21)n]

Schmidt Seminormalized Associated Legendre Functions

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

Pn(x) for m=0,Snm(x)=(1)m2(nm)!(n+m)!Pnm(x) for m>0.

Fully Normalized Associated Legendre Functions

The fully normalized associated Legendre functions are normalized such that

11(Nnm(x))2dx=1

and are related to the unnormalized associated Legendre functions by

Nnm=(1)m(n+12)(nm)!(n+m)!Pnm(x)

Algorithms

legendre uses a three-term backward recursion relationship in m. This recursion is on a version of the Schmidt seminormalized associated Legendre functions Qnm(x), which are complex spherical harmonics. These functions are related to the standard Abramowitz and Stegun [1] functions Pnm(x) by

Pnm(x)=(n+m)!(nm)!Qnm(x)

They are related to the Schmidt form given previously by

m=0:Snm(x)=Qn0(x)m>0:Snm(x)=(1)m2Qnm(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?