Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  Libraries  >  ASTROLIB  >  FLEGENDRE

FLEGENDRE

## Name

FLEGENDRE

## Purpose

Compute the first M terms in a Legendre polynomial expansion.

## Explanation

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.

## Calling Sequence

result = FLEGENDRE( X, M)

## Inputs

X - the value of the independent variable, scalar or vector
M - number of term of the Legendre expansion to compute, integer scalar

## Outputs

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

## Example

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

## Method

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

## Revision History

Written Wayne Landsman Hughes STX April 1995
Converted to IDL V5.0 W. Landsman September 1997

© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us