This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Special Functions

Mathematica includes all the common special functions of mathematical physics found in standard handbooks. We will discuss each of the various classes of functions 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.
Click for copyable input
No exact result is known here.
Click for copyable input
A numerical result, to arbitrary precision, can nevertheless be found.
Click for copyable input
You can give complex arguments to special functions.
Click for copyable input
Special functions automatically get applied to each element in a list.
Click for copyable input
Mathematica knows analytical properties of special functions, such as derivatives.
Click for copyable input
You can use FindRoot to find roots of special functions.
Click for copyable input
Special functions in Mathematica can usually be evaluated for arbitrary complex values of their arguments. Often, however, the defining relations given below 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 xk. This sum converges only when x<1. Nevertheless, it is easy to show analytically that for any x, the complete function is equal to 1/ (1-x). Using this form, you can easily find a value of the function for any x, at least so long as x≠1.

Gamma and Related Functions

Beta[a,b]Euler beta function (a, b)
Beta[z,a,b]incomplete beta function z (a, b)
BetaRegularized[z,a,b]regularized incomplete beta function I (z, a, b)
Gamma[z]Euler gamma function (z)
Gamma[a,z]incomplete gamma function (a, z)
Gamma[a,z0,z1]generalized incomplete gamma function (a, z0)- (a, z1)
GammaRegularized[a,z]regularized incomplete gamma function Q (a, z)
inverse beta function
InverseGammaRegularized[a,s]inverse gamma function
Pochhammer[a,n]Pochhammer symbol (a)n
PolyGamma[z]digamma function (z)
PolyGamma[n,z]nth derivative of the digamma function (n) (z)

Gamma and related functions.

The Euler gamma function Gamma[z] is defined by the integral . For positive integer n, (n)= (n-1)! . (z) can be viewed as a generalization of the factorial function, valid for complex arguments z.
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[a, b] is .
The Pochhammer symbol or rising factorial Pochhammer[a, n] is (a)n=a (a+1)... (a+n-1)= (a+n)/ (a). It often appears in series expansions for hypergeometric functions. Note that the Pochhammer symbol has a definite value even when the gamma functions which appear in its definition are infinite.
The incomplete gamma function Gamma[a, z] is defined by the integral . Mathematica includes a generalized incomplete gamma function Gamma[a, z0, z1] defined as .
The alternative incomplete gamma function (a, z) can therefore be obtained in Mathematica as Gamma[a, 0, z].
The incomplete beta function Beta[z, a, b] is given by . Notice that in the incomplete beta function, the parameter z is an upper limit of integration, and appears as the first argument of the function. In the incomplete gamma function, on the other hand, z 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[z, a, b] defined for most arguments by I (z, a, b)= (z, a, b)/ (a, b), but taking into account singular cases. Mathematica also includes the regularized incomplete gamma function GammaRegularized[a, z] defined by Q (a, z)= (a, z)/ (a), with singular cases taken into account.
The incomplete beta and gamma functions, and their inverses, are common in statistics. The inverse beta function InverseBetaRegularized[s, a, b] is the solution for z in s=I (z, a, b). The inverse gamma function InverseGammaRegularized[a, s] is similarly the solution for z in s=Q (a, z).
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 (z)= (z)/ (z). For integer arguments, the digamma function satisfies the relation (n)=-+Hn-1, where is Euler's constant (EulerGamma in Mathematica) and Hn are the harmonic numbers.
The polygamma functions PolyGamma[n, z] are given by (n) (z)=dn (z)/dzn. Notice that the digamma function corresponds to (0) (z). The general form (n) (z) is the (n+1)th, not the nth, logarithmic derivative of the gamma function. The polygamma functions satisfy the relation (n) (z)= (-1)n+1n!1/ (z+k)n+1. PolyGamma[, z] is defined for arbitrary complex by fractional calculus analytic continuation.
Many exact results for gamma and polygamma functions are built into Mathematica.
Click for copyable input
Here is a contour plot of the gamma function in the complex plane.
Click for copyable input

Zeta and Related Functions

