Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

These issues with the text-based interfaces are known. See for example #28913 for a very similar problem.

Instead of the text-based interface to Giac, you can use the C-interface libgiac. This is a recent addition, so you need at least Sage 9.2.

sage: var('a x')
sage: from sage.libs.giac import libgiac
sage: anti = libgiac.integrate(1/(2*x^(1/2)+(1+x)^(1/2))^2, x).sage()
Warning, choosing root of [1,0,%%%{-4,[1]%%%}+%%%{-2,[0]%%%},0,1] at parameters values [86]
Warning, choosing root of [1,0,%%%{-4,[1]%%%}+%%%{-2,[0]%%%},0,1] at parameters values [-97]
sage: anti
-8/9*(5*(sqrt(x + 1) - sqrt(x))^2 - 3)/(3*(sqrt(x + 1) - sqrt(x))^4 - 10*(sqrt(x + 1) - sqrt(x))^2 + 3) - 1/3*(5*x + 1)/(3*x - 1) + 4/9*log((sqrt(x + 1) - sqrt(x))^2) - 5/9*log(abs(3*(sqrt(x + 1) - sqrt(x))^2 - 1)) + 5/9*log(abs((sqrt(x + 1) - sqrt(x))^2 - 3)) + 5/9*log(abs(3*x - 1))

sage: libgiac.integrate(sec(2*a*x), x).sage()
Unable to check sign: (pi/x/2)>(-pi/x/2)
Unable to check sign: (pi/x/2)>(-pi/x/2)
1/8*(log(abs(1/sin(2*a*x) + sin(2*a*x) + 2)) - log(abs(1/sin(2*a*x) + sin(2*a*x) - 2)))/a

Probably, this will become the default behind the scenes, in a future version of Sage.

These issues with the text-based interfaces are known. See for example #28913 for a very similar problem.

Instead of the text-based interface to Giac, you can use the C-interface libgiac. This is a recent addition, so you need at least Sage 9.2.

sage: var('a x')
sage: from sage.libs.giac import libgiac
sage: anti = libgiac.integrate(1/(2*x^(1/2)+(1+x)^(1/2))^2, x).sage()
Warning, choosing root of [1,0,%%%{-4,[1]%%%}+%%%{-2,[0]%%%},0,1] at parameters values [86]
Warning, choosing root of [1,0,%%%{-4,[1]%%%}+%%%{-2,[0]%%%},0,1] at parameters values [-97]
sage: anti
-8/9*(5*(sqrt(x + 1) - sqrt(x))^2 - 3)/(3*(sqrt(x + 1) - sqrt(x))^4 - 10*(sqrt(x + 1) - sqrt(x))^2 + 3) - 1/3*(5*x + 1)/(3*x - 1) + 4/9*log((sqrt(x + 1) - sqrt(x))^2) - 5/9*log(abs(3*(sqrt(x + 1) - sqrt(x))^2 - 1)) + 5/9*log(abs((sqrt(x + 1) - sqrt(x))^2 - 3)) + 5/9*log(abs(3*x - 1))

sage: libgiac.integrate(sec(2*a*x), x).sage()
Unable to check sign: (pi/x/2)>(-pi/x/2)
Unable to check sign: (pi/x/2)>(-pi/x/2)
1/8*(log(abs(1/sin(2*a*x) + sin(2*a*x) + 2)) - log(abs(1/sin(2*a*x) + sin(2*a*x) - 2)))/a

Probably, this will become the default behind the scenes, in a future version of Sage.Sage. (Edit: I have opened #31873 for this.)