Next: , Previous: , Up: Internal Routines   [Contents][Index]

15.5.344 legendre

legendre( x, lmax [, /normalize])

Calculates values of the associated Legendre polynomials of orders l from zero through lmax and degrees m from zero through l, at ordinate x. x must be between -1 and +1, inclusive, and lmax must be positive.

The associated Legendre polynomial of order l and degree m is defined as

The values for the associated Legendre polynomials can get very large. In particular, the magnitude of the associated Legendre polynomial of degree and order l is approximately equal to the square root of the factorial of l (sqrt(gamma(l + 1))), which is too great to fit in even a double-precision (double) variable on a 32-bit computer when l exceeds about 170.

If /normalize is specified, then the values of the associated Legendre polynomials are normalized appropriately for the derivation of the related spherical harmonics. In that case, the returned values are defined as which are of order unity or less. In terms of these values, the spherical harmonics are defined as

The calculated values are returned in a double array. The values are sorted by increasing order l, and secondarily by increasing degree m. The number of returned values is equal to (lmax + 1)*(lmax + 2)/2. The l + 1 values for order l start at index l*(l + 1)/2.