- NAME
POLYLEG
- PURPOSE
Evaluate a Legendre polynomial with specified coefficients.
- EXPLANATION
Meant to be used analogously to the POLY function in the IDL User's
Library distribution.
- CALLING SEQUENCE
Result = POLYLEG( X, C )
- INPUTS
X - input variable, scalar or vector
C - vector of Legendre polynomial coefficients.
- OUTPUTS
POLYLEG returns a result equal to:
C[0] + C[1]*P_1(x) + C[2]*P_2(x) + ...
where P_j(x) is the jth Legendre polynomial. The output will have
the same dimensions as the input X variable.
- EXAMPLE
If x = [0.5, 1.0] and C = [2.4, 1.3, 2.5] then
print, polyleg(x, c) ====> [2.7375, 6.20]
The result can be checked using the first 3 Legendre polynomial terms
C[0] + C[1]*x + C[2]*(0.5*(3*x^2-1))
- METHOD
Uses the recurrence relation of Legendre polynomials
(n+1)*P_n+1(x) = (2n+1)*x*P_n(x) - n*P_n-1(x)
evaluated with the Clenshaw recurrence formula, see Numerical Recipes
by Press et al. (1992), Section 5.5
- REVISION HISTORY
Written W. Landsman Hughes STX Co. April, 1995
Fixed for double precision W. Landsman May, 1997
Converted to IDL V5.0 W. Landsman September 1997