#29966 closed defect (fixed)
integrate(sqrt(x + sqrt(x)), x, algorithm='giac') raises RuntimeError
Reported by:  Sébastien Labbé  Owned by:  

Priority:  major  Milestone:  sage9.5 
Component:  symbolics  Keywords:  integral, giac, pari 
Cc:  Frédéric Chapoton, Dima Pasechnik, Han Frederic, Bernard Parisse, Sébastien Labbé, Samuel Lelièvre  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Samuel Lelièvre 
Report Upstream:  Fixed upstream, in a later stable release.  Work issues:  
Branch:  8e99321 (Commits, GitHub, GitLab)  Commit:  
Dependencies:  Stopgaps: 
Description
From https://ask.sagemath.org/question/50885/isthereawaytointegratesqrtxsqrtxinsage/, the command
sage: integrate(sqrt(x + sqrt(x)), x, algorithm='giac')
returns
Traceback (most recent call last): ... AttributeError: ... During handling of the above exception, another exception occurred: ... RuntimeError: An error occurred running a Giac command: INPUT: sage2 OUTPUT: Warning, choosing root of [1,0,0,%%%{4,[1]%%%},%%%{4,[2]%%%}+%%%{1,[1]%%%}] at parameters values [97] Warning, need to choose a branch for the root of a polynomial with parameters. This might be wrong. The choice was done assuming [x]=[9] Warning, need to choose a branch for the root of a polynomial with parameters. This might be wrong. The choice was done assuming [x]=[54] *** bug in PARI/GP (Bus Error), please report.sym2poly exception caught Error in PARI subsystem Error: Bad Argument Value Warning, need to choose a branch for the root of a polynomial with parameters. This might be wrong. The choice was done assuming [x]=[64] *** bug in PARI/GP (Segmentation Fault), please report.sym2poly exception caught Error in PARI subsystem Error: Bad Argument Value *** bug in PARI/GP (Segmentation Fault), please report.sym2poly exception caught Error in PARI subsystem Error: Bad Argument Value *** Warning: normalizing a polynomial with 0 leading term. *** Warning: normalizing a polynomial with 0 leading term. Warning, choosing root of [1,0,0,%%%{4,[1]%%%},%%%{4,[2]%%%}+%%%{1,[1]%%%}] at parameters values [6.38357630698] *** Warning: normalizing a polynomial with 0 leading term. *** Warning: normalizing a polynomial with 0 leading term. Warning, choosing root of [1,0,0,%%%{4,[1]%%%},%%%{4,[2]%%%}+%%%{1,[1]%%%}] at parameters values [82.1195442914] 2*(2*((1/6*sqrt(x)+1/24)*sqrt(x)1/16)*sqrt(x+sqrt(x))1/16*ln(sqrt(4*sqrt(x)+14*sqrt(x)*cos((pi*sign(im(sqrt(x)))*sign(x+re(sqrt(x)))pi*sign(im(sqrt(x)))2*atan(im(sqrt(x))/(x+re(sqrt(x)))))/2)+rootof([[4,4,0],[1,0,0,4*x,4*x^2x]])*cos(1/2*(atan(im(sqrt(x))/(x+re(sqrt(x))))+(1sign(x+re(sqrt(x))))*sign(im(sqrt(x)))*pi/2)))))
This was not fixed by #28913.
Change History (15)
comment:1 Changed 2 years ago by
Keywords:  integral added 

comment:2 Changed 2 years ago by
Milestone:  sage9.2 → sage9.3 

comment:3 Changed 2 years ago by
Cc:  Frédéric Chapoton Dima Pasechnik Han Frederic Bernard Parisse Sébastien Labbé Samuel Lelièvre added 

Keywords:  giac pari added 
comment:4 Changed 2 years ago by
comment:7 Changed 23 months ago by
Report Upstream:  N/A → Fixed upstream, but not in a stable release. 

Do we know the version of some release of giac which will solve the bug?
The current version with the bug is:
$ sage standard  grep giac giac....................................1.5.0.87p2.p1 (1.5.0.87p2.p1)
comment:8 Changed 19 months ago by
Milestone:  sage9.3 → sage9.4 

Moving to 9.4, as 9.3 has been released.
comment:9 Changed 19 months ago by
Parsing warnings from giac would make sense. Do they always are of the form
Warning, {msg}\n
comment:10 Changed 15 months ago by
Milestone:  sage9.4 → sage9.5 

comment:11 Changed 15 months ago by
Authors:  → Frédéric Chapoton 

Branch:  → u/chapoton/29966 
Commit:  → 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38 
Status:  new → needs_review 
New commits:
8e99321  add doctest for trac 29966

comment:12 Changed 15 months ago by
Report Upstream:  Fixed upstream, but not in a stable release. → Fixed upstream, in a later stable release. 

Reviewers:  → Samuel Lelièvre 
Status:  needs_review → positive_review 
Thanks for adding this doctest.
comment:13 Changed 15 months ago by
Branch:  u/chapoton/29966 → 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38 

Resolution:  → fixed 
Status:  positive_review → closed 
comment:14 Changed 15 months ago by
Commit:  8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38 

This fails with giac 1.7:
File "/usr/lib/python3.9/sitepackages/sage/symbolic/integration/external.py", line 247, in sage.symbolic.integration.external.giac_integrator Failed example: giac_integrator(sqrt(x + sqrt(x)), x) Expected: 1/12*(2*sqrt(x)*(4*sqrt(x) + 1)  3)*sqrt(x + sqrt(x))  1/8*log(abs(2*sqrt(x + sqrt(x))  2*sqrt(x)  1)) Got: 1/12*(2*sqrt(x)*(4*sqrt(x) + 1)  3)*sqrt(x + sqrt(x))  1/8*log(2*sqrt(x + sqrt(x)) + 2*sqrt(x) + 1)
Note: See
TracTickets for help on using
tickets.
Now returns
abs inside the ln was ineffective