Algorithms for Indefinite and Definite Integration in Maple 

K.O. Geddes
Symbolic Computation Group
D.R. Cheriton School of Computer Science
University of Waterloo
Waterloo  ON  N2L 3G1
CANADA
http://www.uwaterloo.ca/~kogeddes
 

Note 

For CS 487/687, the relevant section is Risch Algorithm for Elementary Functions. 

 

Abstract 

The Risch integration algorithm for computing indefinite integrals (antiderivatives) of transcendental elementary functions is described. Extensions of this algorithm to handle algebraic functions, and to the case of non-elementary special functions, are mentioned briefly with pointers to the relevant literature. On the problem of computing definite integrals in closed form, some practical issues associated with the application of the Fundamental Theorem of Calculus are described. For some particular classes of definite integrals involving special functions, current research work is briefly described in which the approach is to convert the integrand to a Meijer G function representation, to apply known formulas for definite integrals of products of Meijer G functions, and then to convert the result, if possible, to a representation in terms of standard functions. 

 

Risch Algorithm for Elementary Functions 

The Problem 

Given a function , determine whether there exists a function such that 

 

i.e. determine an indefinite integral, or antiderivative, of .  We will write 

 

where we do not explicitly write the arbitrary constant of integration. 

 

A detailed development of the Risch integration algorithm presented here can be found in the textbook [Geddes92]. Additional material on the Risch algorithm appears in [Bronstein90b], [Bronstein97]. 

 

In this presentation, examples will be shown using the Maple computer algebra system.  

Example 1.1 

> restart;
 

> f := x*(x+1)*( (x^2*exp(2*x^2) - ln(x+1)^2)^2 +
2*x*exp(3*x^2)*( x - (2*x^3+2*x^2+x+1)*ln(x+1) )) /
((x+1)*ln(x+1)^2 - (x^3+x^2)*exp(2*x^2) )^2:
 

 

> Int(f,x);
 

Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
 

 

> value(%);
 

x-ln(x+1)+exp(x^2)*x*ln(x+1)/(x^2*exp(2*x^2)-ln(x+1)^2)-1/2*ln(-x*exp(x^2)+ln(x+1))+1/2*ln(x*exp(x^2)+ln(x+1))
x-ln(x+1)+exp(x^2)*x*ln(x+1)/(x^2*exp(2*x^2)-ln(x+1)^2)-1/2*ln(-x*exp(x^2)+ln(x+1))+1/2*ln(x*exp(x^2)+ln(x+1))
 

>
 

Defining the function field 

The Risch integration algorithm is a decision procedure by which we mean that given an integrand , the algorithm will determine: 

  • Does there exist a function in a specified class of functions such that ?
 

  • If yes then determine .
 

If the answer to the existence question is no then the algorithm has constructed a proof of nonexistence. 

 

Such a decision procedure is only possible in a context where we have clearly specified the class of functions (the function field) containing . For example, we will consider the field of elementary functions. In this function field, the Risch algorithm will determine that the integral does not exist. However, if we allow the question to be expanded beyond the field of elementary functions then this integral can be expressed, as shown below by Maple. 

 

> Int(exp(-x^2), x) = int(exp(-x^2), x);
 

Int(exp(-x^2), x) = 1/2*Pi^(1/2)*erf(x) 

>
 

Definition of Elementary Functions 

Let be a differential field (i.e. a function field on which derivation is defined) and let be a differential extension field of .  Let the derivation operation be denoted by prime ( ' ) . 

  • For in , if there exists in such that  theta^`'` = u^`'`/u  then we write    and  is called logarithmic over .
 

  • For in , if there exists in such that  theta^`'`/theta = u^`'`  then we write    and  is called exponential over .
 

  • For in , if there exists a polynomial in [] such that    then is called algebraic over .
 

 

  • in  is transcendental over if is not algebraic over .
 

 

  •  is called a transcendental elementary extension of  if    where each is transcendental and either logarithmic or exponential over the field   .
 

  • Similarly, is an elementary extension of if each is logarithmic, exponential or algebraic over .
 

 

  • If denotes a differential field of rational functions over a constant field  (a subfield of the complex numbers) and if is an elementary extension of then is called a field of elementary functions.
 

  • Similarly, is called a field of transcendental elementary functions if is a transcendental elementary extension of .
 

 

Notation for elementary functions 

Note that the common notation for elementary functions does not make it clear that an elementary function can be described using only the three types of extensions defined above. 

 

Examples in common notation 

> Int(1/(1+x^2), x) = int(1/(1+x^2), x);
 

Int(1/(1+x^2), x) = arctan(x) 

> Int(cos(x), x) = int(cos(x), x);
 

Int(cos(x), x) = sin(x) 

> Int(1/sqrt(1-x^2), x) = int(1/sqrt(1-x^2), x);
 

Int(1/(1-x^2)^(1/2), x) = arcsin(x) 

> Int(arccosh(x), x) = int(arccosh(x), x);
 

Int(arccosh(x), x) = x*arccosh(x)-(x-1)^(1/2)*(x+1)^(1/2) 

>
 

 

In the examples above, each integrand and each integral result involves only elementary functions. To see that these functions conform to the definition of elementary functions of the preceding section, we must convert the functions to complex exp-log form. 

 

The same examples in exp-log notation 

> Int(1/(1+x^2), x) = convert(int(1/(1+x^2), x), 'expln');
 

Int(1/(1+x^2), x) = 1/2*I*(ln(1-I*x)-ln(1+I*x)) 

> Int(1/2*exp(I*x) + 1/2*exp(-I*x), x) = int(1/2*exp(I*x) + 1/2*exp(-I*x), x);
 

Int(1/2*exp(I*x)+1/2*exp(-I*x), x) = -1/2*I*exp(I*x)+1/2*I*exp(-I*x) 

> Int(1/sqrt(1-x^2), x) = convert(int(1/sqrt(1-x^2), x), 'expln');
 

Int(1/(1-x^2)^(1/2), x) = -I*ln((1-x^2)^(1/2)+I*x) 

> Int(convert(arccosh(x),'expln'), x) = int(convert(arccosh(x),'expln'), x);
 

Int(ln(x+(x-1)^(1/2)*(x+1)^(1/2)), x) = ln(x+(x-1)^(1/2)*(x+1)^(1/2))*x-(x-1)^(1/2)*(x+1)^(1/2)
Int(ln(x+(x-1)^(1/2)*(x+1)^(1/2)), x) = ln(x+(x-1)^(1/2)*(x+1)^(1/2))*x-(x-1)^(1/2)*(x+1)^(1/2)
 

>
 

 

We can now see a relationship between the input (the integrand) and the output (the integral result).  Namely, the types of functions which can appear in the integral result are the same functions that appear in the integrand plus, in some cases, new log extensions.  This fact is known as Liouville's Principle: the only new functions needed are constant multiplies of log extensions. 

 

The common notation hides this relationship. 

 

Liouville's Principle 

Theorem 1 

Given in an elementary function field , , if it exists as an elementary function, can be expressed in the form 

 

 

with   in ,   constants,  and   in . 

 

Note: The constants may involve new algebraic number extensions. 

 

Integral of a rational function 

Given a rational function , Liouville's Principle states that its integral can be expressed as a rational function plus (possibly) some constant multiples of functions. (Note that Maple's notation for the natural logarithm function is rather than .) 

 

