# Revision history [back]

### why sage returns different output from giac?

When I call giac directly, it returns an output different from what sagemath returns using giac. Why is that?

I am using sagemath SageMath version 9.6.rc1, with latest giac 1.9.0.

Here is an example

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc1, Release Date: 2022-04-19                 │
│ Using Python 3.10.4. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('x')
x
sage: integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x, algorithm="giac")
integrate((x^2 - 1)/((x^2 + 1)*sqrt(x + 1)*sqrt(sqrt(x + 1) + 1)*sqrt(sqrt(sqrt(x + 1) + 1) + 1)), x)

sage:  print(giac.version())
"giac 1.9.0, (c) B. Parisse and R. De Graeve, Institut Fourier, Universite de Grenoble I"


Notice that the result returned above is the input. But when I call giac directly using same integrand, it gives

>giac
// Maximum number of parallel threads 24
Welcome to giac readline interface, version 1.9.0
(c) 2001,2021 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>>  integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x)
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*x+1)]
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*t_nostep^4-8*t_nostep^2+1)]
Discontinuities at zeroes of 4*t_nostep^4-8*t_nostep^2+1 were not checked
-8*sqrt(sqrt(sqrt(x+1)+1)+1)+integrate(-2/(sqrt(x+1)*sqrt(sqrt(x+1)+1)*sqrt(sqrt(sqrt(x+1)+1)+1)*((sqrt(sqrt(x+1)+1)+1)^8-8*(sqrt(sqrt(x+1)+1)+1)^7+24*(sqrt(sqrt(x+1)+1)+1)^6-32*(sqrt(sqrt(x+1)+1)+1)^5+14*(sqrt(sqrt(x+1)+1)+1)^4+8*(sqrt(sqrt(x+1)+1)+1)^3-8*(sqrt(sqrt(x+1)+1)+1)^2+2)),x)
// Time 0.25
1>>


Not only that, calling giac directly returns the result instantly. But using sagemath, I had to wait for more than 10 minutes for the result.

I build giac from source as well as sagemath. All on Linux Ubuntu.

Is this a bug?

### why sage returns different output from giac?

When I call giac directly, it returns an output different from what sagemath returns using giac. Why is that?

I am using sagemath SageMath version 9.6.rc1, with latest giac 1.9.0.

Here is an example

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc1, Release Date: 2022-04-19                 │
│ Using Python 3.10.4. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('x')
x
sage: integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x, algorithm="giac")
integrate((x^2 - 1)/((x^2 + 1)*sqrt(x + 1)*sqrt(sqrt(x + 1) + 1)*sqrt(sqrt(sqrt(x + 1) + 1) + 1)), x)

sage:  print(giac.version())
"giac 1.9.0, (c) B. Parisse and R. De Graeve, Institut Fourier, Universite de Grenoble I"


Notice that the result returned above is the input. But when I call giac directly using same integrand, it gives

>giac
// Maximum number of parallel threads 24
Welcome to giac readline interface, version 1.9.0
(c) 2001,2021 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>>  integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x)
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*x+1)]
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*t_nostep^4-8*t_nostep^2+1)]
Discontinuities at zeroes of 4*t_nostep^4-8*t_nostep^2+1 were not checked
-8*sqrt(sqrt(sqrt(x+1)+1)+1)+integrate(-2/(sqrt(x+1)*sqrt(sqrt(x+1)+1)*sqrt(sqrt(sqrt(x+1)+1)+1)*((sqrt(sqrt(x+1)+1)+1)^8-8*(sqrt(sqrt(x+1)+1)+1)^7+24*(sqrt(sqrt(x+1)+1)+1)^6-32*(sqrt(sqrt(x+1)+1)+1)^5+14*(sqrt(sqrt(x+1)+1)+1)^4+8*(sqrt(sqrt(x+1)+1)+1)^3-8*(sqrt(sqrt(x+1)+1)+1)^2+2)),x)
// Time 0.25
1>>


Not only that, calling giac directly returns the result instantly. But using sagemath, I had to wait for more than 10 minutes for the result.

I build giac from source as well as sagemath. All on Linux Ubuntu.

Is this a bug? Or is it possible that sagemath now checks if the result returned back has "integrate" still in it, and in this case it echo back the original input instead of what was actually returned by the external CAS?

### why sage returns different output from giac?

When I call giac directly, it returns an output different from what sagemath returns using giac. Why is that?

I am using sagemath SageMath version 9.6.rc1, with latest giac 1.9.0.

Here is an example

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc1, Release Date: 2022-04-19                 │
│ Using Python 3.10.4. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('x')
x
sage: integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x, algorithm="giac")
integrate((x^2 - 1)/((x^2 + 1)*sqrt(x + 1)*sqrt(sqrt(x + 1) + 1)*sqrt(sqrt(sqrt(x + 1) + 1) + 1)), x)

