Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

integrate results that are different from using maxima

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake, or overlooking something as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake, or overlooking something mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

(%i2) domain:complex;

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

                           /
                           [
(%o3)                      I x sqrt(cos(b x + a)) dx
                           ]
                           /

(%i4) load(abs_integrate);

ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) /usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac

(%i5)  integrate (x*sqrt (cos (b*x + a)), x);

                            5 (b x + a)            5 (b x + a)
(%o5) (((1260 (b x + a) sin(-----------) + 504 cos(-----------)
                                 2                      2
                      3 (b x + a)             3 (b x + a)
 + 2100 (b x + a) sin(-----------) + 1400 cos(-----------)) false
                           2                       2
           7 (b x + a)            5 (b x + a)            3 (b x + a)
 - 225 sin(-----------) + 315 sin(-----------) + 525 sin(-----------)
                2                      2                      2
            b x + a          5/2               5 (b x + a)
 - 1575 sin(-------))/(1575 2   ) - (a ((6 sin(-----------)
               2                                    2
          3 (b x + a)                 3 (b x + a)           b x + a
 + 10 sin(-----------)) false - 5 sin(-----------) + 15 sin(-------)))
               2                           2                   2
      3/2    2
/(15 2   ))/b
(%i6)

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases.

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

(%i2) domain:complex;

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

                           /
                           [
(%o3)                      I x sqrt(cos(b x + a)) dx
                           ]
                           /

(%i4) load(abs_integrate);

ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) /usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac

(%i5)  integrate (x*sqrt (cos (b*x + a)), x);

                            5 (b x + a)            5 (b x + a)
(%o5) (((1260 (b x + a) sin(-----------) + 504 cos(-----------)
                                 2                      2
                      3 (b x + a)             3 (b x + a)
 + 2100 (b x + a) sin(-----------) + 1400 cos(-----------)) false
                           2                       2
           7 (b x + a)            5 (b x + a)            3 (b x + a)
 - 225 sin(-----------) + 315 sin(-----------) + 525 sin(-----------)
                2                      2                      2
            b x + a          5/2               5 (b x + a)
 - 1575 sin(-------))/(1575 2   ) - (a ((6 sin(-----------)
               2                                    2
          3 (b x + a)                 3 (b x + a)           b x + a
 + 10 sin(-----------)) false - 5 sin(-----------) + 15 sin(-------)))
               2                           2                   2
      3/2    2
/(15 2   ))/b
(%i6)

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases.

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

(%i2) domain:complex;

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

                           /
                           [
(%o3)                      I x sqrt(cos(b x + a)) dx
                           ]
                           /

(%i4) load(abs_integrate);

ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) /usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac

(%i5)  integrate (x*sqrt (cos (b*x + a)), x);

                            5 (b x + a)            5 (b x + a)
display2d : false;

 (%o5) (((1260 (b x + a) sin(-----------) + 504 cos(-----------)
                                 2                      2
                      3 (b x + a)             3 (b x + a)
 + 2100 (b x + a) sin(-----------) + 1400 cos(-----------)) false
                           2                       2
           7 (b x + a)            5 (b x + a)            3 (b x + a)
 - 225 sin(-----------) + 315 sin(-----------) + 525 sin(-----------)
                2                      2                      2
            b x + a          5/2               5 (b x + a)
 - 1575 sin(-------))/(1575 2   ) - (a ((6 sin(-----------)
               2                                    2
          3 (b x + a)                 3 (b x + a)           b x + a
 + 10 sin(-----------)) false - 5 sin(-----------) + 15 sin(-------)))
               2                           2                   2
      3/2    2
/(15 2   ))/b
(%i6)
(((1260*(b*x+a)*sin((5*(b*x+a))/2)+504*cos((5*(b*x+a))/2)
                                        +2100*(b*x+a)*sin((3*(b*x+a))/2)
                                        +1400*cos((3*(b*x+a))/2))
 *false
 -225*sin((7*(b*x+a))/2)+315*sin((5*(b*x+a))/2)+525*sin((3*(b*x+a))/2)
 -1575*sin((b*x+a)/2))
 /(1575*2^(5/2))
 -(a*((6*sin((5*(b*x+a))/2)+10*sin((3*(b*x+a))/2))*false
     -5*sin((3*(b*x+a))/2)+15*sin((b*x+a)/2)))
  /(15*2^(3/2)))
 /b^2

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases.

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

(%i2) domain:complex;

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

                           /
                           [
(%o3)                      I x sqrt(cos(b x + a)) dx
                           ]
                           /

(%i4) load(abs_integrate);

ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) /usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac

display2d : false;

 (%o5) (((1260*(b*x+a)*sin((5*(b*x+a))/2)+504*cos((5*(b*x+a))/2)
                                        +2100*(b*x+a)*sin((3*(b*x+a))/2)
                                        +1400*cos((3*(b*x+a))/2))
 *false
 -225*sin((7*(b*x+a))/2)+315*sin((5*(b*x+a))/2)+525*sin((3*(b*x+a))/2)
 -1575*sin((b*x+a)/2))
 /(1575*2^(5/2))
 -(a*((6*sin((5*(b*x+a))/2)+10*sin((3*(b*x+a))/2))*false
     -5*sin((3*(b*x+a))/2)+15*sin((b*x+a)/2)))
  /(15*2^(3/2)))
 /b^2

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases.cases. And what is the reason SageMath selected to set these settings before calling Maxima?

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

 (%i1)  domain:complex;
