Opened 15 months ago

Closed 4 weeks ago

Last modified 3 weeks ago

#29966 closed defect (fixed)

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

Reported by: slabbe Owned by:
Priority: major Milestone: sage-9.5
Component: symbolics Keywords: integral, giac, pari
Cc: chapoton, dimpase, frederichan, parisse, slabbe, slelievre 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 12 months ago by chapoton

  • Keywords integral added

comment:2 Changed 11 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:3 Changed 9 months ago by slelievre

  • Cc chapoton dimpase frederichan parisse slabbe slelievre added
  • Keywords giac pari added

comment:4 Changed 9 months ago by 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 9 months ago by chapoton

dans quelle version de giac ?

comment:7 Changed 9 months ago by slabbe

  • Report Upstream changed from N/A to 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 5 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Moving to 9.4, as 9.3 has been released.

comment:9 Changed 4 months ago by vdelecroix

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

Warning, {msg}\n
Last edited 4 months ago by vdelecroix (previous) (diff)

comment:10 Changed 5 weeks ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

comment:11 Changed 4 weeks ago by chapoton

  • Authors set to Frédéric Chapoton
  • Branch set to u/chapoton/29966
  • Commit set to 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38
  • Status changed from new to needs_review

New commits:

8e99321add doctest for trac 29966

comment:12 Changed 4 weeks ago by slelievre

  • Report Upstream changed from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
  • Reviewers set to Samuel Lelièvre
  • Status changed from needs_review to positive_review

Thanks for adding this doctest.

comment:13 Changed 4 weeks ago by vbraun

  • Branch changed from u/chapoton/29966 to 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:14 Changed 4 weeks ago by arojas

  • Commit 8e9932138a3f8273e07fc65c65ff1cb5fdc7bd38 deleted

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 3 weeks ago by mkoeppe

I've opened #32449 for this

Note: See TracTickets for help on using tickets.