For the case of rational functions, the integral always exists as an elementary function. 

 

Example 1.2 

 

> restart;
 

> Int(1/(x^2+2*x+1), x) = int(1/(x^2+2*x+1), x);
 

Int(1/(x^2+2*x+1), x) = -1/(x+1) 

Remark: No terms required in the above example. 

 

> Int(1/(x^3+x), x) = int(1/(x^3+x), x);
 

Int(1/(x^3+x), x) = ln(x)-1/2*ln(x^2+1) 

Remark: No algebraic number extensions required in the above example. 

 

> Int(1/(x^2-2), x) = `int/risch`(1/(x^2-2), x);
 

Int(1/(x^2-2), x) = 1/4*2^(1/2)*ln(x-2^(1/2))-1/4*2^(1/2)*ln(x+2^(1/2)) 

Remark: In the latter example, the constant field needed to be extended by the algebraic number . 

>
 

 

Minimal algebraic extensions are desired for efficiency. 

For example, from above noting that    would lead to the following representation of the integral: 

 

 . 

 

Goal:  Avoid introducing algebraic numbers except when necessary. 

 

Hermite Reductions for the Rational Part 

We want to reduce the problem as follows: 

 

where    and where    is monic and square-free. 

 

Hermite's method is a classical method to achieve this reduction. The reduction is accomplished using basic polynomial operations and without introducing any algebraic number extensions.  The method is summarized here. 

 

Step 1:  Euclidean division with remainder yields 

 

where    or   . 

 

Step 2:  Square-free factorization yields 

 

where  gcd(q[i](x), q[i](x)^`'`) = 1  for all , 

and where    for . 

 

Step 3:  Partial fraction expansion yields 

 

where   . 

 

We now have 

. 

 

Step 4:  Hermite reductions must be applied for each integrand where the denominator is a power > of a square-free factor. 

After this step, each integral that remains will have a square-free denominator. 

Consider one integral    with > . 

Apply the Extended Euclidean Algorithm to solve:   s(x)*q[i](x)+t(x)*q[i](x)^`'` = r[i, j](x) . 

This yields  Int(r[i, j](x)/q[i](x)^j, x) = Int(s(x)/q[i](x)^(j-1), x)+Int(t(x)*q[i](x)^`'`/q[i](x)^j, x)  . 

Integration by parts yields 

Int(t(x)*q[i](x)^`'`/q[i](x)^j, x) = -t(x)/((j-1)*q[i](x)^(j-1))+Int(t(x)^`'`/((j-1)*q[i](x)^(j-1)), x)
Int(t(x)*q[i](x)^`'`/q[i](x)^j, x) = -t(x)/((j-1)*q[i](x)^(j-1))+Int(t(x)^`'`/((j-1)*q[i](x)^(j-1)), x)
Int(t(x)*q[i](x)^`'`/q[i](x)^j, x) = -t(x)/((j-1)*q[i](x)^(j-1))+Int(t(x)^`'`/((j-1)*q[i](x)^(j-1)), x)  .
 

 

Note the contribution to the rational part of the result. 

Hermite reductions can be continued until only square-free denominators remain. 

 

Example 1.3 

> p := x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1:
 

> q := x^4+10*x^2+25:
 

 

The integral we wish to compute is 

 

> Int(p/q, x);
 

Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) 

> r := rem(p, q, x, 'P');
 

-1+2*x 

> P;
 

x^2+5*x 

> int_P := int(P, x);
 

1/3*x^3+5/2*x^2 

 

Euclidean division with remainder has yielded: 

 

> Int(p/q, x) = int_P + Int(r/q, x);
 

Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2+Int((-1+2*x)/(x^4+10*x^2+25), x)
Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2+Int((-1+2*x)/(x^4+10*x^2+25), x)
 

 

> q_sqrfree := convert(q, sqrfree, x);
 

(x^2+5)^2 

> q2 := x^2 + 5;
 

x^2+5 

In this case, the square-free factorization of the denominator is 

 with    and   . 

 

The problem has been reduced to 

 

> Int(p/q, x) = int_P + Int(r/q2^2, x);
 

Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2+Int((-1+2*x)/(x^2+5)^2, x)
Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2+Int((-1+2*x)/(x^2+5)^2, x)
 

 

Apply Hermite reduction to the remaining integral which is of the form    with . 

 

The Extended Euclidean Algorithm is invoked as follows. 

 

> gcdex(q2, diff(q2,x), r, x, 's', 't');
 

> s;
 

-1/5 

> t;
 

1+1/10*x 

> j := 2:
 

 

The Hermite reduction formula takes the form 

 

> Int(r/q2^j, x) = -t/((j-1)*q2^(j-1)) + Int((s+diff(t,x)/(j-1))/q2^(j-1), x);
 

Int((-1+2*x)/(x^2+5)^2, x) = -(1+1/10*x)/(x^2+5)+Int(-1/10/(x^2+5), x) 

 

and therefore the original integral has been reduced to 

 

> Int(p/q, x) = int_P + rhs(%);
 

Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2-(1+1/10*x)/(x^2+5)+Int(-1/10/(x^2+5), x)
Int((x^6+5*x^5+10*x^4+50*x^3+25*x^2+127*x-1)/(x^4+10*x^2+25), x) = 1/3*x^3+5/2*x^2-(1+1/10*x)/(x^2+5)+Int(-1/10/(x^2+5), x)
 

>
 

Rothstein-Trager Theorem for the Logarithmic Part 

The problem is to express    where    and    is square-free. 

Classical approach:  Factor B(x) over its splitting field, and then a partial fraction expansion determines the terms. 

But such a factorization may be much more expensive than necessary. 

 

Theorem 2  (Rothstein-Trager Theorem) 

 

where are the distinct roots of  R(z) = resultant(A(x)-z*B(x)^`'`, B(x), x) 

and where are the polynomials  v[i](x) = gcd(A(x)-c[i]*B(x)^`'`, B(x)) . 

Moreover, this expresses the integral using the minimal algebraic extension field. 

 

Remark: The roots of may introduce new algebraic numbers. 

 

Example 1.4 

 

From Example 1.3 the remaining integral is 

 

> A := -1/10:  B := x^2 + 5:
 

