# 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.

In[1]:= |

Out[1]= |

In[2]:= |

Out[2]= |

In[3]:= |

Out[3]= |

In[4]:= |

Out[4]= |

In[5]:= |

Out[5]= |

In[6]:= |

Out[6]= |

In[7]:= |

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,z_{0},z_{1}] | 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 |

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[a, b] is .

The *Pochhammer symbol* or *rising factorial* Pochhammer[a, n] 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[a, z] is defined by the integral . *Mathematica* includes a generalized incomplete gamma function Gamma[a, z_{0}, z_{1}] defined as .

The alternative incomplete gamma function 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 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[z, a, b] defined for most arguments by , but taking into account singular cases. *Mathematica* also includes the *regularized incomplete gamma function* GammaRegularized[a, z] 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[s, a, b] is the solution for in . The *inverse gamma function* InverseGammaRegularized[a, s] 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[n, z] 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[, z] 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.

In[4]:= |

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 |

The Dirichlet-*L* function DirichletL[k, j, s] 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[s, a] is implemented as , where any term with is excluded.

The Hurwitz zeta function HurwitzZeta[s, a] 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].

The *polylogarithm functions* PolyLog[n, z] are given by . The polylogarithm function is sometimes known as *Jonquière's function*. The *dilogarithm* PolyLog[2, z] satisfies . Sometimes 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 , 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[z, s, a] generalizes HurwitzZeta[s, a] and is defined by .

ZetaZero[k] | the zero of the zeta function on the critical line |

ZetaZero[k,x_{0}] | the zero above height |

## Exponential Integral and Related Functions

CosIntegral[z] | cosine integral function |

CoshIntegral[z] | hyperbolic cosine integral function |

ExpIntegralE[n,z] | exponential integral |

ExpIntegralEi[z] | exponential integral |

LogIntegral[z] | logarithmic integral |

SinIntegral[z] | sine integral function |

SinhIntegral[z] | hyperbolic sine integral function |

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 ), 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[z_{0},z_{1}] | 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[z_{0}, z_{1}] 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]andAiryBiPrime[z] | derivatives of Airy functions and |

BesselJ[n,z]andBesselY[n,z] | Bessel functions and |

BesselI[n,z]andBesselK[n,z] | modified Bessel functions and |

KelvinBer[n,z]andKelvinBei[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]andSphericalBesselY[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 |

The *Bessel functions* BesselJ[n, z] and BesselY[n, z] 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[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 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[n, z] and BesselK[n, z] 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[n, z], KelvinBei[n, z], KelvinKer[n, z] and KelvinKei[n, z]. 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[n, z] 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[n, z] is given in terms of the ordinary Struve function by . Struve functions appear particularly in electromagnetic theory.

In[16]:= |

Out[16]= |

In[2]:= |

Out[2]= |

In[17]:= |

Out[17]= |

BesselJZero[n,k] | the zero of the Bessel function |

BesselJZero[n,k,x_{0}] | the zero greater than |

BesselYZero[n,k] | the zero of the Bessel function |

BesselYZero[n,k,x_{0}] | the zero greater than |

AiryAiZero[k] | the zero of the Airy function |

AiryAiZero[k,x_{0}] | the zero less than |

AiryBiZero[k] | the zero of the Airy function |

AiryBiZero[k,x_{0}] | the zero less than |

Zeros of Bessel and Airy functions.

In[18]:= |

Out[18]= |

In[19]:= |

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[n, z] and LegendreP[n, m, z], reduce to Legendre polynomials when and 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 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[n, x] 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[a, b, z].

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[a, b, z] 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[a, b, z] 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[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 is related to by . The second Whittaker function obeys the same relation, with replaced by .

The *parabolic cylinder functions* ParabolicCylinderD[, z] 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[a, z]. 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[{a_{1},...,a_{p}},{b_{1},...,b_{q}},z] | |

generalized hypergeometric function | |

HypergeometricPFQRegularized[{a_{1},...,a_{p}},{b_{1},...,b_{q}},z] | |

regularized generalized hypergeometric function | |

MeijerG[{{a_{1},...,a_{n}},{a_{n+1},...,a_{p}}},{{b_{1},...,b_{m}},{b_{m+1},...,b_{q}}},z] | |

Meijer G function | |

AppellF1[a,b_{1},b_{2},c,x,y] | Appell hypergeometric function of two variables |

Hypergeometric functions and generalizations.

The *hypergeometric function* Hypergeometric2F1[a, b, c, z] 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[{a_{1}, ..., a_{p}}, {b_{1}, ..., b_{q}}, z] has series expansion .

The *Meijer G function* MeijerG[{{a_{1}, ..., a_{n}}, {a_{n}+1, ..., a_{p}}}, {{b_{1}, ..., b_{m}}, {b_{m}+1, ..., b_{q}}}, z] 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[a, b_{1}, b_{2}, c, x, y] 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[{a_{1},,a_{p}},{b_{1},,b_{q}},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

ProductLog[z] | 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 .