Opened 10 months ago

Last modified 6 days ago

#25904 new defect

integrate produces wrong results due to loading of abs_integrate in Maxima interface

Reported by: gh-nasser1 Owned by:
Priority: major Milestone: sage-8.4
Component: symbolics Keywords: integrate, maxima, abs_integrate
Cc: rws, kcrisman, tmonteil Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

I was told to report this here.

There seems to be an old bug related to this issue https://trac.sagemath.org/ticket/12731

When using default setting of SageMath for integrate, Maxima produces many wrong integral results.

Here are few examples of many I have:

Example 1


    SageMath version 8.3.rc1, Release Date: 2018-07-14

    sage: var('x e a b f c d m');
    sage: integrate ((d*sin (f*x + e) + c)^(3/2)*(b*sin (f*x + e) + a)^m, x)
    1/9*(c^3*sin(9/2*f*x + 9/2*e) - 3*c^3*sin(3/2*f*x + 3/2*e))*2^(-m - 5/2)/f

The above is clearly wrong, since the anti dropped/missing the parameters d,a,b in the integrand.

in Maxima

    Maxima 5.41.0 http://maxima.sourceforge.net
    using Lisp ECL 16.1.2

    (%i1) domain:complex$    
    (%i2) domain;
    (%o2)                               complex

    (%i3) integrate ((d*sin (f*x + e) + c)^(3/2)*(b*sin (f*x + e) + a)^m, x);
                  /
                  [                     m                     3/2
    (%o3)         I (b sin(f x + e) + a)  (d sin(f x + e) + c)    dx
                  ]
                  /

Example 2


    sage: integrate(sqrt(d*sin (f*x + e) + c)*(b*sin (f*x + e) + a)^m, x,algorithm="maxima")
    1/3*(c*sin(3/2*f*x + 3/2*e) - 3*c*sin(1/2*f*x + 1/2*e))*2^(-m - 3/2)/f

The above is clearly wrong, since the anti dropped/missing the parameters d,a,b in the integrand.

Using Maxima

    (%i7) integrate (sqrt (d*sin (f*x + e) + c)*(b*sin (f*x + e) + a)^m, x);
                  /
                  [                     m
    (%o7)         I (b sin(f x + e) + a)  sqrt(d sin(f x + e) + c) dx
                  ]
                  /

The above is the correct result, since this integral is supposed to be non integrable.

Example 3


    sage: integrate (x*sqrt (cos (b*x + a)), x,algorithm="maxima")
    1/840*(70*sqrt(2)*a*(sin(3/2*b*x + 3/2*a) - 3*sin(1/2*b*x + 1/2*a)) - sqrt(2)*(15*sin(7/2*b*x + 7/2*a) - 21*sin(5/2*b*x + 5/2*a) - 35*sin(3/2*b*x + 3/2*a) + 105*sin(1/2*b*x + 1/2*a)))/b^2

The above result did not verify by differentiating the antiderivative.

Using Maxima

    (%i9) integrate (x*sqrt (cos (b*x + a)), x);                 
                               /
                               [
    (%o9)                      I x sqrt(cos(b x + a)) dx
                               ]
                               /

The above is the correct result, since this integral is supposed to be non integrable.

example 4


    sage: integrate(x*cos(b*x + a)^(3/2), x, algorithm="maxima")
    1/349920*(243*sqrt(2)*a*(3*sin(15/2*b*x + 15/2*a) + 5*sin(9/2*b*x + 9/2*a) - 30*sin(3/2*b*x + 3/2*a)) - 20*sqrt(2)*(2*(81*(b*x + a)^2 - 8)*cos(9/2*b*x + 9/2*a) - 162*(9*(b*x + a)^2 - 8)*cos(3/2*b*x + 3/2*a) + 9*(27*(b*x + a)^3 - 8*b*x - 8*a)*sin(9/2*b*x + 9/2*a) - 243*(3*(b*x + a)^3 - 8*b*x - 8*a)*sin(3/2*b*x + 3/2*a)))/b^2

The above result did not verify by differentiating the antiderivative.

Using Maxima

    (%i10) integrate(x*cos(b*x + a)^(3/2), x);
                                /
                                [               3/2
    (%o10)                      I x cos(b x + a)    dx
                                ]
                                /

The above is the correct result, since this integral is supposed to be non integrable.

