![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, GermanyNew Address! -- Neue Adresse! |
![]() |
FLEGENDRE
Compute the first M terms in a Legendre polynomial expansion.
Meant to be used as a supplied function to SVDFIT.
This procedure became partially obsolete in IDL V5.0 with the
introduction of the /LEGENDRE keyword to SVDFIT and the associated
SVDLEG function. However, note that, unlike SVDLEG, FLEGENDRE works
on vector values of X.
result = FLEGENDRE( X, M)
X - the value of the independent variable, scalar or vector
M - number of term of the Legendre expansion to compute, integer scalar
result - (N,M) array, where N is the number of elements in X and M
is the order. Contains the value of each Legendre term for
each value of X
(1) If x = 2.88 and M = 3 then
IDL> print, flegendre(x,3) ==> [1.00, 2.88, 11.9416]
This result can be checked by explicitly computing the first 3 Legendre
terms, 1.0, x, 0.5*( 3*x^2 -1)
(2) Find the coefficients to an M term Legendre polynomial that gives
the best least-squares fit to a dataset (x,y)
IDL> coeff = SVDFIT( x,y,M,func='flegendre')
The coefficients can then be supplied to the function POLYLEG to
compute the best YFIT values for any X.
The recurrence relation for the Legendre polynomials is used to compute
each term. Compare with the function FLEG in "Numerical Recipes"
by Press et al. (1992), p. 674
Written Wayne Landsman Hughes STX April 1995
Converted to IDL V5.0 W. Landsman September 1997
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]