Opened 2 years ago

Closed 2 months ago

#28630 closed defect (fixed)

internal function of fricas appearing

Reported by: tmonteil Owned by:
Priority: major Milestone: sage-9.4
Component: symbolics Keywords: FriCAS
Cc: hemmecke, whuss, rws, chapoton, mantepse Merged in:
Authors: Martin Rubey Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: 4f3e1b4 (Commits, GitHub, GitLab) Commit: 4f3e1b44d6d9bda955f782ba515221e5372db897
Dependencies: #32049 Stopgaps:

Status badges

Description

As reported on this ask question, we have:

sage: f = polylog(3, x)
sage: f.integral(x, algorithm='fricas')
-x*%iint(x, -log(-x + 1)/x) - (x - 1)*log(-x + 1) + x*polylog(3, x) + x

So, fricas produces something that is ill-interpreted as some %iint symbolic function.

Note that maxima produces the following answer:

sage: f.integral(x, algorithm='maxima')
-x*dilog(x) - (x - 1)*log(-x + 1) + x*polylog(3, x) + x

Change History (24)

comment:1 Changed 2 years ago by tmonteil

  • Cc hemmecke whuss rws chapoton added

comment:2 Changed 2 years ago by chapoton

  • Keywords FriCAS added

comment:3 Changed 2 years ago by chapoton

  • Cc mantepse added

comment:4 Changed 2 years ago by chapoton

This seems to be some kind of bug in Fricas:

sage: f = fricas(polylog(3,x))
sage: f.integrate(x)
              log(- x + 1)
- x %iint(x,- ------------) + x polylog(3,x) + (- x + 1)log(- x + 1) + x
                    x

And the first term can be differentiated (inside Fricas) correctly.

comment:5 Changed 22 months ago by mantepse

More a reminder to myself: SageMath's dilog(x) is FriCAS' dilog(1-x). This is properly reflected in sage.functions.log.py, in class Function_dilog.

So FriCAS should simplify %iint(x, -log(1-x)/x)) to FriCAS dilog(1-x).

comment:6 Changed 22 months ago by mantepse

  • Report Upstream changed from N/A to Reported upstream. No feedback yet.

comment:7 Changed 22 months ago by mantepse

  • Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.

comment:8 Changed 21 months ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:9 Changed 17 months ago by mkoeppe

  • Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:10 Changed 13 months ago by mkoeppe

Still the same in 9.2.beta10 after the update of FriCAS to 1.3.6 in #27309

comment:11 Changed 11 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:12 Changed 8 months ago by dimpase

Fricas devs say that %iint should have never appeared, it's a Fricas bug. So that's something for them to fix.

comment:13 Changed 5 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review.

comment:14 Changed 4 months ago by mantepse

  • Branch set to u/mantepse/wrong_conversion_from_fricas

comment:15 Changed 4 months ago by mantepse

  • Authors set to Martin Rubey
  • Commit set to 0bf981c8b8b7dd08151f85ef7eb3f83f0c40b90b
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.
  • Status changed from new to needs_review
  • Summary changed from Wrong conversion from fricas to internal function of fricas appearing

New commits:

f18b821add doctest
0bf981cprovide doctest

comment:16 Changed 4 months ago by chapoton

First one does not work for me on 9.4.b0. We must wait for Fricas release containing the fix.

comment:17 Changed 3 months ago by mantepse

  • Dependencies set to #32049

comment:18 Changed 2 months ago by git

  • Commit changed from 0bf981c8b8b7dd08151f85ef7eb3f83f0c40b90b to 322dfb7fb97ceda6a65e299394ffb4623213f3a0

Branch pushed to git repo; I updated commit sha1. New commits:

322dfb7Merge branch 'develop' into t/28630/wrong_conversion_from_fricas

comment:19 Changed 2 months ago by dimpase

this gives me

File "src/sage/symbolic/integration/external.py", line 418, in sage.symbolic.integration.external.fricas_integrator
Failed example:
    integrate(f, x, algorithm="fricas")                               # optional - fricas
Expected:
    1/315*(64512*I*a*e^(10*I*d*x + 10*I*c) + 53760*I*a*e^(8*I*d*x + 8*I*c) + 30720*I*a*e^(6*I*d*x + 6*I*c) + 11520*I*a*e^(4*I*d*x + 4*I*c) + 2560*I*a*e^(2*I*d*x + 2*I*c) + 256*I*a)/(d*e^(20*I*d*x + 20*I*c) + 10*d*e^(18*I*d*x + 18*I*c) + 45*d*e^(16*I*d*x + 16*I*c) + 120*d*e^(14*I*d*x + 14*I*c) + 210*d*e^(12*I*d*x + 12*I*c) + 252*d*e^(10*I*d*x + 10*I*c) + 210*d*e^(8*I*d*x + 8*I*c) + 120*d*e^(6*I*d*x + 6*I*c) + 45*d*e^(4*I*d*x + 4*I*c) + 10*d*e^(2*I*d*x + 2*I*c) + d)
Got:
    -256/315*(-252*I*a*e^(10*I*d*x + 10*I*c) - 210*I*a*e^(8*I*d*x + 8*I*c) - 120*I*a*e^(6*I*d*x + 6*I*c) - 45*I*a*e^(4*I*d*x + 4*I*c) - 10*I*a*e^(2*I*d*x + 2*I*c) - I*a)/(d*e^(20*I*d*x + 20*I*c) + 10*d*e^(18*I*d*x + 18*I*c) + 45*d*e^(16*I*d*x + 16*I*c) + 120*d*e^(14*I*d*x + 14*I*c) + 210*d*e^(12*I*d*x + 12*I*c) + 252*d*e^(10*I*d*x + 10*I*c) + 210*d*e^(8*I*d*x + 8*I*c) + 120*d*e^(6*I*d*x + 6*I*c) + 45*d*e^(4*I*d*x + 4*I*c) + 10*d*e^(2*I*d*x + 2*I*c) + d)
  • a different formatting of the same expression.

comment:20 Changed 2 months ago by dimpase

  • Status changed from needs_review to needs_work

how about making this doctest robust:

        sage: ii=integrate(f, x, algorithm="fricas")                    # optional - fricas
        sage: ii==1/315*(64512*I*a*e^(10*I*d*x + 10*I*c) +<the rest...> # optional - fricas
        True

comment:21 Changed 2 months ago by dimpase

  • Branch changed from u/mantepse/wrong_conversion_from_fricas to u/dimpase/packages/fricas/wrong_conversion_from_fricas
  • Commit changed from 322dfb7fb97ceda6a65e299394ffb4623213f3a0 to 4f3e1b44d6d9bda955f782ba515221e5372db897
  • Reviewers set to Dima Pasechnik
  • Status changed from needs_work to positive_review

OK, like this


New commits:

4f3e1b4make the test robust

comment:22 Changed 2 months ago by dimpase

  • Report Upstream changed from Fixed upstream, but not in a stable release. to N/A

comment:23 Changed 2 months ago by mantepse

The final commit subsumes #29043, which I therefore set to duplicate.

comment:24 Changed 2 months ago by vbraun

  • Branch changed from u/dimpase/packages/fricas/wrong_conversion_from_fricas to 4f3e1b44d6d9bda955f782ba515221e5372db897
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.