with orthogonality constraints:
The Legendre polynomials are the solutions to the Legendre equation with m = 0. For positive m, the associated Legendre functions can be written in terms of the Legendre polynomials as:
Associated polynomials for negative m are related to positive m by:
LEGENDRE is based on the routine plgndr described in section 6.8 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.
Compute the value of the Legendre polynomial at the following X values:
; Define the parametric X values:
X = [-0.75, -0.5, -0.25, 0.25, 0.5, 0.75]
; Compute the Legendre polynomial of order L=2:
result = LEGENDRE(X, 2)
; Print the result:
The result of this is:
0.343750 -0.125000 -0.406250 -0.406250 -0.125000 0.343750
Compute the value of the associated Legendre polynomial at the same X values:
; Compute the associated Legendre polynomial of order L=2, M=1:
result = LEGENDRE(X, 2, 1)
; Print the result:
1.48824 1.29904 0.726184 -0.726184 -1.29904 -1.48824
This is the exact solution vector to six-decimal accuracy.
Result = LEGENDRE( X, L [, M] [, /DOUBLE] )
If all arguments are scalar, the function returns a scalar. If all arguments are arrays, the function matches up the corresponding elements of X, L, and M, returning an array with the same dimensions as the smallest array. If one argument is a scalar and the other arguments are arrays, the function uses the scalar value with each element of the arrays, and returns an array with the same dimensions as the smallest input array.
If any of the arguments are double-precision or if the DOUBLE keyword is set, the result is double-precision, otherwise the result is single-precision.
The expression for which is evaluated. Values for X must be in the range –1 ≤X ≤ 1.
An integer scalar or array, L≥ 0, specifying the order l of . If L is of type float, it will be truncated.
An integer scalar or array, –L≤M≤L, specifying the order m of . If M is not specified, then the default M = 0 is used and the Legendre polynomial, Pl(x), is returned. If M is of type float, it will be truncated.
Set this keyword to force the computation to be done in double-precision arithmetic.