#198 Incomplete integration


integrate(sin(3*asin(x))) gives


which contains 'INTEGRATE(x-x^3,x), which is obviously
integrable. ev(...,integrate) successfully completes the
integration, and ratsimp gets it down to something nice.
Similar things happen with sin(a*asin(x)) for other a's.

Note that trigexpand(sin(3*asin(x))) = 3*x*(1-x^2)-x^3.

Low priority, because the answer is correct (if not ideal)
and can easily be fixed.


  • Robert Dodier

    Robert Dodier - 2006-04-10
    • labels: --> Lisp Core - Integration
  • Raymond Toy

    Raymond Toy - 2006-04-10

    Logged In: YES

    Tracing rischint indicates that this is a problem in the
    Risch integrator.

  • Dieter Kaiser

    Dieter Kaiser - 2009-11-08

    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 again to avoid the construction of solvable 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)

    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

  • Dieter Kaiser

    Dieter Kaiser - 2009-12-21

    Because of revision 1.18 of risch.lisp and revision 1.53 of sin.lisp we get the following results:

    This is the example of this bug report:

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

    One more example which is related and works too:

    (%i3) integrate(sin(4*asin(x)),x);
    (%o3) -(15*((1-x^2)^(3/2)/5-x^2*(1-x^2)^(3/2)/5)

    This integrals work in addition:

    (%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

    Closing this bug report as fixed.
    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2009-12-21
    • status: open --> closed

Log in to post a comment.