Special Functions
Mathematica includes all the common special functions of mathematical physics found in standard handbooks. Each of the various classes of functions is discussed in turn.
One point you should realize is that in the technical literature there are often several conflicting definitions of any particular special function. When you use a special function in
Mathematica, therefore, you should be sure to look at the definition given here to confirm that it is exactly what you want.
Mathematica gives exact results for some values of special functions.
| Out[1]= |  |
No exact result is known here.
| Out[2]= |  |
A numerical result, to arbitrary precision, can nevertheless be found.
| Out[3]= |  |
You can give complex arguments to special functions.
| Out[4]= |  |
Special functions automatically get applied to each element in a list.
| Out[5]= |  |
Mathematica knows analytic properties of special functions, such as derivatives.
| Out[6]= |  |
You can use
FindRoot to find roots of special functions.
| Out[7]= |  |
Special functions in
Mathematica can usually be evaluated for arbitrary complex values of their arguments. Often, however, the defining relations given in this tutorial apply only for some special choices of arguments. In these cases, the full function corresponds to a suitable extension or analytic continuation of these defining relations. Thus, for example, integral representations of functions are valid only when the integral exists, but the functions themselves can usually be defined elsewhere by analytic continuation.
As a simple example of how the domain of a function can be extended, consider the function represented by the sum

. This sum converges only when

. Nevertheless, it is easy to show analytically that for any

, the complete function is equal to

. Using this form, you can easily find a value of the function for any

, at least so long as

.
Gamma and Related Functions
| Beta[a,b] | Euler beta function  |
| Beta[z,a,b] | incomplete beta function  |
| BetaRegularized[z,a,b] | regularized incomplete beta function  |
| Gamma[z] | Euler gamma function  |
| Gamma[a,z] | incomplete gamma function  |
| Gamma[a,z0,z1] | generalized incomplete gamma function  |
| GammaRegularized[a,z] | regularized incomplete gamma function  |
| InverseBetaRegularized[s,a,b] | inverse beta function |
| InverseGammaRegularized[a,s] | inverse gamma function |
| Pochhammer[a,n] | Pochhammer symbol  |
| PolyGamma[z] | digamma function  |
| PolyGamma[n,z] |  derivative of the digamma function  |
| LogGamma[z] | Euler log-gamma function  |
| LogBarnesG[z] | logarithm of Barnes G-function  |
| BarnesG[z] | Barnes G-function  |
| Hyperfactorial[n] | hyperfactorial function  |
Gamma and related functions.
The
Euler gamma function Gamma[z] is defined by the integral

. For positive integer

,

.

can be viewed as a generalization of the factorial function, valid for complex arguments

.
There are some computations, particularly in number theory, where the logarithm of the gamma function often appears. For positive real arguments, you can evaluate this simply as
Log[Gamma[z]]. For complex arguments, however, this form yields spurious discontinuities.
Mathematica therefore includes the separate function
LogGamma[z], which yields the
logarithm of the gamma function with a single branch cut along the negative real axis.
The
Euler beta function Beta
is

.
The
Pochhammer symbol or
rising factorial Pochhammer
is

. It often appears in series expansions for hypergeometric functions. Note that the Pochhammer symbol has a definite value even when the gamma functions that appear in its definition are infinite.
The
incomplete gamma function Gamma
is defined by the integral

.
Mathematica includes a generalized incomplete gamma function
Gamma
defined as

.
The alternative incomplete gamma function

can therefore be obtained in
Mathematica as
Gamma
.
The
incomplete beta function Beta
is given by

. Notice that in the incomplete beta function, the parameter

is an
upper limit of integration, and appears as the
first argument of the function. In the incomplete gamma function, on the other hand,

is a
lower limit of integration, and appears as the
second argument of the function.
In certain cases, it is convenient not to compute the incomplete beta and gamma functions on their own, but instead to compute
regularized forms in which these functions are divided by complete beta and gamma functions.
Mathematica includes the
regularized incomplete beta function BetaRegularized
defined for most arguments by