LerchPhi[z,s,a]Lerch's transcendent (z, s, a)
PolyLog[n,z]polylogarithm function Lin (z)
PolyLog[n,p,z]Nielsen generalized polylogarithm function Sn, p (z)
RamanujanTau[n]Ramanujan function (n)
RamanujanTauL[n]Ramanujan Dirichlet L-function L (s)
RamanujanTauTheta[n]Ramanujan theta function (t)
RamanujanTauZ[n]Ramanujan Z function Z (t)
RiemannSiegelTheta[t]Riemann-Siegel function (t)
RiemannSiegelZ[t]Riemann-Siegel function Z (t)
StieltjesGamma[n]Stieltjes constants n
Zeta[s]Riemann zeta function (s)
Zeta[s,a]generalized Riemann zeta function (s, a)

Zeta and related functions.

The Riemann zeta function Zeta[s] is defined by the relation (s)=k-s (for s>1). 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 (s) for arbitrary complex s≠1. 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 t real). Note that the Riemann-Siegel functions are both real as long as t is real.
The Stieltjes constants StieltjesGamma[n] are generalizations of Euler's constant which appear in the series expansion of (s) around its pole at s=1; the coefficient of (1-s)n is n/n!. Euler's constant is 0.
The generalized Riemann zeta function or Hurwitz zeta function Zeta[s, a] is implemented as (s, a)= ( (k+a)2)-s/2, where any term with k+a=0 is excluded.
The Ramanujan Dirichlet L function RamanujanTauL[s] is defined by (for Re (s)>6), with coefficients RamanujanTau[n]. In analogy with the Riemann zeta function, it is again convenient to define the functions RamanujanTauZ[t] and RamanujanTauTheta[t].
Mathematica gives exact results for (2n).
Click for copyable input
Here is a three-dimensional picture of the Riemann zeta function in the complex plane.
Click for copyable input
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.
Click for copyable input
This is a plot of the absolute value of the Ramanujan L function on its critical line Re z=6.
Click for copyable input
The polylogarithm functions PolyLog[n, z] are given by Lin (z)=zk/kn. The polylogarithm function is sometimes known as Jonquière's function. The dilogarithm PolyLog[2, z] satisfies . Sometimes Li2 (1-z) is known as Spence's integral. The Nielsen generalized polylogarithm functions or hyperlogarithms PolyLog[n, p, z] 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[z, s, a] is a generalization of the zeta and polylogarithm functions, given by (z, s, a)=zk/ ( (a+k)s/2)2, where any term with a+k=0 is excluded. Many sums of reciprocal powers can be expressed in terms of the Lerch transcendent. For example, the Catalan beta function (s)= (-1)k (2k+1)-s 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 which appear in number theory. The basic L-series has the form L (s, )= (k)k-s, where the "character" (k) is an integer function with period m. L-series of this kind can be written as sums of Lerch functions with z a power of e2i/m.
LerchPhi[z, s, a, DoublyInfinite->True] gives the doubly infinite sum zk/ ( (a+k)s/2)2.
ZetaZero[k]the kth zero of the zeta function (z) on the critical line
ZetaZero[k,x0]the kth zero above height x0

Zeros of the zeta function.

ZetaZero[1] represents the first nontrivial zero of (z).
Click for copyable input
This gives its numerical value.
Click for copyable input
This gives the first zero with height greater than 15.
Click for copyable input

Exponential Integral and Related Functions

CosIntegral[z]cosine integral function Ci (z)
CoshIntegral[z]hyperbolic cosine integral function Chi (z)
ExpIntegralE[n,z]exponential integral En (z)
ExpIntegralEi[z]exponential integral Ei (z)
LogIntegral[z]logarithmic integral li (z)
SinIntegral[z]sine integral function Si (z)
SinhIntegral[z]hyperbolic sine integral function Shi (z)

Exponential integral and related functions.

