Definite Integration in 
Mathematica V3.0

Victor Adamchik

Introduction

The aim of this paper is to provide a short description of definite integration algorithms implemented in Mathematica Version 3.0.

$Version

Proper Integrals

All proper integrals in Mathematica are evaluated by means of the Newton-Leibniz theorem

\(TraditionalForm
    \`∫\_a\%b\( f(x)\) dx = F(b) - F(a)\)

where F(x) is an antiderivative. It is well-known that the Newton-Leibniz formula in the given form does not hold any longer if the antiderivative F(x) has singularities on an interval of integration (a, b). Let us consider the following integral

\(TraditionalForm
    \`∫\_0\%4
        \(\( x\^2 + 2\ x + 4\)\/\(x\^4 - 7\ x\^2 + 2\ x + 17\)\) 
        dx\)

where the integrand is a smooth integrable function on an interval (0,  4).

Plot[((4 + 2 x + (x^2))/(17 + 2 x - 7 (x^2) + (x^4))), {x, 0, 4}]

As it follows from the Risch structure theorem the correspondent indefinite integral is doable in elementary functions

int = ∫(((x^2) + 2 x + 4)/((x^4) + 2 x - 7 (x^2) + 
                17)) \[DifferentialD]x

If we simply substitute limits of integration into the antiderivative we get an incorrect result.

Limit[int, x -> 4] - Limit[int, x -> 0]

This is because the antiderivative is not a continuous function on an interval (0, 4). It has a jump at x = 2,  which is easy to see in the following graphic.

Plot[int,  {x,  0,  4}]

The right way of applying the Newton-Leibniz theorem is to take into account an influence of the jump

Limit[int,  x -> 4,  Direction  ->     1]  - 
      Limit[int,  x -> 2,  Direction  ->  -1]  +  
      Limit[int,  x -> 2,  Direction  ->     1]  -  
      Limit[int,  x -> 0,  Direction  ->  -1]

Mathematica evaluates definite integrals in precisely that way.

(∫_0^4)
        (( (x^2) + 2 x + 4)/((x^4) - 7 (x^2) + 2 x + 17)) 
        \[DifferentialD]x

The origin of discontinuities of antiderivatives along the path of integration is not in the method of indefinite integration but rather in the integrand. In the discussed example, the integrand has four singular poles that become branch points for the antiderivative.

NRoots[(x^4) - 7 (x^2) + 2 x + 17 == 0, x]

Connected in pairs these points make two branch cuts. And the path of integration crosses one of them. The following ContourPlot clearly exposes the problem.

ContourPlot[
      Evaluate[Re[int /. x -> x + I y]],  {x,  -3,  
        4},  {y,  -3,  4},  ContourShading -> False,  
      Contours  ->  20,  PlotPoints -> 40,  
      Epilog  -> {Hue[0], Thickness[0.005], 
          Line[{{0, 0}, {4, 0}}]}]

We see that in a complex plane of the variable x the antiderivative has two branch cuts (bold black vertical lines) and the path of integration, the line (0,4), intersects the right branch cut.  Obviously, by varying the constant of integration  we can change the form of the antiderivative so that we would get various forms of branch cuts. Here we understand the constant of integration as a function f(x) such that ((df(x))/dx) is zero. As a simple example let us consider the step-wise constant function ((Sqrt[(x^2)])/x)

Simplify[(∂_x)((Sqrt[ (x^2)])/x)]

Thinking hard, we can built an antiderivative that does not have a branch cut crossing a given interval of integration. However, we can never get rid of branch cuts!

Analysis of the singularities of antiderivatives is a time consuming and sometimes heuristic process, especially if trigonometric or special functions are involved in antiderivatives.  In the latter case Integrate may not be able to detect all singular points on the interval of integration, which will result in a warning message

You should pay attention to the message since it warns you that the result of the integration might be wrong.

Improper Integrals

It is quite clear that the above procedure cannot cover the whole variety of definite integrals. There are two reasons behind that. First, the correspondent indefinite integral cannot be expressed in finite terms of functions represented in Mathematica. For instance,

∫Cos[Sin[x]] \[DifferentialD]x

However, the definite integral with the specific limits of integration is doable.

(∫_0^π) Cos[Sin[x]] \[DifferentialD]x

Second, even if an indefinite integral can be done, it requires a great deal of effort to find limits at the end points. Here is an example,

(∫_0^((π/2)))Tan[x]^(1/π) 
        \[DifferentialD]x

This is an improper integral since the top limit is a singular point of the integrand. The   result of  indefinite integration is

∫Tan[x]^(1/π) \[DifferentialD]x

To find the limit at x = (π/2) one has to, first, develop the asymptotic expansion of the hypergeometric Gauss function at ∞, and second, construct the asymptotic scale for the Puiseux series. Currently, Mathematica's Series structure is based on  power series that allow only rational exponents.

Following we present a short description of the algorithm for evaluating improper integrals. The overall idea has been given in [1] and  [3]. Some practical details regarding "logarithmic" cases are described in [2] and [4].

The General Idea

By means of the Mellin integral transform and Parseval's equality, a given improper integral is transformed to a contour integral over the straight line         \(TraditionalForm\`\((γ - i∞, \ γ + i∞)\)\) in a complex plane of the parameter z:

\(TraditionalForm
    \`∫\_0\%∞\(\( f\_1\)(x)\)\ \(\(f\_2\)(z\/x)\) 
          dx\/x = 
      \(1\/\(2\ π\ i\)\) 
        \(∫\+\(γ - i∞\)\%\(γ + 
              i∞\)\(\(f\_1\^*\)(s)\)\ 
            \(\(f\_2\^*\)(s)\)\ \(z\^\(-s\)\) ds\)\)

where \(TraditionalForm\`\(\(f\_1\%*\)(x)\)\ and\ \(\(f\_2\%*\)(x)\)\) are Mellin transforms of (Subscript[f, 1])(x)  and (Subscript[f, 2])(x)

\(TraditionalForm
    \`\(f\^*\)(s) = 
      ∫\_0\%∞\(\( f(x)\)\ x\^\(s - 1\)\) 
          dx\)

The real parameter γ in the formula (1) is defined by conditions of existence of Mellin transforms \(TraditionalForm\`\(\(f\_1\%*\)(x)\)\ and\ \(\(f\_2\%*\)(x)\)\). Finally, the residue theorem is used to evaluate the contour integral in the right side of the formula (1)

\(\(1\/\(2\ π\ i\)\) \(∮\+Γ\( f(z)\) dz\)\) = (∑_(k = 1)^m) (Underscript[res, z  =  (Subscript[a, k])]) f(z)

where Γ is a closed contour, and (Subscript[a, k]) are poles of f(z) that lie in a domain bounded by Γ. The success of this scheme depends on two factors: first, the Mellin image of an integrand  (Subscript[f, 1])(x) (Subscript[f, 2])((z/x)) must exist, and, second, it should be represented in terms of Gamma functions. If these conditions are satisfied then the contour integral in (1), called the Mellin-Barnes integral or the Meijer G-function, can almost always be expressed in finite terms of hypergeometric functions. This fact is known as Slater's theorem (see [1] and  [5]). We said "almost always", since there is a special case of the G-function when the latter cannot be reduced to hypergeometric functions but to their derivatives with respect to parameters. By analogy with linear differential equations with polynomial coefficients, such a singular case of the G-function is named a logarithmic case. The modified Bessel function (Subscript[K, 0])(z) is such a classical example, since its series representation

(Subscript[K, 0])(z)=-(Subscript[I, 0])(z) log((z/2))+(∑_(k = 0)^∞)((ψ(k + 1))/(((k!)^2))) (((((z^2)/4)))^k)

cannot be expressed via hypergeometrics.

Mellin-Barnes Integrals

These integrals are defined by (see[6])

\(TraditionalForm
    \`\(1\/\(2\ π\ i\)\) 
      \(∮\+ℒ\ 
        \(g(s)\) \(z\^\(-s\)\) ds\)\)

where

g (s)=(((∏_(j = 1)^n) 
                Γ ((Subscript[a, j]) + s) 
                  (∏_(j = 1)^m) 
                    Γ ((Subscript[b, j]) - s))/((∏_(j = 1
                    )^k)Γ((Subscript[c, j]) + s) 
                  (∏_(j = 1)^l) 
                    Γ((Subscript[d, j]) - s)))

and the contour ℒ is a line that separates poles of Γ ((Subscript[a, j]) + s) from Γ ((Subscript[b, j]) - s). Let us investigate when the integral exists. On a straight line ℒ, 
       = (γ - i∞,  
          γ + i∞) the real part of s ∈ ℒ is bounded, and \(TraditionalForm
      \`|Im(s)| -> 
        ∞\). Using the Stirling asymptotic formula

\(TraditionalForm
    \`|Γ(x + i\ y)
          | = 
      \@\(2\ π\)\ 
        |y|\^\(x - 1\/2\)\ 
        \(\(e\^\(\(-\(π\/2\)\)\ 
                |y|\ \)\)(
          1\  + \ O(1\/|y|))\), \ 
    |y|\  -> ∞\)

we can deduce that the integrand g(s) (z^(-s)) vanishes exponentially as |Im(s)|->∞ if m + n - k - l > 0, and |arg(z)|<(π/2)  (m+n-k-l). If m + n - k - l = 0, then z must be real and positive. Some additional conditions are required here (see details in [1]).

It is clear that we can not simply imply the residue theorem to this contour integral. We need initially to transform the contour ℒ to the closed one. There are two possibilities: we can either transform ℒ into the left loop (Subscript[ℒ,  -∞]), the contour encircling all poles of Γ ((Subscript[a, j]) + s), or to the right loop (Subscript[ℒ,  +∞]), the contour encircling the poles of Γ ((Subscript[b, j]) - s). The criteria of which contour should be chosen appears from the convergence of the integral along that contour. On the left-hand loop (Subscript[ℒ,  -∞]), the imaginary part of s∈(Subscript[ℒ,  -∞ ])is bounded and Re(s) -> -∞. Assuming that \(TraditionalForm\`|arg(\(-s\))| < π\/2\), and making use of the Stirling formula

\(TraditionalForm
    \`Γ(z) = 
      \@\(2\ π\)\ z\^\(z - 1\/2\)\ e\^\(-z\)\ 
        \((1\  + \ O(1\/z))\), \ z -> ∞, \ 
    |arg(z)| < π\)

and the reflection formula of the Gamma function, we find that the Mellin-Barnes integral over the loop (Subscript[ℒ,  -∞]) exists, if n + l - m - k > 0. If n + l - m - k = 0, then z must be within the unit disk |z |  < 1. If z is on a unit circle |z |   =  1, the integral converges if

\(TraditionalForm
    \`Re(∑\+\(j = 1\)\%n a\_j + ∑\+\(j = 1\)\%m b\_j + 
          ∑\+\(j = 1\)\%k c\_j + ∑\+\(j = 1\)\%l d\_j) < 
      \(-k\) + n - 1\)

On the right-hand loop (Subscript[ℒ,  +∞]), the imaginary part of s∈(Subscript[ℒ,  +∞ ])is bounded and Re(s) -> +∞. Proceeding similarly to the above, we find that the Mellin-Barnes integral over the loop (Subscript[ℒ,  +∞]) exists, if n + l - m - k < 0. If n + l - m - k = 0, then z must be outside of the unit disk. Additional conditions are required if z is on a unit circle.

After determining the correct contour, the next step is to calculate residues of  the integrand. Since the integrand contains only Gamma functions, this task is  more or less formal. We don't even need to calculate residues of the integrand, but  go straightforwardly to the generalized hypergeometric functions. The only obstacle is the logarithmic case, which occurs when the integrand has multiple poles. We have to separate two subclasses here: the integrand that has a finite number of multiple poles, and the integrand that has infinitely many multiple poles. The Mathematica integration routine has a full implementation of the former case. In the latter, the integration artificially restricted by the second order poles, since for the higher order poles it would lead to infinite sums with higher order polygamma functions. This class of infinite sums are extremely hard to deal with, symbolically and numerically.  If such a situation is detected Integrate  returns the Meijer G-function. However, there are some very special transformations of the G-function, which could avoid bulky infinite sums with polygamma functions, and give a nice result in terms of known functions. In [4] I demonstrated a few transformations that reduce the order of the G-function and make it possible to handle special class of Bessel integrals in terms of Bessel functions.

An Example

Consider the integral

\(TraditionalForm
    \`Ω = 
      ∫\_0\%∞\(\(\ sin(x)\)\/\(x\ \((x\^2 + 1)\)\)\) 
          dx\)

According to the formula  (1), we have

\(TraditionalForm
    \`\(Ω = 
      \(∫\_0\%∞\( 1\/\(x\^2 + 1\)\) \(sin(1\/\(1/x\))\)\ 
            dx\/x = 
        \(1\/\(2\ π\ i\)\) 
          \(∫\+\(γ - 
                i∞\)\%\(γ + 
                i∞\)\(\(f\_1\%*\)(s)\)\ 
              \(\(f\_2\%*\)(s)\) ds\)\)\ \ \ \)\)

where \(TraditionalForm\`\(\(f\_1\%*\)(s)\)\ and\ \(\(f\_2\%*\)(s)\)\) are Mellin transforms of (e^(-x))  and sin((1/x)):

\(\(f\_1\^*\)[s] = 
      ∫\_0\%∞\( x\^\(s - 1\)\/\(x\^2 + 1\)\) 
          \[DifferentialD]x\)

\(\(f\_2\^*\)[s] = 
      ∫\_0\%∞\( Sin[1\/x]\ x\^\(s - 1\)\) 
          \[DifferentialD]x\)

Therefore,

\(TraditionalForm
    \`\(Ω = 
      \(-\(π\/\(4\ π\ i\)\)\) 
        \(∫\+\(γ - i∞\)\%\(γ + 
              i∞\)\(Γ(\(-s\))\) 
            ds\)\ \ \ \)\)

where γ is defined by conditions of the existence of Mellin transforms

0 < γ = Re(s) < 1

As it follows from the previous section we can transform the integration contour  \(TraditionalForm
      \`\((γ - ∞, γ + i∞)
        \)\) into the right loop (Subscript[ℒ,  +∞]) . Then, using the residue theorem we evaluate the integral as a sum of residues  at simple poles s = 1, 2, ... .

Ω = 
      -(π/2)  
        (∑_(k = 1)^∞)((((-1))^k)/(k!))

Meijer G-Function

We did not intend to give a complete picture of the Meijer G-function here, but only necessary facts. In Version 3.0 the G-function is defined by

MeijerG[{{(Subscript[a, 1]), (Subscript[a, 2]),  ... , (Subscript[a, n])}, {(Subscript[a, n + 1]), (Subscript[a, n + 2]), 
                 ... , (Subscript[a, p])}}, {{(Subscript[b, 1]), (Subscript[b, 2]),  ... , (Subscript[b, m])}, {(Subscript[b, m + 1]), 
                (Subscript[b, m + 2]),  ... , (Subscript[b, q])}} , z] =
	            (Subscript[G, p, q]^(m, n))(z|({{(Subscript[a, 1]), , (Subscript[a, 2]), }, {(Subscript[b, 1]), , (Subscript[b, 2]), }})({{... , , (Subscript[a, p])}, {... , , (Subscript[b, q])}})) =
	             (1/(2 π i)) 
              (∮_ℒ)(((∏_(i = 1
                            )^m) Γ((Subscript[b, i]) + s) 
                          (∏_(i = 1)^n) Γ(
                              1 - (Subscript[a, i]) -  s)  
                      )/((∏_(i = n + 1)^p)
                           Γ((Subscript[a, i]) + s) 
                          (∏_(i = m + 1)^q) Γ(
                              1 - (Subscript[b, i]) - s))) (z^(-s)) 
                  ds

and the contour ℒ is a left (or right) loop (Subscript[ℒ,  -∞]) (or (Subscript[ℒ,  +∞])) separated poles of Γ ((Subscript[b, j]) + s) from Γ (1 - (Subscript[a, j]) - s). The current implementation of the Meijer function has two noticeable features that differ it from the classical G-function. First, you are not allowed to choose or move the contour of integration, and, second, MeijerG has an optional parameter (the classical G-function does not) that regulates the branch cut. The Meijer function is supported symbolically and numerically.

MeijerG[{{0}, {}}, {{0}, {}}, z]

MeijerG[{{-1}, {1, 2}}, {{0, (1/2)}, {}}, (1/2)]

N[%]

Only in very trivial cases MeijerG is simplified automatically to the lower level special functions. Beyond that all further transformations are assigned to FunctionExpand:

FunctionExpand[%%]

MeijerG is interlaced with indefinite and definite integration, and with solving linear differential equations with polynomial coefficients. Here is an example related to definite integration:

(∫_1^∞)(( (x^2) BesselK[0, x])/(Sqrt[(x^2) - 1])) 
        \[DifferentialD]x

The first element of the second argument of MeijerG, which is {-1,0,0}, indicates that the integrand of the correspondent contour integral contains the product of three Gamma functions \(TraditionalForm
      \`\(Γ(s - 1)\) \(Γ(s)\) 
        \(Γ(s)\)\) and has an infinite number of triple poles at s=-k, k=0,1,2, ... . From the design point of view it is definitely an advantage for Integrate  to return a short object, MeijerG, rather than enormous infinite sums involving derivatives of the Gamma function.

Hypergeometric Functions

The essential part of integration is the generalized hypergeometric function, which is defined by

HypergeometricPFQ[{(Subscript[a, 1]), ..., (Subscript[a, p])}, {(Subscript[b, 1]), ..., (Subscript[b, q])}, z]=(Subscript[, p])(Subscript[F, q])(z|({{(Subscript[a, 1]), , (Subscript[a, 2]), }, {(Subscript[b, 1]), , (Subscript[b, 2]), }})({{... , , (Subscript[a, p])}, {... , , (Subscript[b, q])}})) =
		(∑_(k = 0
                )^∞)(((∏_(j = 1)^p)(Subscript[(((Subscript[a, j]))), k]) 
                  )/((∏_(j = 1)^q)(Subscript[(((Subscript[b, j]))), k]) )) 
              ((z^k)/(k!))

where (Subscript[((a)), k]) is a Pochhammer symbol

\(TraditionalForm
    \`\((a\_j)\)\_k\  = 
      \(∏\+\(l = 1\)\%k\((a\_j\  + \ l - 1)\) = 
        \(Γ(a\_j + k)\)\/\(Γ(a\_j)\)\)\)

Conditions of convergence can be easily obtained by applying the d'Alembert test. It follows, (Subscript[, p])(Subscript[F, q]) converges for all finite z if p ≤ q, and for |z| < 1 if p = q + 1. Additional conditions are required on the circle of convergence |z|=1. The above series definition of (Subscript[, p])(Subscript[F, q]) has an exceptional case, when p = 2 and q = 0 - such HypergeometricPFQ is defined via the confluent hypergeometric function HypergeometricU

HypergeometricPFQ[{a, b}, {}, z]

For \(TraditionalForm\`|z| ⩾ 1\) and p = q + 1, the hypergeometric function is defined as an analytic continuation via the Mellin-Barnes integral, with the branch cut [1, ∞):

(Subscript[, q + 1])(Subscript[F, q])(z|({{(Subscript[a, 1]), , (Subscript[a, 2]), }, {(Subscript[b, 1]), , (Subscript[b, 2]), }})({{... , , (Subscript[a, q + 1])}, {... , , (Subscript[b, q])}})) =
	(((∏_(k = 1)^q) Γ((Subscript[b, k]))
                  )/((∏_(k = 1)^(q + 1))Γ((Subscript[a, k]))
                  ))(1/(2  π i))(∫_(γ - i∞)^(γ + i∞))(( Γ (s)   
                    (∏_(j = 1)^(q + 1))Γ 
                        ((Subscript[a, j]) - s))/((∏_(j = 1)^q) 
                      Γ ((Subscript[b, j]) - s))) 
              (((-z))^(-s)) ds

where the straight line \(TraditionalForm
      \`\((γ - i∞, 
        γ + i∞)\)\) separates poles of Γ(s) from Γ ((Subscript[a, j]) - s).

Almost all symbolic simplifications of (Subscript[, p])(Subscript[F, q]) to the lower level functions are done automatically

Hypergeometric2F1[(1/3), (1/3), (4/3), (1/2)]

HypergeometricPFQ[{1, (1/3), (1/3)}, {(4/3), (4/3)}, 1]

HypergeometricPFQ[{1, 1, 1, 1}, {4, 4, 4}, -1]

The exception is the Gauss function Hypergeometric2F1. Since it has so many different transformation and simplification rules some of them are assigned to FunctionExpand:

Hypergeometric2F1[1, (1/4), (5/4), (1/4)]

FunctionExpand[%]

Principal-Value Integrals

Consider the integral

(∫_(-1)^2) (1/x) \[DifferentialD]x

which does not exist in the Riemann sense, since it has a nonintegrable singularity at x = 0. However, if we isolate x = 0 by (Subscript[ϵ, 1])>0 from the left and by (Subscript[ϵ, 2]) > 0 from the right  and take a limit of correspondent integrals when (Subscript[ϵ, 1])->0 and (Subscript[ϵ, 2])->0, we obtain

(lim_({{(Subscript[ϵ, 1]) -> 0}, {(Subscript[ϵ, 2]) -> 0}})) \((∫\_\(-1\)\%\(-ϵ\_1\)\(1\/x\) dx + ∫\_\(ϵ\_2\)\%2\( 
                      1\/x\) dx)\)=(lim_({{(Subscript[ϵ, 1]) -> 0}, {(Subscript[ϵ, 2]) -> 0}}))(log(2) + log((Subscript[ϵ, 1])) - 
              log((Subscript[ϵ, 2])))

The double limit exists, and so it is a given integral, if and only if (Subscript[ϵ, 1])=(Subscript[ϵ, 2]). Such understanding of divergent integrals is called the principal-value or the  Cauchy principal-value. It is easy to see that if an integral exists in the Riemann sense, it exists in the Cauchy sense. Thus, the class of Cauchy integrals is larger than the class of Riemann integrals.

In Version 3.0, definite integrals in the Riemann sense and principal-value integrals are separated by the new option PrincipalValue. If you want to evaluate an integral in the Cauchy sense, set the option PrincipalValue to True (the default setting is False). Here is an example

Integrate[(1/x), {x, -1, 2}, PrincipalValue -> True]

Integrate[(1/Sinh)[5 x + 1], {x, -1, 1}, 
      PrincipalValue -> True]

Integrate[
      (x/Sin)[3 x], {x, -(1/2) (3 π), ((3 π)/2)}, 
      PrincipalValue -> True]

If the integrand contains high-order polynomials, Integrate returns  RootSum objects

Integrate[(1/((x^7) + x + 1)), {x, -2, 1}, 
      PrincipalValue -> True]

Here are examples of integrals with movable singularities

Integrate[(1/(a - Tan[x]^2)), {x, 0, (π/2)}, 
      PrincipalValue -> True]

Integrate[((x^λ)/(x - a)), {x, 0, ∞}, 
      PrincipalValue -> True]

Here Integrate detects that the integrand has a singular point along the path of integration if the parameter a is real positive.

New Classes of Integrals

In this section we give a short overview of  specific classes of definite integrals, which were essentially improved in the new version. Mathematica now is able to calculate almost all indefinite and about half of definite integrals from the well-known collection of integrals compiled by Gradshteyn and Ryzhik. Moreover, the Version 3.0 makes it possible to calculate thousands of new integrals not included in any published handbooks.

integrals of rational functions

The RootSum object has been linked to Integrate to display the result of integration in a more elegant and shorter way

(∫_0^1)(( x - 1)/((x^7) + (x^3) + 1)) 
        \[DifferentialD]x

logarithmic and Polylogarithm integrals

(∫_0^1)(( (x^2) Log[x] Log[x + 1])/(x + 1)) 
        \[DifferentialD]x

\(∫\_0\%1\( Log[1 - x]\^3\/\((1 - x\ z)\)\^2\) 
        \[DifferentialD]x\)

elliptic integrals

The package, conducted an elliptic integration, is now autoloaded (as are as all other integration packages), so you don't need to worry about its loading anymore

(∫_(-(π/4))^((π/4)))(1/(Sqrt[Cos]))[x] 
        \[DifferentialD]x

(∫_0^((π/2)))(x/(Sqrt[Sin]))[x] \[DifferentialD]x

integrals involving Bessel functions

(∫_0
        ^∞) t Exp[-(t^2)] BesselI[2, t] BesselK[2, t] 
        \[DifferentialD]t

(∫_0
        ^∞)(( BesselJ[1, x] Exp[-(2/x)])/x) 
        \[DifferentialD]x

(∫_0^∞) AiryAi[x]^2 \[DifferentialD]x

integrals involving non-analytic functions

(∫_(-1 - I)^(2 + 2 I))Sin[Abs[x]] 
        \[DifferentialD]x

(∫_0^(((3 π)/2)))Max[Sin[x], Cos[2 x]] 
        \[DifferentialD]x

Additional Features

Mathematica's capability for definite integration gained substantial power in the new version. Other essential features of Integrate not discussed in the previous sections are convergence tests and the assumptions mechanism.

Conditions

In Version 3.0 Integrate is "conditional." In most cases, if the integrand or limits of integration contains symbolic parameters, Integrate returns an If statement of the form

If[ conditions, answer, held integral ]

which gives necessary conditions for the existence of the integral. For example

(∫_0
        ^∞) (x^(λ - 1)) Exp[-α x] 
        \[DifferentialD]x

Setting the option GenerateConditions to False prevents Integrate from returning conditional results (as in Version 2.2):

Integrate[
      (x^(λ - 1)) Exp[-α x], {x, 0, ∞}, 
      GenerateConditions -> False]

If a given definite integral has symbolic parameters, then the result of integration essentially always depends on certain specific conditions  on those parameters. In this example the  restrictions  Re(α) > 0  and  Re(λ) > 0 came from conditions of the convergence.  Even when a definite integral is convergent, some other conditions on parameters might appear. For instance, the presence of singularities on the integration path could lead to essential changes when the parameters  vary. The next section is devoted to the convergence of definite integrals.

Convergence

The new integration code contains criteria for the convergence of definite integrals. Each time Integrate examines the integrand for convergence

(∫_(-1)^1) Cos[x]/x \[DifferentialD]x

This integral has a nonintegrable singularity at x = 0. Thus, Integrate generates a warning message and returns unevaluated. However, the integral exists in the Cauchy sense. Setting the option PrincipalValue to True, we obtain

Integrate[Cos[x]/x, {x, -1, 1}, PrincipalValue -> True] // 
      FullSimplify

Consider another integral with a symbolic parameter α

(∫_0^1) (x^(ρ - 1)) ArcTan[x] \[DifferentialD]x

The integral has a singular point at x = 0, which is integrable only if Re(ρ) > -2.

If you are sure that a particular integral is convergent or you don't care about the convergence, you can avoid testing the convergence by setting the option GenerateConditions to False. It will make Integrate return an answer a bit faster.

Setting GenerateConditions to False also lets you evaluate divergent integrals

Integrate[(1/x), {x, 0, 2}, GenerateConditions -> False]

Assumptions

The new option Assumption is used to specify particular assumptions on parameters in definite integrals. Consider the integral with the arbitrary parameter y

\(TraditionalForm
    \`∫\_0
        \%∞\( e\^\(\(-x\^2\) - x\ y\)\/\@x\) 
        dx\)

Here we set the option Assumptions to Re(y) > 0

Integrate[Exp[-(x^2) - x y]/(Sqrt[x]), {x, 0, ∞}, 
      Assumptions -> Re[y] > 0]

Setting Assumptions to Re(y) < 0, we get a different form of the answer

Integrate[Exp[-(x^2) - x y]/(Sqrt[x]), {x, 0, ∞}, 
      Assumptions -> Re[y] < 0]

though the integral is a continuous function with respect to the parameter y

Plot[
      NIntegrate[Exp[-(x^2) - x y]/(Sqrt[x]), {x, 0, ∞}], {y, 
        -2, 2}]

The next integral is discontinuous with respect to the parameter γ

Integrate[
      ((Cos[x] (1 - Cos[γ x]))/(x^2)), {x, 0, ∞}, 
      Assumptions -> γ > 1]

Integrate[
      ((Cos[x] (1 - Cos[γ x]))/(x^2)), {x, 0, ∞}, 
      Assumptions -> -1 < γ < 1]

Integrate[
      ((Cos[x] (1 - Cos[γ x]))/(x^2)), {x, 0, ∞}, 
      Assumptions -> γ < -1]

If the given assumptions exactly match the generated assumptions, then the latter don't show up in the output; otherwise, Integrate produces assumptions complementary to ones given:

Integrate[(x^(ν - 1)) (((1 - x))^(μ - 1)), {x, 0, 1}, 
      Assumptions -> Re[ν] > 0]

References

1. O.I. Marichev, Handbook of integral transforms of higher transcendental functions: theory and algorithmic tables, Ellis Horwood, 1983.

2. V.S. Adamchik, K.S. Kolbig, A definite integral of a product of two polylogarithms, SIAM J. Math. Anal. 4(1988), 926-938.

3. V.S. Adamchik, O.I. Marichev, The algorithm for calculating integrals of hypergeometric type functions and its realization in REDUCE system, Proc. Conf. ISSAC'90, Tokyo (1990), 212-224.

4. V. Adamchik, The evaluation of integrals of Bessel functions via G-function identities, J. Comp. Applied Math. 64(1995), 283 - 290.

5. L.J. Slater, Generalized Hypergeometric Functions, Cambridge Univ. Press, 1966.

6. Y.L. Luke, The Special Functions and Their Approximations, Vol.1, Academic Press, 1969.