> Int(A/B, x);
 

Int(-1/10/(x^2+5), x) 

> R := resultant(A - z*diff(B,x), B, x);
 

20*z^2+1/100 

> (c1,c2) := solve(R=0, z);
 

1/100*I*5^(1/2), -1/100*I*5^(1/2) 

> v1 := gcd(A - c1*diff(B,x), B);
 

-I*5^(1/2)+x 

> v2 := gcd(A - c2*diff(B,x), B);
 

I*5^(1/2)+x 

 

Therefore the integral can be expressed as follows. 

 

> Int(A/B, x) = c1*log(v1) + c2*log(v2);
 

Int(-1/10/(x^2+5), x) = 1/100*I*5^(1/2)*ln(-I*5^(1/2)+x)-1/100*I*5^(1/2)*ln(I*5^(1/2)+x)
Int(-1/10/(x^2+5), x) = 1/100*I*5^(1/2)*ln(-I*5^(1/2)+x)-1/100*I*5^(1/2)*ln(I*5^(1/2)+x)
 

>
 

In this case, the result is identical to that obtained by the "classical approach" where the denominator is completely factored. 

 

Example 1.5 

 

One of the integrals from Example 1.2 is 

 

> A := 1:  B := x^3+x:
 

> Int(A/B, x);
 

Int(1/(x^3+x), x) 

> R := resultant(A - z*diff(B,x), B, x);
 

(1-z)*(2*z+1)^2 

> solve(R=0, z);
 

1, -1/2, -1/2 

The distinct roots are 

> (c1,c2) := (1,-1/2);
 

1, -1/2 

> v1 := gcd(A - c1*diff(B,x), B);
 

x 

> v2 := gcd(A - c2*diff(B,x), B);
 

x^2+1 

 

Therefore the integral can be expressed as follows. 

 

> Int(A/B, x) = c1*log(v1) + c2*log(v2);
 

Int(1/(x^3+x), x) = ln(x)-1/2*ln(x^2+1) 

 

In contrast, the "classical" approach would require a complete factorization of the denominator 

 

> factored_B := factor(B,I);
 

-x*(x+I)*(-x+I) 

> integrand := convert(A/factored_B, parfrac, x);
 

-1/2/(x-I)+1/x-1/2/(x+I) 

from which we see that the integral is 

 

> Int(A/B, x) = map(`int/risch`, integrand, x);
 

Int(1/(x^3+x), x) = -1/2*ln(x-I)+ln(x)-1/2*ln(x+I) 

>
 

The Rothstein-Trager method avoids introducing the algebraic number extension    in this example. 

Computational cost increases significantly with each new algebraic number extension, so it is important to use the minimal number of extensions required by the problem. 

 

The case of transcendental elementary functions 

 

Step 1: Determine a description    of a function field containing the integrand . 

 is the constant field (we dynamically extend it to include any algebraic numbers which may arise). 

We must ensure that each is a new transcendental extension.  (This allows the manipulation of the integrand as a rational expression in the independent symbols .) 

 

Example 1.6 

For the integral 

> restart;
 

> Int(1/ln(x), x);
 

Int(1/ln(x), x) 

the integrand lies in the function field where is a logarithmic extension of the rational function field . 

In this field the integrand is 

> 1/theta;
 

1/theta 

>
 

Example 1.7 

For the integral 

> Int((x^3+2*x)*cos(x^2)+x*sin(x^2), x);
 

Int((x^3+2*x)*cos(x^2)+x*sin(x^2), x) 

by converting the integrand to complex - form, the problem can be expressed in the form 

 

> Int((x^3+2*x)*(exp(I*x^2)+exp(-I*x^2))/2 - 1/2*I*x*(exp(I*x^2)-exp(-I*x^2)), x);
 

Int(1/2*(x^3+2*x)*(exp(I*x^2)+exp(-I*x^2))-1/2*I*x*(exp(I*x^2)-exp(-I*x^2)), x)
Int(1/2*(x^3+2*x)*(exp(I*x^2)+exp(-I*x^2))-1/2*I*x*(exp(I*x^2)-exp(-I*x^2)), x)
 

and we can view the integrand as an element of the function field    where .  (Note: .) 

In this field the integrand is 

> 1/2*(x^3+2*x)*(theta + 1/theta) - 1/2*I*x*(theta - 1/theta);
 

1/2*(x^3+2*x)*(theta+1/theta)-1/2*I*x*(theta-1/theta) 

>
 

Example 1.8 

 

For the integral presented in Example 1.1 

> Int(x*(x+1)*( (x^2*exp(2*x^2) - ln(x+1)^2)^2 +
2*x*exp(3*x^2)*( x - (2*x^3+2*x^2+x+1)*ln(x+1) )) /
((x+1)*ln(x+1)^2 - (x^3+x^2)*exp(2*x^2) )^2, x);
 

Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
Int(x*(x+1)*((x^2*exp(2*x^2)-ln(x+1)^2)^2+2*x*exp(3*x^2)*(x-(2*x^3+2*x^2+x+1)*ln(x+1)))/((x+1)*ln(x+1)^2-(x^3+x^2)*exp(2*x^2))^2, x)
 

we can view the integrand as an element of the function field    where and . 

Note that the two exponential terms    and    cannot be considered as independent extensions because there is an algebraic relationship between them. Rather, we choose to represent these terms in the form    and    which involves a single transcendental extension   . 

>
 

 

Step 2: Consider the integrand as a rational expression in the field : 

                    

where denotes the last extension and where   .  In other words, and are viewed as polynomials in the domain [] .  Normalize such that and is monic. 

 

The algorithm proceeds in a manner similar to rational function integration; specifically, Hermite reductions followed by the application of a Rothstein-Trager Theorem.  In particular, the algorithm will apply polynomial operations.  We consider separately the cases where the last extension    is a logarithmic extension or an exponential extension. 

 

Integral of a logarithmic extension 

Suppose that the last extension    is a logarithmic extension, i.e.  theta^`'` = u^`'`/u  for some function in .  Applying Euclidean division with remainder yields   . 

We now have two integrals to consider:  (1) the integral of the polynomial part;  and (2) the integral of the rational part.  This time (unlike the case of rational function integration) the integral of the polynomial part is nontrivial; indeed, task (1) is the harder of the two parts.  We first consider task (2). 

 

Hermite Reductions for the Rational Part (log extension) 

This case mimics the Hermite method for rational functions.  Applying square-free factorization of the denominator yields    where this means "square-free as a polynomial in ."  For application in subsequent steps of the algorithm, we need to know that the following theorem holds. 

 

Theorem 3:  If is a monic polynomial which is square-free as a polynomial in the symbol and if    for some function then 

                   gcd(v(theta), v(theta)^`'`) = 1 

where the latter differentiation is with respect to . 

 