Example 5


    sage: integrate(cos (x)^(3/2)/x^3, x, algorithm="maxima")
    -9/512*sqrt(2)*(25*gamma(-2, 15/2*I*x) + 9*gamma(-2, 9/2*I*x) - 2*gamma(-2, 3/2*I*x) - 2*gamma(-2, -3/2*I*x) + 9*gamma(-2, -9/2*I*x) + 25*gamma(-2, -15/2*I*x))

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i11) integrate (cos (x)^(3/2)/x^3, x);
                                    /       3/2
                                    [ cos(x)
    (%o11)                          I --------- dx
                                    ]     3
                                    /    x

The above is the correct result, since this integral is supposed to be non integrable.

Example 6


    sage: integrate(cos(d*x + c)^(7/3)/sqrt(b*cos(d*x + c) + a), x,algorithm="maxima")
    1/6366178138320*2^(1/6)*(61213251330*cos(13/2*d*x + 13/2*c) - 72342933390*cos(11/2*d*x + 11/2*c) - 82321269030*cos(29/6*d*x + 29/6*c) + 140430400110*cos(17/6*d*x + 17/6*c) - 217028800170*cos(11/6*d*x + 11/6*c) - 341045257410*cos(7/6*d*x + 7/6*c) + 23405066685*sin(17/2*d*x + 17/2*c) - 26525742243*sin(15/2*d*x + 15/2*c) - 29113619535*sin(41/6*d*x + 41/6*c) + 41160634515*sin(29/6*d*x + 29/6*c) - 44209570405*sin(9/2*d*x + 9/2*c) - 51898191345*sin(23/6*d*x + 23/6*c) + 56840876235*sin(7/2*d*x + 7/2*c) - 62824126365*sin(19/6*d*x + 19/6*c) + 70215200055*sin(17/6*d*x + 17/6*c) + 1193658400935*sin(1/6*d*x + 1/6*c))/(a*d)

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i12) integrate (cos (d*x + c)^(7/3)/sqrt (b*cos (d*x + c) + a), x);
                             /                 7/3
                             [     cos(d x + c)
    (%o12)                   I ------------------------ dx
                             ] sqrt(b cos(d x + c) + a)
                             /

The above is the correct result, since this integral is supposed to be non integrable.

Example 7


    sage: integrate(cos(d*x + c)^(2/3)/sqrt(b*cos(d*x + c) + a), x,algorithm="maxima")
    -1/54264*2^(5/6)*(1071*cos(19/6*d*x + 19/6*c) + 1197*cos(17/6*d*x + 17/6*c) - 2261*cos(3/2*d*x + 3/2*c) - 2907*cos(7/6*d*x + 7/6*c) + 6783*cos(1/2*d*x + 1/2*c) + 20349*cos(1/6*d*x + 1/6*c))/(a*d)

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i13) integrate (cos (d*x + c)^(2/3)/sqrt (b*cos (d*x + c) + a), x);
                             /                 2/3
                             [     cos(d x + c)
    (%o13)                   I ------------------------ dx
                             ] sqrt(b cos(d x + c) + a)
                             /

The above is the correct result, since this integral is supposed to be non integrable.

Example 8


    sage: var('B A f x e b a c m')
    (B, A, f, x, e, b, a, c, m)

    sage: integrate((B*cos(f*x+e)+A)*(b*cos(f*x+e)+a)^(3/2)*(c*cos(f*x+e))^m,x)
    1/3465*(385*(a^3*c^m*sin(9/2*f*x + 9/2*e) - 3*a^3*c^m*sin(3/2*f*x + 3/2*e))*2^(-m - 5/2)*A + 4*(231*a^3*sin(15/2*f*x + 15/2*e) + 630*a^3*sin(11/2*f*x + 11/2*e) - 770*a^3*sin(9/2*f*x + 9/2*e) + 495*a^3*sin(7/2*f*x + 7/2*e) - 2079*a^3*sin(5/2*f*x + 5/2*e) + 1155*a^3*sin(3/2*f*x + 3/2*e))*2^(-m - 13/2)*B)/f

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i15) integrate((B*cos(f*x+e)+A)*(b*cos(f*x+e)+a)^(3/2)*(c*cos(f*x+e))^m,x);
           /
           [                 m                                          3/2
    (%o15) I (c cos(f x + e))  (B cos(f x + e) + A) (b cos(f x + e) + a)    dx
           ]
           /

The above is the correct result, since this integral is supposed to be non integrable.

