Opened 2 years ago

Closed 15 months ago

Last modified 15 months ago

#29966 closed defect (fixed)

integrate(sqrt(x + sqrt(x)), x, algorithm='giac') raises RuntimeError

Reported by: Sébastien Labbé Owned by:
Priority: major Milestone: sage-9.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:

Status badges

Description

From https://ask.sagemath.org/question/50885/is-there-a-way-to-integrate-sqrtxsqrtx-in-sage/, 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)+1-4*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^2-x]])*cos(1/2*(atan(im(sqrt(x))/(x+re(sqrt(x))))+(1-sign(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 Frédéric Chapoton

Keywords: integral added

comment:2 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:3 Changed 2 years ago by Samuel Lelièvre

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 Bernard Parisse

Now returns

2*(2*((1/6*sqrt(x)+1/24)*sqrt(x)-1/16)*sqrt(x+sqrt(x))-1/16*ln(abs(2*(sqrt(x+sqrt(x))-sqrt(x))-1)))

abs inside the ln was ineffective

comment:5 Changed 2 years ago by Frédéric Chapoton

dans quelle version de giac ?

comment:7 Changed 23 months ago by Sébastien Labbé

Report Upstream: N/AFixed 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 Matthias Köppe

Milestone: sage-9.3sage-9.4

Moving to 9.4, as 9.3 has been released.

comment:9 Changed 19 months ago by Vincent Delecroix

Parsing warnings from giac would make sense. Do they always are of the form

Warning, {msg}\n
Last edited 19 months ago by Vincent Delecroix (previous) (diff)

comment:10 Changed 15 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

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

Authors: Frédéric Chapoton
Branch: u/chapoton/29966
Commit: 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38
Status: newneeds_review

New commits:

8e99321add doctest for trac 29966

comment:12 Changed 15 months ago by Samuel Lelièvre

Report Upstream: Fixed upstream, but not in a stable release.Fixed upstream, in a later stable release.
Reviewers: Samuel Lelièvre
Status: needs_reviewpositive_review

Thanks for adding this doctest.

comment:13 Changed 15 months ago by Volker Braun

Branch: u/chapoton/299668e9932138a3f8273e07fc65c65ff1cb5fdc7bd38
Resolution: fixed
Status: positive_reviewclosed

comment:14 Changed 15 months ago by Antonio Rojas

Commit: 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38

This fails with giac 1.7:

File "/usr/lib/python3.9/site-packages/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)

comment:15 Changed 15 months ago by Matthias Köppe

I've opened #32449 for this

Note: See TracTickets for help on using tickets.