Navigation

Operators and Keywords

Function List:

C++ API

: l = legendre (n, x)
: l = legendre (n, x, normalization)

Compute the associated Legendre function of degree n and order m = 0 … n.

The value n must be a real non-negative integer.

x is a vector with real-valued elements in the range [-1, 1].

The optional argument normalization may be one of "unnorm", "sch", or "norm". The default if no normalization is given is "unnorm".

When the optional argument normalization is "unnorm", compute the associated Legendre function of degree n and order m and return all values for m = 0 … n. The return value has one dimension more than x.

The associated Legendre function of degree n and order m:

 m         m      2  m/2   d^m
P(x) = (-1) * (1-x  )    * ----  P(x)
 n                         dx^m   n

with Legendre polynomial of degree n:

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

legendre (3, [-1.0, -0.9, -0.8]) returns the matrix:

 x  |  -1.0   |  -0.9   |  -0.8
------------------------------------
m=0 |-1.00000 |-0.47250 |-0.08000
m=1 | 0.00000 |-1.99420 |-1.98000
m=2 | 0.00000 |-2.56500 |-4.32000
m=3 | 0.00000 |-1.24229 |-3.24000

When the optional argument normalization is "sch", compute the Schmidt semi-normalized associated Legendre function. The Schmidt semi-normalized associated Legendre function is related to the unnormalized Legendre functions by the following:

For Legendre functions of degree n and order 0:

  0      0
SP(x) = P(x)
  n      n

For Legendre functions of degree n and order m:

  m      m         m    2(n-m)! 0.5
SP(x) = P(x) * (-1)  * [-------]
  n      n              (n+m)!

When the optional argument normalization is "norm", compute the fully normalized associated Legendre function. The fully normalized associated Legendre function is related to the unnormalized associated Legendre functions by the following:

For Legendre functions of degree n and order m

  m      m         m    (n+0.5)(n-m)! 0.5
NP(x) = P(x) * (-1)  * [-------------]
  n      n                  (n+m)!

Package: octave