(%o1)                               complex

(%i2) domain:complex;
display2d : false;

(%o2) false

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

                           /
                           [
(%o3)                      I x sqrt(cos(b x + a)) dx
                           ]
                           /
'integrate(x*sqrt(cos(b*x+a)),x)

(%i4) load(abs_integrate);
 ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) /usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac

display2d : false;

 "/usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac"

(%i5) integrate (x*sqrt (cos (b*x + a)), x);

(%o5) (((1260*(b*x+a)*sin((5*(b*x+a))/2)+504*cos((5*(b*x+a))/2)
                                        +2100*(b*x+a)*sin((3*(b*x+a))/2)
                                        +1400*cos((3*(b*x+a))/2))
 *false
 -225*sin((7*(b*x+a))/2)+315*sin((5*(b*x+a))/2)+525*sin((3*(b*x+a))/2)
 -1575*sin((b*x+a)/2))
 /(1575*2^(5/2))
 -(a*((6*sin((5*(b*x+a))/2)+10*sin((3*(b*x+a))/2))*false
     -5*sin((3*(b*x+a))/2)+15*sin((b*x+a)/2)))
  /(15*2^(3/2)))
 /b^2
(%i6)

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases. And what is the reason SageMath selected to set these settings before calling Maxima?

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

 (%i1)  domain:complex;
(%o1)                               complex

(%i2) display2d : false;

(%o2) false

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

(%o3) 'integrate(x*sqrt(cos(b*x+a)),x)

(%i4) load(abs_integrate);
ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) "/usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac"

(%i5) integrate (x*sqrt (cos (b*x + a)), x);

(%o5) (((1260*(b*x+a)*sin((5*(b*x+a))/2)+504*cos((5*(b*x+a))/2)
                                        +2100*(b*x+a)*sin((3*(b*x+a))/2)
                                        +1400*cos((3*(b*x+a))/2))
 *false
 -225*sin((7*(b*x+a))/2)+315*sin((5*(b*x+a))/2)+525*sin((3*(b*x+a))/2)
 -1575*sin((b*x+a)/2))
 /(1575*2^(5/2))
 -(a*((6*sin((5*(b*x+a))/2)+10*sin((3*(b*x+a))/2))*false
     -5*sin((3*(b*x+a))/2)+15*sin((b*x+a)/2)))
  /(15*2^(3/2)))
 /b^2
(%i6)

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases. And what is the reason SageMath selected to set these settings before calling Maxima?

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.

integrate results that are different from using maxima

Update

Thanks to comment below by @rburing, it turned out to be the following setting load(abs_integrate) which sagemath is applying before calling Maxima that is causing this problem.

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

 (%i1)  domain:complex;
(%o1)                               complex

(%i2) display2d : false;

(%o2) false

(%i3) integrate (x*sqrt (cos (b*x + a)), x);

(%o3) 'integrate(x*sqrt(cos(b*x+a)),x)

(%i4) load(abs_integrate);
ARRSTORE: use_fast_arrays=false; allocate a new property hash table for $INTABLE2
(%o4) "/usr/share/maxima/5.41.0/share/contrib/integration/abs_integrate.mac"

(%i5) integrate (x*sqrt (cos (b*x + a)), x);

(%o5) (((1260*(b*x+a)*sin((5*(b*x+a))/2)+504*cos((5*(b*x+a))/2)
                                        +2100*(b*x+a)*sin((3*(b*x+a))/2)
                                        +1400*cos((3*(b*x+a))/2))
 *false
 -225*sin((7*(b*x+a))/2)+315*sin((5*(b*x+a))/2)+525*sin((3*(b*x+a))/2)
 -1575*sin((b*x+a)/2))
 /(1575*2^(5/2))
 -(a*((6*sin((5*(b*x+a))/2)+10*sin((3*(b*x+a))/2))*false
     -5*sin((3*(b*x+a))/2)+15*sin((b*x+a)/2)))
  /(15*2^(3/2)))
 /b^2
(%i6)

Therefore the question now becomes this: How could one tell Maxima, from inside SageMath to reverse the effect of the command load(abs_integrate), since this is causing wrong antiderivatives to be generated in these cases. And what is the reason SageMath selected to set these settings before calling Maxima?

Or is there a way a user can control these settings that SageMath is issuing under the cover before using Maxima integrate?

ps. I do not know where the word false came from in the above antiderivative. This seems like a bug in Maxima, as it does not show in SageMath result.

Original question

Hello;

I was going to make a bug entry on this, but thought to first check with the experts here, as I have a feeling I am missing something basic or making some mistake as I am newbie in SageMath and Maxima as well.

I am getting number of wrong antiderivatives from Sagemath intergate, using default algorithm (which should be Maxima), compared to using Maxima itself for same integral.

Using Maxima (and making sure to set domain to complex first), Maxima returns unevaluated for the same command, which is actually is the correct result, since these integrals are supposed to be non integrable and meant to test to see if CAS can determine this. However, sagemath, does return an antiderivative from Maxima.

Could someone please explain how sagemath managed to return such results, and from where it obtained it since Maxima itself does not return this result? In addition, I verified the SageMath result, and they all fail the verification I did.

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.