sage:  print(giac.version())
"giac 1.9.0, (c) B. Parisse and R. De Graeve, Institut Fourier, Universite de Grenoble I"


Notice that the result returned above is the input. But when I call giac directly using same integrand, it gives

>giac
// Maximum number of parallel threads 24
Welcome to giac readline interface, version 1.9.0
(c) 2001,2021 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>>  integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x)
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*x+1)]
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*t_nostep^4-8*t_nostep^2+1)]
Discontinuities at zeroes of 4*t_nostep^4-8*t_nostep^2+1 were not checked
-8*sqrt(sqrt(sqrt(x+1)+1)+1)+integrate(-2/(sqrt(x+1)*sqrt(sqrt(x+1)+1)*sqrt(sqrt(sqrt(x+1)+1)+1)*((sqrt(sqrt(x+1)+1)+1)^8-8*(sqrt(sqrt(x+1)+1)+1)^7+24*(sqrt(sqrt(x+1)+1)+1)^6-32*(sqrt(sqrt(x+1)+1)+1)^5+14*(sqrt(sqrt(x+1)+1)+1)^4+8*(sqrt(sqrt(x+1)+1)+1)^3-8*(sqrt(sqrt(x+1)+1)+1)^2+2)),x)
// Time 0.25
1>>


Not only that, calling giac directly returns the result instantly. But using sagemath, I had to wait for more than 10 minutes for the result.

I build giac from source as well as sagemath. All on Linux Ubuntu.

Is this a bug? Or is it possible that sagemath now checks if the result returned back has "integrate" still in it, and in this case it echo back the original input instead of what was actually returned by the external CAS?

fyi, created ticket https://trac.sagemath.org/ticket/33741#ticket

### why sage returns different output from giac?

When I call giac directly, it returns an output different from what sagemath returns using giac. Why is that?

I am using sagemath SageMath version 9.6.rc1, with latest giac 1.9.0.

Here is an example

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc1, Release Date: 2022-04-19                 │
│ Using Python 3.10.4. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('x')
x
sage: integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x, algorithm="giac")
integrate((x^2 - 1)/((x^2 + 1)*sqrt(x + 1)*sqrt(sqrt(x + 1) + 1)*sqrt(sqrt(sqrt(x + 1) + 1) + 1)), x)

sage:  print(giac.version())
"giac 1.9.0, (c) B. Parisse and R. De Graeve, Institut Fourier, Universite de Grenoble I"


Notice that the result returned above is the input. But when I call giac directly using same integrand, it gives

>giac
// Maximum number of parallel threads 24
Welcome to giac readline interface, version 1.9.0
(c) 2001,2021 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>>  integrate((x^2-1)/(1+x)^(1/2)/(x^2+1)/(1+(1+x)^(1/2))^(1/2)/(1+(1+(1+x)^(1/2))^(1/2))^(1/2),x)
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*x+1)]
Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real):
Check [abs(4*t_nostep^4-8*t_nostep^2+1)]
Discontinuities at zeroes of 4*t_nostep^4-8*t_nostep^2+1 were not checked
-8*sqrt(sqrt(sqrt(x+1)+1)+1)+integrate(-2/(sqrt(x+1)*sqrt(sqrt(x+1)+1)*sqrt(sqrt(sqrt(x+1)+1)+1)*((sqrt(sqrt(x+1)+1)+1)^8-8*(sqrt(sqrt(x+1)+1)+1)^7+24*(sqrt(sqrt(x+1)+1)+1)^6-32*(sqrt(sqrt(x+1)+1)+1)^5+14*(sqrt(sqrt(x+1)+1)+1)^4+8*(sqrt(sqrt(x+1)+1)+1)^3-8*(sqrt(sqrt(x+1)+1)+1)^2+2)),x)
// Time 0.25
1>>


Not only that, calling giac directly returns the result instantly. But using sagemath, I had to wait for more than 10 minutes for the result.

I build giac from source as well as sagemath. All on Linux Ubuntu.

Is this a bug? Or is it possible that sagemath now checks if the result returned back has "integrate" still in it, and in this case it echo back the original input instead of what was actually returned by the external CAS?

>which giac
/usr/local/bin/giac
>giac --version
// Maximum number of parallel threads 24
// (c) 2001, 2021 B. Parisse & others
1.9.0
>
>cd \$SAGE_ROOT
>cd local/bin
>ls -lrt giac
lrwxrwxrwx 1 me me 19 Apr 20 04:55 giac -> /usr/local/bin/giac
>


fyi, created ticket https://trac.sagemath.org/ticket/33741#ticket