Then applying partial fraction expansion, we get 

   where     . 

 

For each integral with a denominator containing a power   > , apply the Extended Euclidean Algorithm to solve 

                    s(theta)*b[i](theta)+t(theta)*b[i](theta)^`'` = r[i, j](theta) . 

As in rational function integration, apply integration by parts to obtain the Hermite reduction: 

Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x)
Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x)
Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x) .
 

Continuing such reductions until no remaining integral has a denominator containing a power   > , we reduce the integration problem to one in which the denominator is square-free. 

 

Rothstein-Trager Theorem: log extension 

The problem is to express    where   ,    is square-free, and where    is a logarithmic extension. 

 

Theorem 4  (Rothstein-Trager Theorem: log extension) 

(i)    is elementary if and only if all of the roots of 

         R(z) = resultant(A(theta)-z*B(theta)^`'`, B(theta), theta) 

 

are constants.  In other words, the primitive part of with respect to the variable must have constant coefficients. 

 

(ii)  If    is elementary then 

                    

where are the distinct roots of and where are defined by 

         v[i](theta) = gcd(A(theta)-c[i]*B(theta)^`'`, B(theta)) . 

 

Moreover, this expresses the integral using the minimal algebraic extension field. 

 

Example 1.9 

Consider the following integral. 

> Int(1/ln(x), x);
 

Int(1/ln(x), x) 

The integrand is    in the function field where . 

A resultant computation (Rothstein-Trager Theorem) is applicable. 

 

> A := 1:  B := theta:
 

> diff_B := diff(ln(x), x);
 

1/x 

> R := resultant(A - z*diff_B, B, theta);
 

(x-z)/x 

The single root of is which is not a constant. 

Therefore the original integral is not elementary. 

>
 

Example 1.10 

The integral 

> Int(1/(x*ln(x)), x);
 

Int(1/(x*ln(x)), x) 

has integrand    in the function field where . 

This time, the resultant computation is as follows. 

> A := 1:  B := x*theta:
 

> diff_B := subs(ln(x)=theta, diff(subs(theta=ln(x), B), x));
 

theta+1 

> R := resultant(A - z*diff_B, B, theta);
 

x*(-1+z) 

The single root of is and the integral is elementary.  Specifically, 

> c[1] := 1;  v[1] := gcd(A - c[1]*diff_B, B);
 

1 

theta 

and the integral is 

> c[1]*ln(v[1]);
 

ln(theta) 

In other words, 

> Int(1/(x*ln(x)), x)  =
subs(theta=ln(x), c[1]*ln(v[1]));
 

Int(1/(x*ln(x)), x) = ln(ln(x)) 

>
 

Polynomial Part (log extension) 

For the integration of the "polynomial part", the integrand is a polynomial in the log extension : 

          

with    in    and we can conclude that 



.
 

Note that the last term indicates that some new log extensions may arise. 

 

Differentiating and equating coefficients of powers of the transcendental symbol , we get: 

         0 = B[k+1]^`'` 

         A[k] = (k+1)*B[k+1]*theta^`'`+B[k]^`'` 

         A[k-1] = k*B[k]*theta^`'`+B[k-1]^`'` 

                 . . . 

                 . . . 

         A[1] = 2*B[2]*theta^`'`+B[1]^`'` 

         A[0] = B[1]*theta^`'`+(B[0]^`*`)^`'` 

where   . 

We can solve these equations successively, from the top down.  At each step there is an integration operation which requires a recursive invocation of the Risch algorithm.  This works because the integrand lies in the field    involving one less extension.  At any step, if the integral to be computed is not elementary then the algorithm halts with the conclusion that the original integral is not elementary.  Moreover, at any step except the last step, if the result of the recursive integration introduces one or more new log extensions then the algorithm halts with the conclusion that the original integral is not elementary.  At the last step, new log extensions may appear. 

 

Example 1.11 

The integral 

                    

has integrand    in the field    where   .  If the integral is elementary then 

          

where the equations to be satisfied are 

         0 = B[2]^`'` 

         1 = 2*B[2]*theta^`'`+B[1]^`'` 

         0 = B[1]*theta^`'`+(B[0]^`*`)^`'`   . 

 

From the first equation we conclude that   , an arbitrary constant of integration.  Plugging this into the second equation and integrating both sides yields 

          

or 

          

where is an arbitrary constant of integration. Equating coefficients of on both sides of the equation, we conclude that and . 

The last equation now becomes 

         0 = (x+b[1])*theta^`'`+(B[0]^`*`)^`'` 

or rearranging (we always leave the term  i*b[i]*theta^`'`  on the right hand side since integration of this term is trivial): 

         -x*theta^`'` = b[1]*theta^`'`+(B[0]^`*`)^`'`   . 

At this point we use the fact that    (i.e. theta^`'` = 1/x )  on the left hand side, and integrate both sides to get 

          

from which we conclude (by equating coefficients of on both sides of the equation) that and , ignoring the arbitrary constant of integration in this final step. Putting it all together we have 

> theta := ln(x):
 

> B[2] := 0:  B[1] := x:  B[0] := -x:
 

> Int(theta, x) = B[2]*theta^2 + B[1]*theta + B[0];
 

Int(ln(x), x) = x*ln(x)-x 

>
 

Example 1.12 

The integral 

                    

has integrand    in the field    where and .  If the integral is elementary then 

          

where the equations to be satisfied are 

         0 = B[2]^`'` 

         1 = 2*B[2]*theta[2]^`'`+B[1]^`'` 

         0 = B[1]*theta[2]^`'`+(B[0]^`*`)^`'`   . 

 

From the first equation we conclude that   , an arbitrary constant of integration.  Plugging this into the second equation and integrating both sides yields 

          

or 

          

where is an arbitrary constant of integration. Equating coefficients of on both sides of the equation, we conclude that and . The last equation now becomes 

         0 = (x+b[1])*theta[2]^`'`+(B[0]^`*`)^`'` 

or rearranging: 

         -x*theta[2]^`'` = b[1]*theta[2]^`'`+(B[0]^`*`)^`'`   . 

Since  theta[2]^`'` = theta[1]^`'`/theta[1] ,  i.e. theta[2]^`'` = 1/(x*ln(x)) , substituting for theta[2]^`'` on the left hand side and integrating yields 

            . 

From Example 1.9 we know that the integral appearing here is not elementary. Hence we conclude that    is not elementary. 

 

Integral of an exponential extension 

Suppose that the last extension    is an exponential extension, i.e.  theta^`'`/theta = u^`'`  for some function in .  Applying Euclidean division with remainder yields   . 

Unlike the logarithmic case, we must remove any power of    from the denominator on the right hand side, and incorporate it into the new "polynomial part":   .  (This can be done.) 

