Revisiting numeric / symbolic indefinite integration of rational functions , and extensions

We know we can solve this problem: Given any rational function f(x) = p(x)/q(x), where p and q are univariate polynomials over the rationals, compute its indefinite integral, using if necessary, algebraic numbers. But in many circumstances an approximate result is more likely to be of use. Furthermore, it is plausible that it would be more useful to solve the problem to allow definite integration, or introduce additional parameters so that we can solve multiple definite integrations. How can a computer algebra system best answer the more useful questions? Finally, what if the integrand is not a ratio of polynomials, but something more challenging? Consider a question of the form “Please give me F the indefinite integral of f(x), a mathematical function of x.” There is a belief among advocates of computer algebra systems, as well as among teachers of calculus, that there is an advantage to providing F as a formula, especially when the formula is expressible in terms of “elementary” functions. We suspect that many calculus teachers believe that the integration of f(x) when f is rational can be done algorithmically by methods given in every calculus book, in spite of the fact that these methods work only for sufficiently low-degree denominators or other special factorable cases. A possibly more useful answer for many users of computer systems for mathematics, is a computational procedure F (a, b) — perhaps a very fast subroutine compiled to machine language — which for any particular pair of numerical arguments a and b returns a number for the integral from a to b. The internal structure of F could be opaque, but the conventional technique would repeatedly call a subroutine that computes the value of f(x), and the program F (a, b) would use some kind of quadrature program. There are dozens of well-known ones as well as procedures for choosing amongst them. http://www.netlib.org/quadpack/. See also [4] for implementations of some programs that gain some versatility (as they likely lose in speed) by implementation in a computer algebra system. Alternatively the program F (a, b) might be a program that evaluates an algebraic expression, “the exact indefinite integral” at a and b, and computes the difference, relying on the Fundamental Theorem of Integral Calculus and the continuity of f . Or perhaps it evaluates the result of expanding f as a Taylor series and integrating term by term. The numerical approach from pure quadrature is very powerful and well-supported by carefully constructed subroutine libraries. Our own minor contribution in this area, the implementation in arbitrary precision floating-point of some simple tools for integration, is described elsewhere [4]. For the remainder of this paper let us assume that for some reason (speed, accuracy, compactness, presence of parameters), that the quadrature route is not appropriate. That is, we wish to somehow create the black-box result F (a, b) by looking at the symbolic representation of f . In particular we will start with a univariate rational function f(x). 1 Integrate f(x) = p(x)/q(x) semi-symbolically Force q to be monic, if necessary by multiplying p by a suitable factor.