# LEGENDRE_POLYNOMIAL Legendre Polynomials

LEGENDRE_POLYNOMIAL is a FORTRAN90 library which evaluates the Legendre polynomial and associated functions.

The Legendre polynomial P(n,x) can be defined by:

```        P(0,x) = 1
P(1,x) = x
P(n,x) = (2*n-1)/n * x * P(n-1,x) - (n-1)/n * P(n-2,x)
```
where n is a nonnegative integer.

The N zeroes of P(n,x) are the abscissas used for Gauss-Legendre quadrature of the integral of a function F(X) with weight function 1 over the interval [-1,1].

The Legendre polynomials are orthogonal under the inner product defined as integration from -1 to 1:

```        Integral ( -1 <= x <= 1 ) P(i,x) * P(j,x) dx
= 0 if i =/= j
= 2 / ( 2*i+1 ) if i = j.
```

### Languages:

LEGENDRE_POLYNOMIAL is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

BERNSTEIN_POLYNOMIAL, a FORTRAN90 library which evaluates the Bernstein polynomials, useful for uniform approximation of functions;

CHEBYSHEV_POLYNOMIAL, a FORTRAN90 library which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.

GEGENBAUER_POLYNOMIAL, a FORTRAN90 library which evaluates the Gegenbauer polynomial and associated functions.

HERMITE_POLYNOMIAL, a FORTRAN90 library which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.

INT_EXACTNESS_LEGENDRE, a FORTRAN90 program which tests the polynomial exactness of Gauss-Legendre quadrature rules.

JACOBI_POLYNOMIAL, a FORTRAN90 library which evaluates the Jacobi polynomial and associated functions.

LAGUERRE_POLYNOMIAL, a FORTRAN90 library which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

LEGENDRE_PRODUCT_POLYNOMIAL, a FORTRAN90 library which defines Legendre product polynomials, creating a multivariate polynomial as the product of univariate Legendre polynomials.

LEGENDRE_RULE, a FORTRAN90 program which computes a 1D Gauss-Legendre quadrature rule.

LOBATTO_POLYNOMIAL, a FORTRAN90 library which evaluates Lobatto polynomials, similar to Legendre polynomials except that they are zero at both endpoints.

POLPAK, a FORTRAN90 library which evaluates a variety of mathematical functions.

TEST_VALUES, a FORTRAN90 library which supplies test values of various mathematical functions.

### Reference:

1. Theodore Chihara,
An Introduction to Orthogonal Polynomials,
Gordon and Breach, 1978,
ISBN: 0677041500,
LC: QA404.5 C44.
2. Walter Gautschi,
Orthogonal Polynomials: Computation and Approximation,
Oxford, 2004,
ISBN: 0-19-850672-4,
LC: QA404.5 G3555.
3. Frank Olver, Daniel Lozier, Ronald Boisvert, Charles Clark,
NIST Handbook of Mathematical Functions,
Cambridge University Press, 2010,
ISBN: 978-0521192255,
LC: QA331.N57.
4. Gabor Szego,
Orthogonal Polynomials,
American Mathematical Society, 1992,
ISBN: 0821810235,
LC: QA3.A5.v23.

### List of Routines:

• IMTQLX diagonalizes a symmetric tridiagonal matrix.
• P_EXPONENTIAL_PRODUCT: exponential products for P(n,x).
• P_INTEGRAL evaluates a monomial integral associated with P(n,x).
• P_POLYNOMIAL_COEFFICIENTS: coefficients of Legendre polynomials P(n,x).
• P_POLYNOMIAL_PRIME evaluates the derivative of Legendre polynomials P(n,x).
• P_POLYNOMIAL_PRIME2: second derivative of Legendre polynomials P(n,x).
• P_POLYNOMIAL_VALUE evaluates the Legendre polynomials P(n,x).
• P_POLYNOMIAL_VALUES returns values of the Legendre polynomials P(n,x).
• P_POLYNOMIAL_ZEROS: zeros of Legendre function P(n,x).
• P_POWER_PRODUCT: power products for Legendre polynomial P(n,x).
• PM_POLYNOMIAL_VALUE evaluates the Legendre polynomials Pm(n,m,x).
• PM_POLYNOMIAL_VALUES returns values of Legendre polynomials Pm(n,m,x).
• PMN_POLYNOMIAL_VALUE: normalized Legendre polynomial Pmn(n,m,x).
• PMN_POLYNOMIAL_VALUES: normalized Legendre polynomial Pmn(n,m,x).
• PMNS_POLYNOMIAL_VALUE: sphere-normalized Legendre polynomial Pmns(n,m,x).
• PMNS_POLYNOMIAL_VALUES: sphere-normalized Legendre polynomial Pmns(n,m,x).
• PN_PAIR_PRODUCT: pair products for normalized Legendre polynomial Pn(n,x).
• PN_POLYNOMIAL_COEFFICIENTS: coefficients of normalized Legendre Pn(n,x).
• PN_POLYNOMIAL_VALUE evaluates the normalized Legendre polynomials Pn(n,x).
• R8_FACTORIAL computes the factorial of N.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• R8VEC_LINSPACE creates a vector of linearly spaced values.
• R8VEC_PRINT prints an R8VEC.
• R8VEC2_PRINT prints an R8VEC2.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the FORTRAN90 source codes.

Last revised on 17 October 2014.