Incomplete integration in risch



I have worked on the bug report ID: 655270 "Incomplete integration". I
think I have got the underlying problem. A first small extension to
improve some types of integrals is possible. A more general solution
might be possible, but I think it is necessary to improve risch and the
integrator to allow more recursive calls.

This is again the reported bug:

(%i2) integrate(sin(3*asin(x)),x);
(%o2) (12*'integrate(x-x^3,x)-5*x^4+6*x^2-2)/8

We get the complete result after an extra evaluation:

(%i3) %,nouns;
(%o3) (-5*x^4+12*(x^2/2-x^4/4)+6*x^2-2)/8

The risch algorithm adds up integrals which are not handled at some
point of the algorithm. To do this the risch algorithm calls the routine
rischnoun. The problem is that rischnoun generates solvable integrals.
These integrals are part of the result of risch.

In general it is not possible to call the integrator or risch in
rischnoun to avoid the construction of solveable integrals, because we
can run into infinite loops. One small extension is possible
immediately. We can look for a rational expression in rischnoun and call
ratint to get the integral. The following code shows this:

(defun rischnoun (exp1 &optional (exp2 exp1 exp2p))
  (let (($logsimp t) ($%e_to_numlog t))
    (unless exp2p (setq exp1 (rzero)))
    (if (ratp (setq exp2 (resimplify (disrep exp2))) intvar)
        ;; A rational expression which can be integrated by ratint.
        (setq exp2 (ratint exp2 intvar))
        ;; A more general integrand. Return a noun form.
        (setq exp2 (list '(%integrate) exp2 intvar)))
    `(,exp1 ,exp2)))

That is the example of the bug report:

(%i5) integrate(sin(3*asin(x)),x);
(%o5) -(4*x^4-6*x^2+1)/4

More results for an odd factor in the integrand:

(%i10) integrate(sin(5*asin(x)),x);
(%o10) (32*x^6-60*x^4+30*x^2-1)/12
(%i11) integrate(sin(7*asin(x)),x);
(%o11) -(96*x^8-224*x^6+168*x^4-42*x^2+1)/12

But it don't work completely for an even factor in the integrand. The
reason is, that one of the integrands is not a rational expression:

(%i12) integrate(sin(2*asin(x)),x);
(%o12) (sqrt(1-x)*sqrt(x+1)*(5*x^2-5)-3*'integrate(sqrt(1-x)*x*sqrt(x
+1),x))/6
(%i13) integrate(sin(4*asin(x)),x);
(%o13) -(15*'integrate(sqrt(1-x)*sqrt(x+1)*(x^3-x),x)
        +sqrt(1-x)*sqrt(x+1)*(93*x^4-106*x^2+13))
        /60

On the other hand we get more results, e.g. the following integrals now
work:

(%i7) integrate(exp(asinh(x)),x);
(%o7) log(sqrt(x^2+1)+x)/2+x*sqrt(x^2+1)/2+x^2/2
(%i8) integrate(exp(acosh(x)),x);
(%o8) -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
(%i9) integrate(exp(atanh(x)),x);
(%o9) -%i*log(sqrt(1-x^2)+%i*x)-sqrt(1-x^2)

To get a more general solution we had to call the integrator in
rischnoun again. To do this it is necessary to extend the integrator and
risch with a mechanism to avoid infinite loops.

Dieter Kaiser