Definite Integrals

Integration functions.

Here is the integral (∫_a^b)(x^2) dx:

Integrate[x^2,{x,a,b}]

This gives the multiple integral (∫_0^a)dx (∫_0^b)dy((x^2)+(y^2)):

Integrate[x^2+y^2,{x,0,a},{y,0,b}]

The y integral is done first. Its limits can depend on the value of x. This ordering is the same as is used in functions like (RefLink[Sum, paclet:ref/Sum]) and (RefLink[Table, paclet:ref/Table]):

Integrate[x^2+y^2,{x,0,a},{y,0,x}]

In simple cases, definite integrals can be done by finding indefinite forms and then computing appropriate limits. But there is a vast range of integrals for which the indefinite form cannot be expressed in terms of standard mathematical functions, but the definite form still can be.

This indefinite integral cannot be done in terms of standard mathematical functions:

Integrate[Cos[Sin[x]],x]

This definite integral, however, can be done in terms of a Bessel function:

Integrate[Cos[Sin[x]],{x,0,2Pi}]

Here is an integral where the indefinite form can be found, but it is much more efficient to work out the definite form directly:

Integrate[Log[x] Exp[-x^2],{x,0,Infinity}]

Just because an integrand may contain special functions, it does not mean that the definite integral will necessarily be complicated:

Integrate[BesselK[0,x]^2,{x,0,Infinity}]

Special functions nevertheless occur in this result:

Integrate[BesselK[0,x] BesselJ[0,x],{x,0,Infinity}]

The integrand here is simple, but the definite integral is not:

Integrate[Sin[x^2] Exp[-x],{x,0,Infinity}]

Even when you can find the indefinite form of an integral, you will often not get the correct answer for the definite integral if you just subtract the values of the limits at each end point. The problem is that within the domain of integration there may be singularities whose effects are ignored if you follow this procedure.

Here is the indefinite integral of 1/(x^2):

Integrate[1/x^2,x]

This subtracts the limits at each end point:

Limit[%,x->2]-Limit[%,x->-2]

The true definite integral is divergent because of the double pole at x==0:

Integrate[1/x^2,{x,-2,2}]

Here is a more subtle example, involving branch cuts rather than poles:

Integrate[1/(1+a Sin[x]),x]

Taking limits in the indefinite integral gives 0:

Limit[%,x->2Pi]-Limit[%,x->0]

The definite integral, however, gives the correct result which depends on a. The assumption assures convergence:

Integrate[1/(1+a Sin[x]),{x,0,2Pi},Assumptions->-1<a<1]

Principal value integrals.

Here is the indefinite integral of 1/x:

Integrate[1/x,x]

Substituting in the limits -1 and +2 yields a strange result involving iπ:

Limit[%,x->2]-Limit[%,x->-1]

The ordinary Riemann definite integral is divergent:

Integrate[1/x,{x,-1,2}]

The Cauchy principal value, however, is finite:

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

When parameters appear in an indefinite integral, it is essentially always possible to get results that are correct for almost all values of these parameters. But for definite integrals this is no longer the case. The most common problem is that a definite integral may converge only when the parameters that appear in it satisfy certain specific conditions.

This indefinite integral is correct for all n≠-1:

Integrate[x^n,x]

For the definite integral, however, n must satisfy a condition in order for the integral to be convergent:

Integrate[x^n,{x,0,1}]

If n is replaced by 2, the condition is satisfied:

%/.n->2

Options for (RefLink[Integrate, paclet:ref/Integrate]).

With the assumption n>2, the result is always 1/(1+n):

Integrate[x^n,{x,0,1},Assumptions->(n>2)]

Even when a definite integral is convergent, the presence of singularities on the integration path can lead to discontinuous changes when the parameters vary. Sometimes a single formula containing functions like (RefLink[Sign, paclet:ref/Sign]) can be used to summarize the result. In other cases, however, an explicit (RefLink[If, paclet:ref/If]) is more convenient.

The (RefLink[If, paclet:ref/If]) here gives the condition for the integral to be convergent:

Integrate[Sin[a x]/x,{x,0,Infinity}]

Here is the result assuming that a is real:

Integrate[Sin[a x]/x,{x,0,Infinity},Assumptions->Im[a]==0]

The result is discontinuous as a function of a. The discontinuity can be traced to the essential singularity of sin(x) at x==∞:

Plot[%,{a,-5,5}]

There is no convenient way to represent this answer in terms of (RefLink[Sign, paclet:ref/Sign]), so the Wolfram Language generates an explicit (RefLink[If, paclet:ref/If]):

Integrate[Sin[x] BesselJ[0,a x]/x,{x,0,Infinity},Assumptions->Im[a]==0]

Here is a plot of the resulting function of a:

Plot[Evaluate[%],{a,-5,5}]