, but taking into account singular cases.
Mathematica also includes the
regularized incomplete gamma function GammaRegularized
defined by

, with singular cases taken into account.
The incomplete beta and gamma functions, and their inverses, are common in statistics. The
inverse beta function InverseBetaRegularized
is the solution for

in

. The
inverse gamma function InverseGammaRegularized
is similarly the solution for

in

.
Derivatives of the gamma function often appear in summing rational series. The
digamma function PolyGamma[z] is the logarithmic derivative of the gamma function, given by

. For integer arguments, the digamma function satisfies the relation

, where

is Euler's constant (
EulerGamma in
Mathematica) and

are the harmonic numbers.
The
polygamma functions PolyGamma
are given by

. Notice that the digamma function corresponds to

. The general form

is the


, not the


, logarithmic derivative of the gamma function. The polygamma functions satisfy the relation

.
PolyGamma
is defined for arbitrary complex

by fractional calculus analytic continuation.
BarnesG[z] is a generalization of the
Gamma function and is defined by its functional identity
BarnesG[z+1]=Gamma[z] BarnesG[z], where the third derivative of the logarithm of
BarnesG is positive for positive
z.
BarnesG is an entire function in the complex plane.
LogBarnesG[z] is a holomorphic function with a branch cut along the negative real-axis such that
Exp[LogBarnesG[z]]=BarnesG[z].
Hyperfactorial[n] is a generalization of

to the complex plane.
Many exact results for gamma and polygamma functions are built into
Mathematica.
Here is a contour plot of the gamma function in the complex plane.
| Out[4]= |  |
Zeta and Related Functions
| DirichletL[k,j,s] | Dirichlet L-function  |
| LerchPhi[z,s,a] | Lerch's transcendent  |
| PolyLog[n,z] | polylogarithm function  |
| PolyLog[n,p,z] | Nielsen generalized polylogarithm function  |
| RamanujanTau[n] | Ramanujan function  |
| RamanujanTauL[n] | Ramanujan Dirichlet L-function  |
| RamanujanTauTheta[n] | Ramanujan theta function  |
| RamanujanTauZ[n] | Ramanujan Z-function  |
| RiemannSiegelTheta[t] | Riemann-Siegel function  |
| RiemannSiegelZ[t] | Riemann-Siegel function  |
| StieltjesGamma[n] | Stieltjes constants  |
| Zeta[s] | Riemann zeta function  |
| Zeta[s,a] | generalized Riemann zeta function  |
| HurwitzZeta[s,a] | Hurwitz zeta function  |
| HurwitzLerchPhi[z,s,a] | Hurwitz-Lerch transcendent  |
Zeta and related functions.
The Dirichlet-
L function
DirichletL
is implemented as

(for

) where

is a Dirichlet character with modulus

and index

.
The
Riemann zeta function Zeta[s] is defined by the relation

(for

). Zeta functions with integer arguments arise in evaluating various sums and integrals.
Mathematica gives exact results when possible for zeta functions with integer arguments.
There is an analytic continuation of

for arbitrary complex

. The zeta function for complex arguments is central to number theoretic studies of the distribution of primes. Of particular importance are the values on the critical line

.
In studying

, it is often convenient to define the two
Riemann-Siegel functions RiemannSiegelZ[t] and
RiemannSiegelTheta[t] according to

and

(for

real). Note that the Riemann-Siegel functions are both real as long as

is real.
The
Stieltjes constants StieltjesGamma[n] are generalizations of Euler's constant that appear in the series expansion of

around its pole at

; the coefficient of

is

. Euler's constant is

.
The
generalized Riemann zeta function Zeta
is implemented as

, where any term with

is excluded.
The Hurwitz zeta function
HurwitzZeta
is implemented as

.
The Ramanujan

Dirichlet L-function
RamanujanTauL[s] is defined by

(for

), with coefficients
RamanujanTau[n]. In analogy with the
Riemann zeta function, it is again convenient to define the functions
RamanujanTauZ[t] and
RamanujanTauTheta[t].
Here is the numerical approximation for