Mathematica has two forms of exponential integral: ExpIntegralE and ExpIntegralEi.
The exponential integral function ExpIntegralE[n, z] is defined by .
The second exponential integral function ExpIntegralEi[z] is defined by (for z>0), where the principal value of the integral is taken.
The logarithmic integral function LogIntegral[z] is given by (for z>1), where the principal value of the integral is taken. li (z) is central to the study of the distribution of primes in number theory. The logarithmic integral function is sometimes also denoted by Li (z). In some number theoretic applications, li (z) is defined as , with no principal value taken. This differs from the definition used in Mathematica by the constant li (2).
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 (z)
Erf[z0,z1]generalized error function erf (z1)-erf (z0)
Erfc[z]complementary error function erfc (z)
Erfi[z]imaginary error function erfi (z)
FresnelC[z]Fresnel integral C (z)
FresnelS[z]Fresnel integral S (z)
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 erfc (z)=1-erf (z). The imaginary error function Erfi[z] is given by erfi (z)=erf (iz)/i. The generalized error function Erf[z0, z1] 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 z in the equation s=erf (z). 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] and AiryBi[z]Airy functions Ai (z) and Bi (z)
AiryAiPrime[z] and AiryBiPrime[z]
derivatives of Airy functions Ai (z) and Bi (z)
BesselJ[n,z] and BesselY[n,z]
Bessel functions Jn (z) and Yn (z)
BesselI[n,z] and BesselK[n,z]
modified Bessel functions In (z) and Kn (z)
KelvinBer[n,z] and KelvinBei[n,z]
Kelvin functions bern (z) and bein (z)
KelvinKer[n,z] and KelvinKei[n,z]
Kelvin functions kern (z) and kein (z)
HankelH1[n,z] and HankelH2[n,z]
Hankel functions and
SphericalBesselJ[n,z] and SphericalBesselY[n,z]
spherical Bessel functions jn (z) and yn (z)
SphericalHankelH1[n,z] and SphericalHankelH2[n,z]
spherical Hankel functions and
StruveH[n,z] and StruveL[n,z]
Struve function Hn (z) and modified Struve function Ln (z)

Bessel and related functions.

The Bessel functions BesselJ[n, z] and BesselY[n, z] are linearly independent solutions to the differential equation z2y+zy+ (z2-n2)y=0. For integer n, the Jn (z) are regular at z=0, while the Yn (z) have a logarithmic divergence at z=0.
Bessel functions arise in solving differential equations for systems with cylindrical symmetry.
Jn (z) is often called the Bessel function of the first kind, or simply the Bessel function. Yn (z) is referred to as the Bessel function of the second kind, the Weber function, or the Neumann function (denoted Nn (z)).
The Hankel functions (or Bessel functions of the third kind) HankelH1[n, z] and HankelH2[n, z] give an alternative pair of solutions to the Bessel differential equation, related according to .
The spherical Bessel functions SphericalBesselJ[n, z] and SphericalBesselY[n, z], as well as the spherical Hankel functions SphericalHankelH1[n, z] and SphericalHankelH2[n, z], arise in studying wave phenomena with spherical symmetry. These are related to the ordinary functions by , where f and F can be j and J, y and Y, or hi and Hi. For integer n, spherical Bessel functions can be expanded in terms of elementary functions by using FunctionExpand.
The modified Bessel functions BesselI[n, z] and BesselK[n, z] are solutions to the differential equation z2y+zy- (z2+n2)y=0. For integer n, In (z) is regular at z=0; Kn (z) always has a logarithmic divergence at z=0. The In (z) are sometimes known as hyperbolic Bessel functions.
Particularly in electrical engineering, one often defines the Kelvin functions KelvinBer[n, z], KelvinBei[n, z], KelvinKer[n, z] and KelvinKei[n, z]. These are related to the ordinary Bessel functions by bern (z)+i bein (z)=eniJn (ze-i/4), kern (z)+i kein (z)=e-ni/2Kn (zei/4).
The Airy functions AiryAi[z] and AiryBi[z] are the two independent solutions Ai (z) and Bi (z) to the differential equation y-zy=0. Ai (z) tends to zero for large positive z, while Bi (z) 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[n, z] appears in the solution of the inhomogeneous Bessel equation which for integer n has the form ; the general solution to this equation consists of a linear combination of Bessel functions with the Struve function Hn (z) added. The modified Struve function StruveL[n, z] is given in terms of the ordinary Struve function by Ln (z)=-ie-in/2Hn (z). 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.
Click for copyable input
Mathematica generates explicit formulas for half-integer-order Bessel functions.
Click for copyable input
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.
Click for copyable input
BesselJZero[n,k]the kth zero of the Bessel function Jn (z)
BesselJZero[n,k,x0]the kth zero greater than x0
BesselYZero[n,k]the kth zero of the Bessel function Yn (z)
BesselYZero[n,k,x0]the kth zero greater than x0
AiryAiZero[k]the kth zero of the Airy function Ai (z)
AiryAiZero[k,x0]the kth zero less than x0
AiryBiZero[k]the kth zero of the Airy function Bi (z)
AiryBiZero[k,x0]the kth zero less than x0