We now have two integrals to consider:  (1) the integral of the polynomial part;  and (2) the integral of the rational part.  Again, task (1) is the harder of the two parts.  We first consider task (2). 

 

Hermite Reductions for the Rational Part (exp extension) 

This case is very similar to the logarithmic case.  Applying square-free factorization of the denominator yields    where this means "square-free as a polynomial in ."  For application in subsequent steps of the algorithm, we need to know that the following theorem holds. 

 

Theorem 5:  If is a monic polynomial which is square-free as a polynomial in the symbol and if    for some function then 

                   gcd(v(theta), v(theta)^`'`) = 1 

where the latter differentiation is with respect to ,  provided that    does not divide . 

 

Then, exactly as in the logarithmic case, applying partial fraction expansion we get 

   where     . 

 

For each integral with a denominator containing a power   > , apply the Extended Euclidean Algorithm to solve 

                    s(theta)*b[i](theta)+t(theta)*b[i](theta)^`'` = r[i, j](theta) . 

As before, apply integration by parts to obtain the Hermite reduction: 

Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x)
Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x)
Int(r[i, j](theta)/b[i](theta)^j, x) = -t(theta)/((j-1)*b[i](theta)^(j-1))+Int((s(theta)+t(theta)^`'`/(j-1))/b[i](theta)^(j-1), x) .
 

Continuing such reductions until no remaining integral has a denominator containing a power   > , we reduce the integration problem to one in which the denominator is square-free. 

 

Rothstein-Trager Theorem: exp extension 

The problem is to express    where   ,    is square-free, and where    is an exponential extension. 

 

Theorem 6  (Rothstein-Trager Theorem: exp extension) 

(i)    is elementary if and only if all of the roots of 

         R(z) = resultant(A(theta)-z*B(theta)^`'`, B(theta), theta) 

 

are constants.  In other words, the primitive part of with respect to the variable must have constant coefficients. 

 

(ii)  If    is elementary then 

                    

where are the distinct roots of ,   are defined by 

         v[i](theta) = gcd(A(theta)-c[i]*B(theta)^`'`, B(theta)) 

and where   . 

 

Moreover, this expresses the integral using the minimal algebraic extension field. 

 

Example 1.13 

Consider the following integral. 

> restart;
 

> f := (x*exp(2*x^2)+8*sqrt(2)*x*(exp(x^2)+1)+2*x)/
    (exp(3*x^2)+exp(2*x^2)+2*exp(x^2)+2):
 

> Int(f,x);
 

Int((x*exp(2*x^2)+8*2^(1/2)*x*(exp(x^2)+1)+2*x)/(exp(3*x^2)+exp(2*x^2)+2*exp(x^2)+2), x) 

The integrand is    in the function field where . 

 

A resultant computation (Rothstein-Trager Theorem) is applicable. 

Keep in mind that    where   . 

> u := x^2:
 

> A := x*theta^2 + 8*sqrt(2)*x*(theta+1) + 2*x:
 

> B := theta^3 + theta^2 + 2*theta + 2:
 

> diff_B := subs(exp(u)=theta, diff(subs(theta=exp(u), B), x));
 

6*theta^3*x+4*x*theta^2+4*x*theta 

> R := resultant(A - z*diff_B, B, theta);
 

-576*x^3*(2+4*z+2*2^(1/2)*z+4*2^(1/2)*z^2+z^2+2*z^3) 

> solve(R=0, z);
 

-1/2, -2^(1/2), -2^(1/2) 

The distinct roots of are    and    and the integral is elementary.  Specifically, 

> c[1] := -1/2:  c[2] := -sqrt(2):
 

> v[1] := gcd(A - c[1]*diff_B, B);
 

theta+1 

> v[2] := gcd(A - c[2]*diff_B, B);
 

theta^2+2 

The function appearing in Theorem 6 is 

> g := add(-c[i]*degree(v[i],theta), i=1..2) * u;
 

(1/2+2*2^(1/2))*x^2 

and the desired integral is 

> result := g + add(c[i]*ln(v[i]), i=1..2);
 

(1/2+2*2^(1/2))*x^2-1/2*ln(theta+1)-2^(1/2)*ln(theta^2+2)
(1/2+2*2^(1/2))*x^2-1/2*ln(theta+1)-2^(1/2)*ln(theta^2+2)
 

In other words, 

> Int(f,x) = subs(theta=exp(u), result);
 

Int((x*exp(2*x^2)+8*2^(1/2)*x*(exp(x^2)+1)+2*x)/(exp(3*x^2)+exp(2*x^2)+2*exp(x^2)+2), x) = (1/2+2*2^(1/2))*x^2-1/2*ln(exp(x^2)+1)-2^(1/2)*ln((exp(x^2))^2+2)
Int((x*exp(2*x^2)+8*2^(1/2)*x*(exp(x^2)+1)+2*x)/(exp(3*x^2)+exp(2*x^2)+2*exp(x^2)+2), x) = (1/2+2*2^(1/2))*x^2-1/2*ln(exp(x^2)+1)-2^(1/2)*ln((exp(x^2))^2+2)
 

>
 

Polynomial Part (exp extension) 

For the integration of the "polynomial part", the integrand is of the form    with    in   , where    is an exponential extension.  We can conclude that 

. 

 

Note that the latter summation indicates that some new log extensions may arise. 

 

Differentiating and equating coefficients of powers of the transcendental symbol , we get: 

         A[j] = B[j]^`'`+j*u^`'`*B[j]  ,   for  

         A[0] = (B[0]^`*`)^`'` 

where   . 

Solving the latter equation for    requires a recursive integration:    where the integrand lies in the field   .  For the general case,   , the equation to be solved for    is known as a Risch differential equation.  This may sound like a backwards step to have reduced an integration problem to the solution of a differential equation!  However, the problem can be solved because we must look for a solution in the field    only.  Nonetheless, this is a difficult problem, in general, for which a complete solution was presented in [Bronstein90a].  See also [Bronstein97]. 

 

Example 1.14 

The integral 

> restart;
 

> Int(exp(-x^2), x);
 

Int(exp(-x^2), x) 

has integrand    in the function field where . 

The solution must take the form    where in is a solution of the Risch differential equation  B[1]^`'`-2*x*B[1] = 1 . 

Since must be a rational function in , one first argues that it must be a polynomial in . This follows because if   had a nontrivial denominator then B[1]^`'`  would have a higher-degree denominator and these denominators could not cancel out to correspond to the right hand side of the differential equation which is the constant 1 .  So assume that    is a nonzero polynomial in with    where   .  But then taking the degree of each side of the differential equation, we get    which is a contradiction.  Hence the given Risch differential equation has no solution in the field    from which we conclude that the original integral is not elementary. 

>
 

Comments on algebraic and mixed extensions 

