Some work on the risch integrator



I have committed code to get more results from the risch integrator (See
bug report ID: 655270 - "Incomplete integration"). For some integrands
solvable integrals were part of the result. Furthermore, we get complete
new results.

These are some examples:

(%i2) integrate(sin(3*asin(x)),x);
(%o2) -(4*x^4-6*x^2+1)/4
(%i3) integrate(sin(4*asin(x)),x);
(%o3) -(15*((1-x^2)^(3/2)/5-x^2*(1-x^2)^(3/2)/5)
       +sqrt(1-x)*sqrt(x+1)*(93*x^4-106*x^2+13))
       /60
(%i4) integrate(exp(asinh(x)),x);
(%o4) log(sqrt(x^2+1)+x)/2+x*sqrt(x^2+1)/2+x^2/2
(%i5) integrate(exp(acosh(x)),x);
(%o5) -log(2*sqrt(x^2-1)+2*x)/2+x*sqrt(x^2-1)/2+(x^2/2+x)/2+(x^2/2-x)/2
(%i6) integrate(exp(asech(x)),x);
(%o6) -log(2*sqrt(1-x^2)/abs(x)+2/abs(x))+(log(x)+x)/2+(log(x)-x)/2
                                         +sqrt(1-x^2)

To get the new results I have introduced code which allows to call the
general integrator from the risch integrator without the problem to run
into endless loops.

There are three issues with the testfile rtest_abs_integrate.mac. 

I think this result is correct too. The term x*signum(x) has already
simplified to abs(x):

/* Problem 34 */
integrate(cos(x^2)*x+unit_step(x),x);
/* Erroneous Result?:
(sin(x^2)+abs(x)+x)/2 */ 
/* Expected result: */
(x+x*signum(x)+sin(x^2))/2;

For the following we get a result with the gamma_incomplete function.

/* Problem 69 */
signum_to_abs(expand(integrate(diff(abs(x)*cos(x),x),x)));
/* Erroneous Result?:
(2*cos(x)*abs(x)+2*signum(x)*sin(x)
                +(%i*gamma_incomplete(2,-%i*x)-%i*gamma_incomplete(2,%
i*x))
                 *signum(x))
 /4 */ 
/* Expected result: */
cos(x)*abs(x);

To get the expected result we can expand the gamma function (we do not
need to expand the expression):

(%i10) signum_to_abs(integrate(diff(abs(x)*cos(x),x),x)),
       gamma_expand:true;
(%o10) cos(x)*abs(x)

The next result differs only slightly because of a different
simplification of the factor -5:

/* Problem 74 */
integrate(5*sin(3*x)*signum(3+x)/x,x);
/* Erroneous Result?:
-5*(%i*gamma_incomplete(0,3*%i*x)-%i*gamma_incomplete(0,-3*%i*x)
                                 +%i*gamma_incomplete(0,9*%i)
                                 -%i*gamma_incomplete(0,-9*%
i))*signum(3*x+9)
 /2 */ 
/* Expected result: */
(-5*%i
   *(-gamma_incomplete(0,-9*%i)+gamma_incomplete(0,9*%i)
                               -gamma_incomplete(0,-3*%i*x)
                               +gamma_incomplete(0,3*%i*x))*signum(9
+3*x))
 /2;

I will update the examples of rtest_abs_integrate.mac too.

Dieter Kaiser