# LegendreP

LegendreP[n,x]

gives the Legendre polynomial .

LegendreP[n,m,x]

gives the associated Legendre polynomial .

# Details

• Mathematical function, suitable for both symbolic and numerical manipulation.
• Explicit formulas are given for integers n and m.
• The Legendre polynomials satisfy the differential equation .
• The Legendre polynomials are orthogonal with unit weight function.
• The associated Legendre polynomials are defined by .
• For arbitrary complex values of n, m, and z, LegendreP[n,z] and LegendreP[n,m,z] give Legendre functions of the first kind.
• LegendreP[n,m,a,z] gives Legendre functions of type a. The default is type 1.
• The symbolic form of type 1 involves , of type 2 involves , and of type 3 involves .
• Type 1 is defined only for within the unit circle in the complex plane. Type 2 represents an analytic continuation of type 1 outside the unit circle.
• Type 2 functions have branch cuts from to and from to in the complex plane.
• Type 3 functions have a single branch cut from to .
• LegendreP[n,m,a,z] is defined to be Hypergeometric2F1Regularized[-n,n+1,1-m,(1-z)/2] multiplied by for type 2 and by for type 3.
• For certain special arguments, LegendreP automatically evaluates to exact values.
• LegendreP can be evaluated to arbitrary numerical precision.
• LegendreP automatically threads over lists.
• LegendreP can be used with Interval and CenteredInterval objects. »

# Examples

open allclose all

## Basic Examples(6)

Evaluate numerically:

Compute the Legendre polynomial:

Plot over a subset of the reals:

Plot over a subset of the complexes:

Series expansion at the origin:

Asymptotic expansion at Infinity:

## Scope(50)

### Numerical Evaluation(7)

Evaluate numerically at fixed points:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Evaluate for complex orders and arguments:

Evaluate LegendreP efficiently at high precision:

LegendreP can deal with real-valued intervals:

Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:

Or compute average-case statistical intervals using Around:

Compute the elementwise values of an array:

Or compute the matrix LegendreP function using MatrixFunction:

### Specific Values(5)

Legendre polynomial for symbolic :

Find a local maximum as a root of :

Compute the associated Legendre polynomial :

Compute an associated Legendre polynomial for half-integer and :

Different LegendreP types give different symbolic forms:

### Visualization(3)

Plot the LegendreP function for various orders:

Plot the real part of :

Plot the imaginary part of :

Type 2 and 3 of Legendre functions have different branch cut structures:

### Function Properties(12)

is defined for all for integer and for for noninteger :

In the complex plane, it is defined for when is not an integer:

The associated Legendre function is additionally undefined at when is not an even integer:

The range for Legendre polynomials of integer orders:

The range for complex values is the whole plane:

Legendre polynomial of an odd order is odd:

Legendre polynomial of an even order is even:

Legendre polynomials have the mirror property :

is an analytic function of for integer :

It is neither analytic nor meromorphic for noninteger :

The associated Legendre function is analytic as long as is also an even integer:

is neither non-decreasing nor non-increasing for integers :

is neither non-decreasing nor non-increasing for integers :

is surjective for positive odd integer values of but not even values:

LegendreP is neither non-negative nor non-positive:

has no singularities or discontinuities when is an integer:

The associated Legendre function has additional singularities when is not an even integer:

is neither non-decreasing nor non-increasing for integers :

### Differentiation(3)

First derivative:

Higher derivatives:

Plot higher derivatives for :

Formula for the derivative:

### Integration(3)

Indefinite integral of LegendreP:

Indefinite integral of an algebraic function with :

Definite integral of :

### Series Expansions(4)

Taylor expansion for :

Plot the first three approximations for at :

General term in the series expansion of :

Taylor expansion for the associated Legendre polynomial :

LegendreP can be applied to a power series:

### Integral Transforms(4)

The Fourier transform of a Legendre polynomial with order using FourierTransform:

The Laplace transform of a Legendre polynomial with order using LaplaceTransform:

The Mellin transform of a Legendre polynomial with order using MellinTransform:

The Hankel transform of a Legendre polynomial with order using HankelTransform:

### Function Identities and Simplifications(4)

LegendreP may reduce to simpler functions:

Associated Legendre polynomials in terms of ordinary Legendre polynomials:

Sum of Legendre polynomials:

Recurrence relation:

### Function Representations(5)

Representation in terms of MeijerG:

LegendreP can be expressed as a DifferentialRoot:

SphericalHarmonicY uses associated Legendre function in its definition:

Associated Legendre polynomials in terms of the angular spheroidal function:

## Generalizations & Extensions(3)

LegendreP can deal with real-valued intervals:

Different LegendreP types give different symbolic forms:

Types 2 and 3 have different branch cut structures:

## Applications(5)

Angular momentum eigenfunctions:

The PöschlTeller potential is a special class of potentials for which the one-dimensional Schrödinger equation can be solved in terms of special functions.

Find quantum eigenfunctions for the modified PöschlTeller potential:

A -analog of the Legendre polynomial can be defined in terms of QHypergeometricPFQ:

Recover the Legendre polynomial as :

Generalized Fourier transform for functions on the interval -1 to 1:

An n-point Gaussian quadrature rule is based on the roots of the n-order Legendre polynomial. Compute the nodes and weights of an n-point Gaussian quadrature rule:

Use the n-point Gaussian quadrature rule to numerically evaluate an integral:

Compare the result of the Gaussian quadrature with the result from NIntegrate:

## Properties & Relations(4)

Use FunctionExpand to expand into simpler functions:

LegendreP can be expressed as a DifferenceRoot:

The generating function for LegendreP:

The exponential generating function for LegendreP:

## Possible Issues(1)

Cancellations in the polynomial form may lead to inaccurate numerical results:

Evaluate the function directly:

## Neat Examples(3)

Visualize distribution of zeros:

Generalized Lissajous figures:

An expression for the Legendre polynomial in terms of the Hilbert matrix:

Verify the expression for the first few cases:

Wolfram Research (1988), LegendreP, Wolfram Language function, https://reference.wolfram.com/language/ref/LegendreP.html (updated 2022).

#### Text

Wolfram Research (1988), LegendreP, Wolfram Language function, https://reference.wolfram.com/language/ref/LegendreP.html (updated 2022).

#### CMS

Wolfram Language. 1988. "LegendreP." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/LegendreP.html.

#### APA

Wolfram Language. (1988). LegendreP. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LegendreP.html

#### BibTeX

@misc{reference.wolfram_2024_legendrep, author="Wolfram Research", title="{LegendreP}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/LegendreP.html}", note=[Accessed: 15-August-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_legendrep, organization={Wolfram Research}, title={LegendreP}, year={2022}, url={https://reference.wolfram.com/language/ref/LegendreP.html}, note=[Accessed: 15-August-2024 ]}