>  Docs Center  >  Libraries  >  ASTROLIB  >  POLYLEG
Libraries

POLYLEG

POLYLEG

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



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us