In the algorithm presented above we considered only transcendental elementary functions. The Risch algorithm for elementary functions also deals with algebraic extensions. For example, if the integral to be computed is    then the integrand lies in the elementary function field    where    is an algebraic extension of and    is a transcendental extension of . The Risch algorithm proceeds generally in the same manner as discussed above except that there are some different technical details (some of them involving concepts from advanced algebra) for algebraic extensions in the most general case. Some references which discuss the integration of elementary functions for the case of algebraic extensions, and mixed transcendental and algebraic extensions, are [Trager84] and [Bronstein90b]. 

 

Comments on non-elementary extensions 

The power of the Risch algorithm to determine conclusively whether or not a given elementary function has an elementary antiderivative is impressive, in principle. However in most practical problems where the operation of integration arises, it is quite unsatisfactory to receive as a result: "the integral cannot be expressed in elementary terms". For example, the Risch algorithm proves that    cannot be expressed as an elementary function (see Example 1.14) but in a larger function field the integral can be expressed: 

> Int(exp(-x^2), x) = int(exp(-x^2), x);
 

Int(exp(-x^2), x) = 1/2*Pi^(1/2)*erf(x) 

where a special function, the error function, arises. Another case is the following integral which in Example 1.12 was proved to be non-elementary: 

> Int(ln(ln(x)), x) = int(ln(ln(x)), x);
 

Int(ln(ln(x)), x) = ln(ln(x))*x+Ei(1, -ln(x)) 

where another special function, the exponential integral, arises. 

>
 

 

It would be ideal if we could extend the elementary function field by an arbitrary number of special functions, as new transcendental extensions, and have a corresponding extended Risch algorithm as a decision procedure for the extended field. At the present time, decision procedures have not been developed for integration in function fields containing many of the commonly-used special functions. However, decision procedures have been developed for some special functions. Early work in this regard is reported in [Cherry85], [Cherry86] where decision procedures are developed for the error function and the logarithmic integral. Additional examples of integrals which can be computed in this context are the following two integrals. 

 


 

 

 

 

See [Bronstein97] for a presentation of the state-of-the-art of integration algorithms for transcendental functions. 

Symbolic Solution of Definite Integrals 

Fundamental Theorem of Calculus: practical issues 

We turn now to the problem of computing a definite integral in closed form.  The first concept is that if we are able to express the indefinite integral (antiderivative) then the Fundamental Theorem of Calculus can be applied (under appropriate conditions) to compute the value of the definite integral. In it simplest form, if has antiderivative then   . 

The first problem we encounter with this formula for the value of the definite integral is that it may not be possible to evaluate directly or , but rather it is the limit (an appropriate one-sided limit) which must be computed at each endpoint. Specifically, the formula becomes (suppose that ) : 

 . 

 

Example 2.1 

> restart;
 

> f := ln(x):
 

We wish to compute the definite integral 

> Int(f, x=0..2);
 

Int(ln(x), x = 0 .. 2) 

We can compute the antiderivative 

> F := int(f, x);
 

x*ln(x)-x 

but direct evaluation of the antiderivative at encounters a logarithmic singularity. However, by taking limits we can compute the result as follows. 

> limit(F, x=2, left) - limit(F, x=0, right);
 

2*ln(2)-2 

Of course, the integration procedure in Maple will do this computation automatically. 

> int(f, x=0..2);
 

2*ln(2)-2 

>
 

 

We see that the computation of definite integrals requires the ability to compute limits. In general, computing limits is a nontrivial task. Fortunately, very powerful algorithms are now known for computing limits based on the expansion of functions in generalized series. Once we have expressed a function in a generalized series expansion then the limit can be determined from the leading term of the expansion. 

 

Example 2.2 

> g := sin(x)/x;
 

sin(x)/x 

> series(g, x=0);
 

series(1-1/6*x^2+1/120*x^4+O(x^5),x,5) 

From the series expansion it is clear what is the limit at . 

> Limit(g, x=0) = limit(g, x=0);
 

Limit(sin(x)/x, x = 0) = 1 

 

Another example: 

 

> g := x^x;
 

x^x 

> series(g, x=0, 3);
 

series(1+ln(x)*x+1/2*ln(x)^2*x^2+O(x^3),x,3) 

> Limit(g, x=0) = limit(g, x=0);
 

Limit(x^x, x = 0) = 1 

 

And another example: 

 

> g := ln(1-cos(x^2))/(ln(x)*arctan(sqrt(1-x^2)));
 

ln(1-cos(x^2))/(ln(x)*arctan((1-x^2)^(1/2))) 

> series(g, x=0, 4);
 

series(4*(-ln(2)+4*ln(x))/(ln(x)*Pi)-4*(ln(2)-4*ln(x))/(ln(x)*Pi^2)*x^2+O(x^4),x,4)
series(4*(-ln(2)+4*ln(x))/(ln(x)*Pi)-4*(ln(2)-4*ln(x))/(ln(x)*Pi^2)*x^2+O(x^4),x,4)
 

> Limit(g, x=0) = limit(g, x=0);
 

Limit(ln(1-cos(x^2))/(ln(x)*arctan((1-x^2)^(1/2))), x = 0) = 16/Pi 

>
 

 

The computation of generalized series expansions, and the computation of limits, requires very sophisticated techniques in the most general case. Some work on this problem was reported in [GeddesGonnet89]. More recent work which develops the theoretical foundation and presents practical algorithms can be found in [Salvy91], [Salvy92], [Richardson96]. 

 

A difficult  problem which arises in the computation of definite integrals is that the Fundamental Theorem of Calculus can be applied in the manner discussed above only if the integrand and its antiderivative are continuous on the interval . Since the form of antiderivative computed by the Risch integration algorithm can contain logarithmic functions, without special care the condition of continuity may be violated as discussed in [Bronstein97]. See also [Jeffrey93], [Jeffrey97] on the problem of computing continuous antiderivatives. 

 

Example 2.3 

The following example is discussed in [Bronstein97]. Suppose that the integral to be computed is 

> f := (x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4):
 

> Int(f, x=1..2);
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x = 1 .. 2) 

It can be verified that the integrand is continuous and positive on the real line, and hence the value of the definite integral must be a positive real number. Applying the integration algorithm in the form discussed in this presentation, the indefinite integral gets expressed in the following form. 

> F := I/2*ln(x^3+I*x^2-3*x-2*I) - I/2*ln(x^3-I*x^2-3*x+2*I);
 

1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
 

That is, 

> Int(f, x) = F;
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x) = 1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x) = 1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
 

It can easily be verified that the derivative of    is the integrand    and therefore this is a correct formal antiderivative. However, the differential algebra point of view used in developing the integration algorithm takes no account of the analytic concept of branch cuts of logarithmic functions. In this particular example, if we blindly apply the Fundamental Theorem of Calculus we get the following incorrect result for the definite integral. 