Example 9


    sage: integrate((B*cos(f*x+e)+A)*sqrt(b*cos(f*x+e)+a)*(c*cos(f*x+e))^m,x)
    1/315*(105*(a*c^m*sin(3/2*f*x + 3/2*e) - 3*a*c^m*sin(1/2*f*x + 1/2*e))*2^(-m - 3/2)*A + (35*a*sin(9/2*f*x + 9/2*e) - 90*a*sin(7/2*f*x + 7/2*e) + 189*a*sin(5/2*f*x + 5/2*e) - 315*a*sin(3/2*f*x + 3/2*e) + 315*a*sin(1/2*f*x + 1/2*e))*2^(-m - 7/2)*B)/f

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i16) integrate((B*cos(f*x+e)+A)*sqrt(b*cos(f*x+e)+a)*(c*cos(f*x+e))^m,x);
           /
           [                 m
    (%o16) I (c cos(f x + e))  (B cos(f x + e) + A) sqrt(b cos(f x + e) + a) dx
           ]
           /

The above is the correct result, since this integral is supposed to be non integrable.

Example 10


    sage: integrate((B*cos(f*x+e)+A)*(b*cos(f*x+e)+a)^(3/2)*(c*sec(f*x+e))^m,x)
    -1/2520*sqrt(2)*(35*2^m*A^3*a*sin(9/2*f*x + 9/2*e) + 630*(A^3*B - A^3*a)*2^m*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 + 2*sin(1/2*f*x + 1/2*e) + 1) - 630*(A^3*B - A^3*a)*2^m*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 - 2*sin(1/2*f*x + 1/2*e) + 1) + 45*(2*A^3*B - A^3*a)*2^m*sin(7/2*f*x + 7/2*e) - 63*(2*A^3*B - 3*A^3*a)*2^m*sin(5/2*f*x + 5/2*e) + 105*(4*A^3*B - 5*A^3*a)*2^m*sin(3/2*f*x + 3/2*e) - 630*(4*A^3*B - 3*A^3*a)*2^m*sin(1/2*f*x + 1/2*e))/f

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i17) integrate((B*cos(f*x+e)+A)*(b*cos(f*x+e)+a)^(3/2)*(c*sec(f*x+e))^m,x);
           /
           [                                          3/2                 m
    (%o17) I (B cos(f x + e) + A) (b cos(f x + e) + a)    (c sec(f x + e))  dx
           ]
           /

The above is the correct result, since this integral is supposed to be non integrable.

Example 11


    sage: integrate((B*cos(f*x+e)+A)*sqrt(b*cos(f*x+e)+a)*(c*sec(f*x+e))^m,x)
    1/40*(20*sqrt(2)*(2^m*a*c^m*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 + 2*sin(1/2*f*x + 1/2*e) + 1) - 2^m*a*c^m*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 - 2*sin(1/2*f*x + 1/2*e) + 1) - 2^(m + 1)*a*c^m*sin(1/2*f*x + 1/2*e))*A + sqrt(2)*(5*2^(m + 2)*a*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 + 2*sin(1/2*f*x + 1/2*e) + 1) - 5*2^(m + 2)*a*log(cos(1/2*f*x + 1/2*e)^2 + sin(1/2*f*x + 1/2*e)^2 - 2*sin(1/2*f*x + 1/2*e) + 1) - 2^(m + 1)*a*sin(5/2*f*x + 5/2*e) + 5*2^(m + 1)*a*sin(3/2*f*x + 3/2*e) - 15*2^(m + 2)*a*sin(1/2*f*x + 1/2*e))*B)/f

The above result did not verify by differentiating the antiderivative.

Maxima:

    (%i18) integrate((B*cos(f*x+e)+A)*sqrt(b*cos(f*x+e)+a)*(c*sec(f*x+e))^m,x);
           /
           [                                                               m
    (%o18) I (B cos(f x + e) + A) sqrt(b cos(f x + e) + a) (c sec(f x + e))  dx
           ]
           /

The above is the correct result, since this integral is supposed to be non integrable.

reference: https://ask.sagemath.org/question/43088/integrate-results-that-are-different-from-using-maxima/

Change History (3)

comment:1 Changed 10 months ago by tmonteil

  • Cc tmonteil added

comment:2 Changed 10 months ago by kcrisman

Thank you! See also the list at wiki:symbolics.

Last edited 10 months ago by kcrisman (previous) (diff)

comment:3 Changed 6 days ago by chapoton

  • Keywords abs_integrate added
Note: See TracTickets for help on using tickets.