.
Here is a three-dimensional picture of the real part of a Dirichlet L-function.
Mathematica gives exact results for

.
Here is a three-dimensional picture of the Riemann zeta function in the complex plane.
This is a plot of the absolute value of the Riemann zeta function on the critical line

. You can see the first few zeros of the zeta function.
This is a plot of the absolute value of the Ramanujan

L function on its critical line

.
The
polylogarithm functions PolyLog
are given by

. The polylogarithm function is sometimes known as
Jonquière's function. The
dilogarithm PolyLog
satisfies

. Sometimes

is known as
Spence's integral. The
Nielsen generalized polylogarithm functions or
hyperlogarithms PolyLog
are given by

. Polylogarithm functions appear in Feynman diagram integrals in elementary particle physics, as well as in algebraic K-theory.
The
Lerch transcendent LerchPhi
is a generalization of the zeta and polylogarithm functions, given by

, where any term with

is excluded. Many sums of reciprocal powers can be expressed in terms of the Lerch transcendent. For example, the
Catalan beta function 
can be obtained as

.
The Lerch transcendent is related to integrals of the
Fermi-Dirac distribution in statistical mechanics by

.
The Lerch transcendent can also be used to evaluate
Dirichlet L-series that appear in number theory. The basic
L-series has the form

, where the "character"

is an integer function with period

.
L-series of this kind can be written as sums of Lerch functions with

a power of

.
LerchPhi[z, s, a, DoublyInfinite->True] gives the doubly infinite sum

.
The
Hurwitz-Lerch transcendent HurwitzLerchPhi
generalizes
HurwitzZeta
and is defined by

.
| ZetaZero[k] | the  zero of the zeta function on the critical line |
| ZetaZero[k,x0] | the  zero above height  |
Zeros of the zeta function.
ZetaZero
represents the first nontrivial zero of

.
This gives its numerical value.
This gives the first zero with height greater than 15.
Exponential Integral and Related Functions
Exponential integral and related functions.
Mathematica has two forms of exponential integral:
ExpIntegralE and
ExpIntegralEi.
The
exponential integral function ExpIntegralE
is defined by

.
The second
exponential integral function ExpIntegralEi[z] is defined by

(for

), where the principal value of the integral is taken.
The
logarithmic integral function LogIntegral[z] is given by

(for

), where the principal value of the integral is taken.

is central to the study of the distribution of primes in number theory. The logarithmic integral function is sometimes also denoted by

. In some number theoretic applications,

is defined as

, with no principal value taken. This differs from the definition used in
Mathematica by the constant

.
The
sine and cosine integral functions SinIntegral[z] and
CosIntegral[z] are defined by

and

. The
hyperbolic sine and cosine integral functions SinhIntegral[z] and
CoshIntegral[z] are defined by

and

.
Error Function and Related Functions
| Erf[z] | error function  |
| Erf[z0,z1] | generalized error function  |
| Erfc[z] | complementary error function  |
| Erfi[z] | imaginary error function  |
| FresnelC[z] | Fresnel integral  |
| FresnelS[z] | Fresnel integral  |
| InverseErf[s] | inverse error function |
| InverseErfc[s] | inverse complementary error function |
Error function and related functions.
The
error function Erf[z] is the integral of the Gaussian distribution, given by

. The
complementary error function Erfc[z] is given simply by

. The
imaginary error function Erfi[z] is given by

. The generalized error function
Erf
is defined by the integral

. The error function is central to many calculations in statistics.
The
inverse error function InverseErf[s] is defined as the solution for

in the equation

. The inverse error function appears in computing confidence intervals in statistics as well as in some algorithms for generating Gaussian random numbers.
Closely related to the error function are the
Fresnel integrals FresnelC[z] defined by

and
FresnelS[z] defined by