Zeros of Bessel and Airy functions.

BesselJZero[1, 5] represents the fifth zero of J1 (z).
Click for copyable input
This gives its numerical value.
Click for copyable input

Legendre and Related Functions

LegendreP[n,z]Legendre functions of the first kind Pn (z)
LegendreP[n,m,z]associated Legendre functions of the first kind
LegendreQ[n,z]Legendre functions of the second kind Qn (z)
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 (1-z2)y-2zy+[n (n+1)-m2/ (1-z2)]y=0. The Legendre functions of the first kind, LegendreP[n, z] and LegendreP[n, m, z], reduce to Legendre polynomials when n and m are integers. The Legendre functions of the second kind LegendreQ[n, z] and LegendreQ[n, m, z] give the second linearly independent solution to the differential equation. For integer m they have logarithmic singularities at z=±1. The Pn (z) and Qn (z) solve the differential equation with m=0.
Legendre functions arise in studies of quantum-mechanical scattering processes.
LegendreP[n,m,z] or LegendreP[n,m,1,z]
type 1 function containing (1-z2)m/2
LegendreP[n,m,2,z]type 2 function containing (1+z)m/2/ (1-z)m/2
LegendreP[n,m,3,z]type 3 function containing (1+z)m/2/ (-1+z)m/2

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 -1 and from +1 to +. Legendre functions of type 3, sometimes denoted and , have a single branch cut from - to +1.
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[n, x] with an integer n, you get a Legendre polynomial. If you take n 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 0F1 (;a;z)
regularized hypergeometric function 0F1 (;a;z)/ (a)
Hypergeometric1F1[a,b,z]Kummer confluent hypergeometric function 1F1 (a;b;z)
regularized confluent hypergeometric function 1F1 (a;b;z)/ (b)
HypergeometricU[a,b,z]confluent hypergeometric function U (a, b, z)
WhittakerM[k,m,z] and WhittakerW[k,m,z]
Whittaker functions Mk, m (z) and Wk, m (z)
ParabolicCylinderD[,z]parabolic cylinder function D (z)

Confluent hypergeometric functions and related functions.

