Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Associated Legendre functions

`P = legendre(n,X)`

S = legendre(n,X,'sch')

N = legendre(n,X,'norm')

`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 positive 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.

The statement `legendre(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` |

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

`legendre`

uses a three-term backward recursion
relationship in `m`

. This recursion is on a version
of the Schmidt seminormalized associated Legendre functions $${Q}_{n}^{m}\left(x\right)$$,
which are complex spherical harmonics. These functions are related
to the standard Abramowitz and Stegun [1] functions $${P}_{n}^{m}\left(x\right)$$ by

$${P}_{n}^{m}\left(x\right)=\sqrt{\frac{\left(n+m\right)!}{\left(n-m\right)!}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}{Q}_{n}^{m}\left(x\right)$$

They are related to the Schmidt form given previously by

$$\begin{array}{l}m=0:\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}{S}_{n}^{m}\left(x\right)={Q}_{n}^{0}\left(x\right)\\ m>0:\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}{S}_{n}^{m}\left(x\right)={\left(-1\right)}^{m}\sqrt{2}\text{\hspace{0.17em}}\text{\hspace{0.17em}}{Q}_{n}^{m}\left(x\right)\end{array}$$

[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.

Was this topic helpful?