. Fresnel integrals occur in diffraction theory.
Bessel and Related Functions
| AiryAi[z]andAiryBi[z] | Airy functions and  |
| AiryAiPrime[z]and AiryBiPrime[z] | derivatives of Airy functions and  |
| BesselJ[n,z]and BesselY[n,z] | Bessel functions and  |
| BesselI[n,z]and BesselK[n,z] | modified Bessel functions and  |
| KelvinBer[n,z]and KelvinBei[n,z] | Kelvin functions and  |
| KelvinKer[n,z]andKelvinKei[n,z] | Kelvin functions and  |
| HankelH1[n,z]andHankelH2[n,z] | Hankel functions and  |
| SphericalBesselJ[n,z]and SphericalBesselY[n,z] |
| spherical Bessel functions and  |
| SphericalHankelH1[n,z]andSphericalHankelH2[n,z] |
| spherical Hankel functions and  |
| StruveH[n,z]andStruveL[n,z] | Struve function and modified Struve function  |
Bessel and related functions.
The
Bessel functions BesselJ
and
BesselY
are linearly independent solutions to the differential equation

. For integer

, the

are regular at

, while the

have a logarithmic divergence at

.
Bessel functions arise in solving differential equations for systems with cylindrical symmetry.

is often called the
Bessel function of the first kind, or simply
the Bessel function.

is referred to as the
Bessel function of the second kind, the
Weber function, or the
Neumann function (denoted

).
The
Hankel functions (or
Bessel functions of the third kind)
HankelH1
and
HankelH2
give an alternative pair of solutions to the Bessel differential equation, related according to

.
The
spherical Bessel functions SphericalBesselJ
and
SphericalBesselY
, as well as the
spherical Hankel functions SphericalHankelH1
and
SphericalHankelH2
, arise in studying wave phenomena with spherical symmetry. These are related to the ordinary functions by

, where

and

can be

and

,

and

, or

and

. For integer

, spherical Bessel functions can be expanded in terms of elementary functions by using
FunctionExpand.
The
modified Bessel functions BesselI
and
BesselK
are solutions to the differential equation

. For integer

,

is regular at

;

always has a logarithmic divergence at

. The

are sometimes known as
hyperbolic Bessel functions.
Particularly in electrical engineering, one often defines the
Kelvin functions KelvinBer
,
KelvinBei
,
KelvinKer
and
KelvinKei
. These are related to the ordinary Bessel functions by

,

.
The
Airy functions AiryAi[z] and
AiryBi[z] are the two independent solutions

and

to the differential equation

.

tends to zero for large positive

, while

increases unboundedly. The Airy functions are related to modified Bessel functions with one-third-integer orders. The Airy functions often appear as the solutions to boundary value problems in electromagnetic theory and quantum mechanics. In many cases the
derivatives of the Airy functions AiryAiPrime[z] and
AiryBiPrime[z] also appear.
The
Struve function StruveH
appears in the solution of the inhomogeneous Bessel equation, which for integer

has the form

; the general solution to this equation consists of a linear combination of Bessel functions with the Struve function

added. The
modified Struve function StruveL
is given in terms of the ordinary Struve function by

. Struve functions appear particularly in electromagnetic theory.
Here is a plot of

. This is a curve that an idealized chain hanging from one end can form when you wiggle it.
| Out[16]= |  |
Mathematica generates explicit formulas for half-integer-order Bessel functions.
| Out[2]= |  |
The Airy function plotted here gives the quantum-mechanical amplitude for a particle in a potential that increases linearly from left to right. The amplitude is exponentially damped in the classically inaccessible region on the right.
| Out[17]= |  |
Zeros of Bessel and Airy functions.
| Out[18]= |  |
This gives its numerical value.
| Out[19]= |  |
Legendre and Related Functions
| LegendreP[n,z] | Legendre functions of the first kind  |
| LegendreP[n,m,z] | associated Legendre functions of the first kind  |
| LegendreQ[n,z] | Legendre functions of the second kind  |
| LegendreQ[n,m,z] | associated Legendre functions of the second kind  |
Legendre and related functions.
The
Legendre functions and
associated Legendre functions satisfy the differential equation

