This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / The Mathematica Book / Advanced Mathematics / Mathematical Functions  /

3.2.10 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.
  • In[1]:= Gamma[15/2]

    Out[1]=

  • No exact result is known here.
  • In[2]:= Gamma[15/7]

    Out[2]=

  • A numerical result, to arbitrary precision, can nevertheless be found.
  • In[3]:= N[%, 40]

    Out[3]=

  • You can give complex arguments to special functions.
  • In[4]:= Gamma[3 + 4I] //N

    Out[4]=

  • Special functions automatically get applied to each element in a list.
  • In[5]:= Gamma[{3/2, 5/2, 7/2}]

    Out[5]=

  • Mathematica knows analytical properties of special functions, such as derivatives.
  • In[6]:= D[Gamma[x], {x, 2}]

    Out[6]=

  • You can use FindRoot to find roots of special functions.
  • In[7]:= FindRoot[ BesselJ[0, x], {x, 1} ]

    Out[7]=



















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


    Gamma and related functions.



























































































    The Euler gamma functionGamma[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 functionBeta[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 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,


    ,


    ] defined as . The alternative incomplete gamma function can therefore be obtained in Mathematica as Gamma[


    a,0,z].
    The incomplete beta functionBeta[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 , 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).
    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


    .

  • Many exact results for gamma and polygamma functions are built into Mathematica.
  • In[8]:= PolyGamma[6]

    Out[8]=

  • Here is a contour plot of the gamma function in the complex plane.
  • In[9]:= ContourPlot[ Abs[Gamma[x + I y]], {x, -3, 3},
    {y, -2, 2}, PlotPoints->40 ]


    Zeta and Related Functions


    Zeta and related functions.




















































    The Riemann zeta functionZeta[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-theoretical 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 analytic Riemann-Siegel functions


    RiemannSiegelZ[t] and RiemannSiegelTheta[z] 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 which appear in the series expansion of around its pole at ; the coefficient of is . Euler's constant is .
    The generalized Riemann zeta function or Hurwitz zeta function


    Zeta[s,a] is given by , where any term with


    is excluded.




  • Mathematica gives exact results for


    .
  • In[10]:= Zeta[6]

    Out[10]=

  • Here is a three-dimensional picture of the Riemann zeta function in the complex plane.
  • In[11]:= Plot3D[ Abs[ Zeta[x + I y] ], {x, -3, 3},
    {y, 2, 35}, PlotPoints->30 ]





  • 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.
  • In[12]:= Plot[ Abs[ Zeta[ 1/2 + I y ] ], {y, 0, 40} ]


















































    The polylogarithm functionsPolyLog[n,z] are given by . The dilogarithm


    PolyLog[2,z] satisfies . is sometimes known as Spence's integral. Polylogarithms crop up in Feynman diagram integrals in elementary particle physics. The polylogarithm function is sometimes known as Jonquière's function.
    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 which appear in number theory. The basic -series has the form , where the "character" is an integer function with period . -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


    .

    Exponential Integral and Related Functions


    Exponential integral and related functions.











































    Mathematica has two forms of exponential integral: ExpIntegralE and ExpIntegralEi.
    The exponential integral functionExpIntegralE[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-theoretical 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


    Error function and related functions.































    The error functionErf[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 Functions


    Bessel functions.










































































































    The Bessel functionsBesselJ[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) give an alternative pair of solutions to the Bessel differential equation.
    In studying systems with spherical symmetry, spherical Bessel functions arise, defined by , where and can be and , and , or and . For integer , Mathematica gives exact algebraic formulas for spherical Bessel functions.
    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, according to , .
    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.




  • Here is a plot of


    . This is a curve that an idealized chain hanging from one end can form when you wiggle it.
  • In[13]:= Plot[ BesselJ[0, Sqrt[x]], {x, 0, 50} ]


  • Mathematica generates explicit formulas for half-integer-order Bessel functions.
  • In[14]:= BesselK[3/2, x]

    Out[14]=

  • 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.
  • In[15]:= Plot[ AiryAi[x], {x, -10, 10} ]


    Legendre and Related Functions


    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.


    Types of Legendre functions. Analogous types exist for LegendreQ.














































    Legendre functions of type 1 are defined only when lies inside the unit circle in the complex plane. Legendre functions of type 2 have the same numerical values as type 1 inside the unit circle, but are also defined outside. The type 2 functions 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.

    Confluent Hypergeometric Functions


    Confluent hypergeometric functions.























































































































































    Many of the special functions that we have discussed so far can be viewed as special cases of the confluent hypergeometric functionHypergeometric1F1[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 give an alternative pair of solutions to Kummer'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 are related to Whittaker functions by


    . For integer , the parabolic cylinder functions reduce to Hermite polynomials.
    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 which 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.

    Hypergeometric Functions and Generalizations


    Hypergeometric functions and generalizations.

























































































































    The hypergeometric functionHypergeometric2F1[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 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 function.
    The Riemann P function, which gives solutions to Riemann's differential equation, is also a function.
    The generalized hypergeometric function


    HypergeometricPFQ[





    , ... ,





    ,





    , ... ,





    ,z] has series expansion .
    The Meijer G function


    MeijerG[








    ,...,





    ,





    ,...,








    ,








    ,...,





    ,





    ,...,








    ,z] isdefined 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 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.