Many of the special functions that we have discussed so far can be viewed as special cases of the confluent hypergeometric function Hypergeometric1F1[a, b, z].
The confluent hypergeometric function can be obtained from the series expansion 1F1 (a;b;z)=1+az/b+a (a+1)/b (b+1) z2/2!+= (a)k/ (b)k zk/k! . Some special results are obtained when a and b are both integers. If a<0, and either b>0 or b<a, the series yields a polynomial with a finite number of terms.
If b is zero or a negative integer, then 1F1 (a;b;z) itself is infinite. But the regularized confluent hypergeometric function Hypergeometric1F1Regularized[a, b, z] given by 1F1 (a;b;z)/ (b) has a finite value in all cases.
Among the functions that can be obtained from 1F1 are the Bessel functions, error function, incomplete gamma function, and Hermite and Laguerre polynomials.
The function 1F1 (a;b;z) is sometimes denoted (a;b;z) or M (a, b, z). It is often known as the Kummer function.
The 1F1 function can be written in the integral representation (1-t)b-a-1 dt.
The 1F1 confluent hypergeometric function is a solution to Kummer's differential equation zy+ (b-z)y-ay=0, with the boundary conditions 1F1 (a;b;0)=1 and [1F1 (a;b;z)]/zz=0=a/b.
The function HypergeometricU[a, b, z] gives a second linearly independent solution to Kummer's equation. For Re b>1 this function behaves like z1-b for small z. It has a branch cut along the negative real axis in the complex z plane.
The function U (a, b, z) has the integral representation .
U (a, b, z), like 1F1 (a;b;z), is sometimes known as the Kummer function. The U function is sometimes denoted by .
The Whittaker functions WhittakerM[k, m, z] and WhittakerW[k, m, z] give a pair of solutions to the normalized Kummer differential equation, known as Whittaker's differential equation. The Whittaker function M, is related to 1F1 by . The second Whittaker function W, obeys the same relation, with 1F1 replaced by U.
The parabolic cylinder functions ParabolicCylinderD[, z] are related to the Hermite functions by D (z)=2-/2e- (z/2)2 .
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 FL (, )=CL ()L+1e-i1F1 (L+1-i;2L+2;2i), where CL ()=2Le-/2 (L+1+i)/ (2L+2).
Other special cases of the confluent hypergeometric function include the Toronto functions T (m, n, r), Poisson-Charlier polynomials n (, x), Cunningham functions n, m (x) and Bateman functions k (x).
A limiting form of the confluent hypergeometric function which often appears is Hypergeometric0F1[a, z]. This function is obtained as the limit .
The 0F1 function has the series expansion 0F1 (;a;z)=1/ (a)k zk/k! and satisfies the differential equation zy+ay-y=0.
Bessel functions of the first kind can be expressed in terms of the 0F1 function.
Hypergeometric2F1[a,b,c,z]hypergeometric function 2F1 (a, b;c;z)
regularized hypergeometric function 2F1 (a, b;c;z)/ (c)
generalized hypergeometric function pFq (a;b;z)
regularized generalized hypergeometric function
Meijer G function
AppellF1[a,b1,b2,c,x,y]Appell hypergeometric function of two variables F1 (a;b1, b2;c;x, y)

Hypergeometric functions and generalizations.

The hypergeometric function Hypergeometric2F1[a, b, c, z] has series expansion 2F1 (a, b;c;z)= (a)k (b)k/ (c)k zk/k! . The function is a solution of the hypergeometric differential equation z (1-z)y+[c- (a+b+1)z]y-aby=0.
The hypergeometric function can also be written as an integral: 2F1 (a, b;c;z)= (c)/[ (b) (c-b)] .
The hypergeometric function is also sometimes denoted by F, and is known as the Gauss series or the Kummer series.
The Legendre functions, and the functions which 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 2F1 function.
The Riemann P function, which gives solutions to Riemann's differential equation, is also a 2F1 function.
The generalized hypergeometric function or Barnes extended hypergeometric function HypergeometricPFQ[{a1, ..., ap}, {b1, ..., bq}, z] has series expansion .
The Meijer G function MeijerG[{{a1, ..., an}, {an+1, ..., ap}}, {{b1, ..., bm}, {bm+1, ..., bq}}, z] is defined by the contour integral representation (b1+s)... (bm+s)/ ( (an+1+s)... (ap+s) (1-bm+1-s)... (1-bq-s)) z-sds, where the contour of integration is set up to lie between the poles of (1-ai-s) and the poles of (bi+s). 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[a, b1, b2, c, x, y] has series expansion F1 (a;b1, b2;c;x, y)= (a)m+n (b1)m (b2)n/ (m!n! (c)m+n)xmyn. This function appears for example in integrating cubic polynomials to arbitrary powers.

The Product Log Function

ProductLog[z]product log function W (z)

The product log function.

The product log function gives the solution for w in z=wew. 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 T (z)=-W (-z).