. The
Legendre functions of the first kind,
LegendreP
and
LegendreP
, reduce to Legendre polynomials when

and

are integers. The
Legendre functions of the second kind LegendreQ
and
LegendreQ
give the second linearly independent solution to the differential equation. For integer

they have logarithmic singularities at

. The

and

solve the differential equation with

.
Legendre functions arise in studies of quantum-mechanical scattering processes.
| LegendreP[n,m,z] or LegendreP[n,m,1,z] |
| type 1 function containing  |
| LegendreP[n,m,2,z] | type 2 function containing  |
| LegendreP[n,m,3,z] | type 3 function containing  |
Types of Legendre functions. Analogous types exist for LegendreQ.
Legendre functions of type 1 and
Legendre functions of type 2 have different symbolic forms, but the same numerical values. They have branch cuts from

to

and from

to

.
Legendre functions of type 3, sometimes denoted

and

, have a single branch cut from

to

.
Toroidal functions or
ring functions, which arise in studying systems with toroidal symmetry, can be expressed in terms of the Legendre functions

and

.
Conical functions can be expressed in terms of

and

.
When you use the function
LegendreP
with an integer

, you get a Legendre polynomial. If you take

to be an arbitrary complex number, you get, in general, a Legendre function.
In the same way, you can use the functions
GegenbauerC and so on with arbitrary complex indices to get
Gegenbauer functions,
Chebyshev functions,
Hermite functions,
Jacobi functions and
Laguerre functions. Unlike for associated Legendre functions, however, there is no need to distinguish different types in such cases.
Hypergeometric Functions and Generalizations
| Hypergeometric0F1[a,z] | hypergeometric function  |
| Hypergeometric0F1Regularized[a,z] | regularized hypergeometric function  |
| Hypergeometric1F1[a,b,z] | Kummer confluent hypergeometric function  |
| Hypergeometric1F1Regularized[a,b,z] | regularized confluent hypergeometric function  |
| HypergeometricU[a,b,z] | confluent hypergeometric function  |
| WhittakerM[k,m,z]andWhittakerW[k,m,z] |
| Whittaker functions and  |
ParabolicCylinderD[ ,z] | parabolic cylinder function
|
Confluent hypergeometric functions and related functions.
Many of the special functions that have been discussed so far can be viewed as special cases of the
confluent hypergeometric function Hypergeometric1F1
.
The confluent hypergeometric function can be obtained from the series expansion

. Some special results are obtained when

and

are both integers. If

, and either

or

, the series yields a polynomial with a finite number of terms.
If

is zero or a negative integer, then

itself is infinite. But the
regularized confluent hypergeometric function Hypergeometric1F1Regularized
given by

has a finite value in all cases.
Among the functions that can be obtained from

are the Bessel functions, error function, incomplete gamma function, and Hermite and Laguerre polynomials.
The function

is sometimes denoted

or

. It is often known as the
Kummer function.
The

function can be written in the integral representation

.
The

confluent hypergeometric function is a solution to Kummer's differential equation

, with the boundary conditions

and

.
The function
HypergeometricU
gives a second linearly independent solution to Kummer's equation. For

this function behaves like

for small

. It has a branch cut along the negative real axis in the complex

plane.
The function

has the integral representation

.

, like

, is sometimes known as the
Kummer function. The

function is sometimes denoted by

.
The
Whittaker functions WhittakerM
and
WhittakerW
give a pair of solutions to the normalized Kummer differential equation, known as Whittaker's differential equation. The Whittaker function

is related to

by

. The second Whittaker function

obeys the same relation, with

replaced by

.
The
parabolic cylinder functions ParabolicCylinderD
are related to the Hermite functions by

.
The
Coulomb wave functions are also special cases of the confluent hypergeometric function. Coulomb wave functions give solutions to the radial Schrödinger equation in the Coulomb potential of a point nucleus. The regular Coulomb wave function is given by