> Int(f, x=1..2) = limit(F, x=2, left) - limit(F, x=1, right);
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x = 1 .. 2) = -5/4*Pi+arctan(1/2) 

> evalf(rhs(%));
 

-3.463343209 

This has yielded a value for the integral which is real, but negative, whereas we know that the correct answer must be positive. The presentation in [Bronstein97] shows how to ensure that the integration algorithm computes a continuous antiderivative for this type of problem. In this case, a continuous antiderivative is 

> F_continuous := arctan((x^5 - 3*x^3 + x)/2) + arctan(x^3) + arctan(x);
 

arctan(1/2*x^5-3/2*x^3+1/2*x)+arctan(x^3)+arctan(x)
arctan(1/2*x^5-3/2*x^3+1/2*x)+arctan(x^3)+arctan(x)
 

By differentiating, we see that this is a correct antiderivative of the original integrand . 

> simplify( diff(F_continuous, x) );
 

(x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4) 

 

This time, direct application of the Fundamental Theorem of Calculus is valid and we obtain the following result for the definite integral. 

 

> Int(f, x=1..2) = limit(F_continuous, x=2, left) - limit(F_continuous, x=1, right);
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x = 1 .. 2) = arctan(5)+arctan(8)+arctan(2)+arctan(1/2)-1/2*Pi
Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x = 1 .. 2) = arctan(5)+arctan(8)+arctan(2)+arctan(1/2)-1/2*Pi
 

> evalf(rhs(%));
 

2.819842099 

>
 

 

A general technique which can be applied when the antiderivative is not guaranteed to be continuous is to find the points of discontinuity of the antiderivative and then to express the integral separately on each subinterval where it is continuous. By computing the appropriate one-sided limits on each subinterval, the correct definite integral is obtained. 

 

Example 2.4 

In Example 2.3 we had the following discontinuous antiderivative. 

> Int(f, x) = F;
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x) = 1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x) = 1/2*I*ln(x^3+I*x^2-3*x-2*I)-1/2*I*ln(x^3-I*x^2-3*x+2*I)
 

In Maple, the following command will determine the points of discontinuity over the whole real line. 

> discont(F, x);
 

{RootOf(-2+_Z^2, -1.414213562), RootOf(-2+_Z^2, 1.414213562)}
{RootOf(-2+_Z^2, -1.414213562), RootOf(-2+_Z^2, 1.414213562)}
 

> allvalues(%);
 

{2^(1/2), -2^(1/2)} 

 

The above notation is expressing the fact that there are two points of discontinuity which are the two roots of a quadratic polynomial. Since we are interested in the definite integral over the interval there is just one relevant point of discontinuity: 

> c := sqrt(2);
 

2^(1/2) 

and the endpoints of integration are 

> a := 1;  b := 2;
 

1 

2 

 

The correct value of the definite integral on can therefore be computed by using the fact that 

 

and noting that the antiderivative    is continuous on each of the two subintervals. 

This leads to the following limit computations for the definite integral. 

 

> Int(f, x=a..b) = limit(F, x=c, left) - limit(F, x=a, right) +
                limit(F, x=b, left) - limit(F, x=c, right);
 

Int((x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4), x = 1 .. 2) = 3/4*Pi+arctan(1/2) 

> evalf(rhs(%));
 

2.819842099 

>
 

Methods for Special Functions: Generalized hypergeometric function and Meijer G function 

Many non-elementary functions appear in the literature of the mathematical sciences, with names such as Bessel functions, Legendre functions, exponential integrals, elliptic integrals, et cetera. The list of such special functions is quite long. For classes of functions where we have no Risch-like algorithm to compute the indefinite integral, how can we compute integrals that involve such functions which arise in practical problems (assuming that we wish to obtain a closed-form symbolic result if possible)? 

 

Various special formulas can be programmed into a computer algebra system for integrals which appear in the literature. A particular approach discussed in [Geddes90] derives classes of integral formulas by applying differentiation to the integral definition of various special functions. A more general technique which is capable of obtaining results for a large number of integrals, most often definite integrals on the interval , is to convert the integrand into one of the higher functions: the generalized hypergeometric function or the Meijer G function. We do not have space here to go into details about these functions or about this approach to computing integrals, but we show some examples to illustrate the concept. 

 

The generalized hypergeometric function and the Meijer G function are discussed in [PBM90]. The same series of books presents a large number of integral formulas involving special functions which computer algebra systems should know how to compute. At the present time, computer algebra systems cannot compute many of the integrals found in these books. 

 

The general approach being illustrated here to compute a special class of integrals is as follows. 

  • Convert the integrand to a representation in terms of Meijer G functions.
 

  • Apply a formula to express the integral in terms of higher functions.
 

  • Convert the result from a representation in terms of higher functions to a representation in terms of more standard functions (if possible).
 

Note that for definite integrals on  where the integrand involves a product of Meijer G functions, various formulas are available to express the integral. For the problem of converting from a representation in terms of higher functions to a representation in terms of more standard functions (elementary functions and special functions), see [Roach96], [Roach97]. 

 

Example 2.5 

> restart;
 

> assume(c::real);  interface(showassumed=0):
 

>
 

> f1 := x^(s-1)*exp(-p*x^4)*erfi(c*x)*erf(c*x):
 

> Int(f1, x=0..infinity);
 

Int(x^(s-1)*exp(-p*x^4)*erfi(c*x)*erf(c*x), x = 0 .. infinity) 

> result1 := value(%);
 

p^(-1/4*s-1/2)*c^2*hypergeom([1/2, 1, 1/2+1/4*s], [3/4, 5/4, 3/2], 1/4*c^4/p)*GAMMA(1/2+1/4*s)/Pi
p^(-1/4*s-1/2)*c^2*hypergeom([1/2, 1, 1/2+1/4*s], [3/4, 5/4, 3/2], 1/4*c^4/p)*GAMMA(1/2+1/4*s)/Pi
p^(-1/4*s-1/2)*c^2*hypergeom([1/2, 1, 1/2+1/4*s], [3/4, 5/4, 3/2], 1/4*c^4/p)*GAMMA(1/2+1/4*s)/Pi
 

 

The method used was first to convert the integrand into form. 

 

> f1new := convert(f1, MeijerG, x);
 

-I*x^(s-1)*exp(-p*x^4)*MeijerG([[1], []], [[1/2], [0]], -c^2*x^2)*MeijerG([[1], []], [[1/2], [0]], c^2*x^2)/Pi
-I*x^(s-1)*exp(-p*x^4)*MeijerG([[1], []], [[1/2], [0]], -c^2*x^2)*MeijerG([[1], []], [[1/2], [0]], c^2*x^2)/Pi
-I*x^(s-1)*exp(-p*x^4)*MeijerG([[1], []], [[1/2], [0]], -c^2*x^2)*MeijerG([[1], []], [[1/2], [0]], c^2*x^2)/Pi
 

 

