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

`legendre( `

`x`, `lmax` [, /normalize])

Calculates values of the associated Legendre polynomials of orders
`l`

from zero through

and degrees `lmax``m`

from
zero through `l`

, at ordinate

. `x`

must
be between `x``-1`

and `+1`

, inclusive, and

must be positive.
`lmax`

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
`(`

. The `lmax` + 1)*(`lmax` + 2)/2`l + 1`

values for
order `l`

start at index `l*(l + 1)/2`

.