Navigation

An orthogonal polynomial sequence is a sequence of polynomials of degree , which are mutually orthogonal in the sense that

where is some domain (e.g. an interval ) and is a fixed weight function. A sequence of orthogonal polynomials is determined completely by , , and a normalization convention (e.g. ). Applications of orthogonal polynomials include function approximation and solution of differential equations.

Orthogonal polynomials are sometimes defined using the differential equations they satisfy (as functions of ) or the recurrence relations they satisfy with respect to the order . Other ways of defining orthogonal polynomials include differentiation formulas and generating functions. The standard orthogonal polynomials can also be represented as hypergeometric series (see Hypergeometric functions), more specifically using the Gauss hypergeometric function in most cases. The following functions are generally implemented using hypergeometric functions since this is computationally efficient and easily generalizes.

Calculates the (associated) Legendre function of the second kind of
degree n and order m, . Taking gives the ordinary
Legendre function of the second kind, . The parameters may
complex numbers.

The Legendre functions of the second kind give a second set of
solutions to the (associated) Legendre differential equation.
(See legenp().)
Unlike the Legendre functions of the first kind, they are not
polynomials of for integer , but rational or logarithmic
functions with poles at .

There are various ways to define Legendre functions of
the second kind, giving rise to different complex structure.
A version can be selected using the type keyword argument.
The type=2 and type=3 functions are given respectively by

where and are the type=2 and type=3 Legendre functions
of the first kind. The formulas above should be understood as limits
when is an integer.

These functions correspond to LegendreQ[n,m,2,z] (or LegendreQ[n,m,z])
and LegendreQ[n,m,3,z] in Mathematica. The type=3 function
is essentially the same as the function defined in
Abramowitz & Stegun (eq. 8.1.3) but with instead
of , giving slightly different branches.

Evaluates the Hermite polynomial , which may be defined using
the recurrence

The Hermite polynomials are orthogonal on with
respect to the weight . More generally, allowing arbitrary complex
values of , the Hermite function is defined as

for , or generally

Plots

# Hermite polynomials H_n(x) on the real line for n=0,1,2,3,4f0=lambdax:hermite(0,x)f1=lambdax:hermite(1,x)f2=lambdax:hermite(2,x)f3=lambdax:hermite(3,x)f4=lambdax:hermite(4,x)plot([f0,f1,f2,f3,f4],[-2,2],[-25,25])

With and a nonnegative integer, this reduces to an ordinary
Laguerre polynomial, the sequence of which begins
.

The Laguerre polynomials are orthogonal with respect to the weight
on .

Plots

# Hermite polynomials L_n(x) on the real line for n=0,1,2,3,4f0=lambdax:laguerre(0,0,x)f1=lambdax:laguerre(1,0,x)f2=lambdax:laguerre(2,0,x)f3=lambdax:laguerre(3,0,x)f4=lambdax:laguerre(4,0,x)plot([f0,f1,f2,f3,f4],[0,10],[-10,10])

Here denotes the polar coordinate (ranging
from the north pole to the south pole) and denotes the
azimuthal coordinate on a sphere. Care should be used since many different
conventions for spherical coordinate variables are used.

Usually spherical harmonics are considered for ,
, . More generally,
are permitted to be complex numbers.