Now when we apply the command, it uses a known formula to express such a definite integral involving the product of two functions. 

 

> int(f1new, x=0..infinity);
 

p^(-1/4*s-1/2)*c^2*hypergeom([1/2, 1, 1/2+1/4*s], [3/4, 5/4, 3/2], 1/4*c^4/p)*GAMMA(1/2+1/4*s)/Pi
p^(-1/4*s-1/2)*c^2*hypergeom([1/2, 1, 1/2+1/4*s], [3/4, 5/4, 3/2], 1/4*c^4/p)*GAMMA(1/2+1/4*s)/Pi
 

 

which is equal to . 

> simplify(% - result1);
 

0 

Of course, for particular values of the parameters we may compute a numerical value. 

 

> eval(result1, {s=4, p=1, c=1});
 

1/2*hypergeom([1/2, 1], [3/4, 5/4], 1/4)/Pi^(1/2) 

> evalf(%);
 

.3235544850 

>
 

Example 2.6 

> restart;
 

> assume(b>0, y>0);  interface(showassumed=0):
 

>
 

> f2 := x^v/(x^2+y^2)*BesselK(v,b*x):
 

> Int(f2, x=0..infinity);
 

Int(x^v*BesselK(v, b*x)/(x^2+y^2), x = 0 .. infinity) 

> result2 := value(%);
 

1/4*y^(v-1)*(-Pi^2*BesselY(-v, b*y)*sec(Pi*v)+Pi^2*StruveH(-v, b*y)*sec(Pi*v))
1/4*y^(v-1)*(-Pi^2*BesselY(-v, b*y)*sec(Pi*v)+Pi^2*StruveH(-v, b*y)*sec(Pi*v))
1/4*y^(v-1)*(-Pi^2*BesselY(-v, b*y)*sec(Pi*v)+Pi^2*StruveH(-v, b*y)*sec(Pi*v))
 

 

Note that the result of converting the integrand into form is as follows. 

 

> f2new := convert(f2, MeijerG, x);
 

1/2*x^v*MeijerG([[], []], [[1/2*v, -1/2*v], []], 1/4*b^2*x^2)/(x^2+y^2)
1/2*x^v*MeijerG([[], []], [[1/2*v, -1/2*v], []], 1/4*b^2*x^2)/(x^2+y^2)
 

> int(f2new, x=0..infinity);
 

1/4*y^(v-1)*(-Pi^2*BesselY(-v, b*y)*sec(Pi*v)+Pi^2*StruveH(-v, b*y)*sec(Pi*v))
1/4*y^(v-1)*(-Pi^2*BesselY(-v, b*y)*sec(Pi*v)+Pi^2*StruveH(-v, b*y)*sec(Pi*v))
 

 

which is equal to result2 . 

> simplify(% - result2);
 

0 

>
 

 

Research work is continuing with the goal of bringing the knowledge about integral formulas known in the mathematical literature, into computer algebra systems. We anticipate that a large class of integrals appearing in the book [PBM90], for example, can be computed by the approach discussed above;  namely, conversion of the integrand to a Meijer G function representation followed by application of general formulas for the integration of products of Meijer G functions. 

 

References 

[Bronstein90a]  M. Bronstein, The transcendental Risch differential equation. Journal of Symbolic Computation 9, 1990, pp. 49-60. 

 

[Bronstein90b]  M. Bronstein, On the integration of elementary functions. Journal of Symbolic Computation 9, 1990, pp. 117-173. 

 

[Bronstein97]  M. Bronstein, Symbolic Integration I: Transcendental Functions. Springer-Verlag, Berlin, 1997. 

 

[Cherry85]  G. Cherry, Integration in Finite Terms with Special Functions: the Error Function. Journal of Symbolic Computation 1, 1985, pp. 283-302. 

 

[Cherry86]  G. Cherry, Integration in Finite Terms with Special Functions: the Logarithmic Integral. SIAM Journal on Computing 15, 1986, pp. 1-21. 

 

[Geddes90]  K.O. Geddes, M.L. Glasser, R.A. Moore and T.C. Scott, Evaluation of classes of definite integrals involving elementary functions via differentiation of special functions. Applicable Algebra in Engineering, Communication and Computing 1 (2), 1990, pp. 149-165. 

 

[Geddes92]  K.O. Geddes, S.R. Czapor and G. Labahn, Algorithms for Computer Algebra. Kluwer Academic Publishers, Boston, 1992. 

 

[GeddesGonnet89]  K.O. Geddes and G.H. Gonnet, A new algorithm for computing symbolic limits using hierarchical series. Appears in Symbolic and Algebraic Computation, P. Gianni (ed.), Lecture Notes in Computer Science, No. 358, Springer-Verlag, Berlin, 1989, pp. 490-495. 

 

[Jeffrey93]  D.J. Jeffrey, Integration to obtain expressions valid on domains of maximum extent. Proceedings of ISSAC'93, M. Bronstein (ed.), ACM Press, New York, 1993, pp. 34-41. 

 

[Jeffrey97]  D.J. Jeffrey, Rectifying transformations for the integration of rational trigonometric functions. Journal of Symbolic Computation 24, 1997, pp. 563-573. 

 

[PBM90]  A.P. Prudnikov, Y. Brychkov and O. Marichev, Integrals and Series, Volume 3: More Special Functions. Gordon and Breach Science Publishers, 1990. 

 

[Richardson96]  D. Richardson, B. Salvy, J. Shackell and J. Van derHoeven, Asymptotic expansions of exp-log functions. Proceedings of ISSAC'96, Y.N. Lakshman (ed.), ACM Press, New York, 1996, pp. 309-313. 

 

[Roach96]  K.B. Roach, Hypergeometric Function Representations. Proceedings of ISSAC '96, Y.N. Lakshman (ed.), ACM Press, New York, 1996, pp 301-308. 

 

[Roach97]  K.B. Roach, Meijer G Function Representations. Proceedings of ISSAC '97, W.W. Kuechlin (ed.), ACM Press, New York, 1997, pp. 205-211.
 

[Salvy91]  B. Salvy, Examples of automatic asymptotic expansions. SIGSAM Bulletin 25 (2), 1991, pp. 4-17. 

 

[Salvy92]  B. Salvy, General asymptotic scales and computer algebra. Appears in Asymptotic and Numerical Methods for Partial Differential Equations, Critical Parameters and Domain Decomposition, H. Kaper and M. Garbey (ed.), Kluwer Academic Publishers, 1992, pp. 255-266. 

 

[Trager84]  B.M. Trager, On the integration of algebraic functions. Ph.D. Thesis, Computer Science, MIT, 1984.