, where

.
Other special cases of the confluent hypergeometric function include the
Toronto functions 
,
Poisson-Charlier polynomials 
,
Cunningham functions 
, and
Bateman functions 
.
A limiting form of the confluent hypergeometric function that often appears is
Hypergeometric0F1
. This function is obtained as the limit

.
The

function has the series expansion

and satisfies the differential equation

.
Bessel functions of the first kind can be expressed in terms of the

function.
| Hypergeometric2F1[a,b,c,z] | hypergeometric function  |
| Hypergeometric2F1Regularized[a,b,c,z] |
| regularized hypergeometric function  |
| HypergeometricPFQ[{a1,...,ap},{b1,...,bq},z] |
| generalized hypergeometric function  |
| HypergeometricPFQRegularized[{a1,...,ap},{b1,...,bq},z] |
| regularized generalized hypergeometric function |
| MeijerG[{{a1,...,an},{an+1,...,ap}},{{b1,...,bm},{bm+1,...,bq}},z] |
| Meijer G function |
| AppellF1[a,b1,b2,c,x,y] | Appell hypergeometric function of two variables  |
Hypergeometric functions and generalizations.
The
hypergeometric function Hypergeometric2F1
has series expansion

. The function is a solution of the hypergeometric differential equation

.
The hypergeometric function can also be written as an integral:

.
The hypergeometric function is also sometimes denoted by

, and is known as the
Gauss series or the
Kummer series.
The Legendre functions, and the functions that give generalizations of other orthogonal polynomials, can be expressed in terms of the hypergeometric function. Complete elliptic integrals can also be expressed in terms of the

function.
The
Riemann P function, which gives solutions to Riemann's differential equation, is also a

function.
The
generalized hypergeometric function or
Barnes extended hypergeometric function HypergeometricPFQ
has series expansion

.
The
Meijer G function MeijerG
is defined by the contour integral representation

, where the contour of integration is set up to lie between the poles of

and the poles of

.
MeijerG is a very general function whose special cases cover most of the functions discussed in the past few sections.
The
Appell hypergeometric function of two variables AppellF1
has series expansion

. This function appears for example in integrating cubic polynomials to arbitrary powers.
The q-Series and Related Functions
| QPochhammer[z,q] | -Pochhammer symbol  |
| QPochhammer[z,q,n] | -Pochhammer symbol  |
| QFactorial[z,q] | -analog of factorial |
| QBinomial[n,m,q] | -analog of binomial coefficient |
| QGamma[z,q] | -analog of Euler gamma function  |
| QPolyGamma[z,q] | -digamma function |
| QPolyGamma[n,z,q] |  derivative of the -digamma function |
QHypergeometricPFQ[{a1, ,ap},{b1, ,bq},q,z] |
| basic hypergeometric series |
-series and related functions.
The

-Pochhammer symbol is a natural object in the calculus of

-differences, playing the same role as the power function in infinitesimal calculus or the falling factorial in the calculus of finite differences.
The finite

-Pochhammer symbol

is defined as the product

. The limit

defines the

-Pochhammer symbol

when

. The

-Pochhammer symbol

is the

-analog of the Pochhammer

symbol, which is recovered in the limit

.
The

-factorial

is defined as

and is a

-analog of the factorial function, which is recovered as

. The relationship

between the

-factorial and the

-gamma functions has the same functional form as the relationship

between the factorial and the Euler gamma function.
The

-digamma function is defined as the logarithmic derivative of the

-gamma function

. The

-polygamma function

of order

is defined as the


derivative with respect to

of the

-digamma function.
The basic hypergeometric series is a

-analog of the generalized hypergeometric series. It was introduced by Heine as a

-analog of Gauss hypergeometric series and arises in combinatorics.
The Product Log Function
The product log function.
The
product log function gives the solution for

in

. The function can be viewed as a generalization of a logarithm. It can be used to represent solutions to a variety of transcendental equations. The
tree generating function for counting distinct oriented trees is related to the product log by

.