cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

py3: interfaces/giac.py failures #555

Closed strogdon closed 4 years ago

strogdon commented 5 years ago

I'm unable to find similar failures on Sage trac. With giac-1.5.0.63, which is no longer available on s-o-g

sage -t --long usr/lib64/python3.6/site-packages/sage/interfaces/giac.py
**********************************************************************
File "usr/lib64/python3.6/site-packages/sage/interfaces/giac.py", line 993, in sage.interfaces.giac.GiacElement._latex_
Failed example:
    print(latex(giac('(x^4 - y)/(y^2-3*x)')))
Expected:
    "\frac{x^{4}-y}{y^{2}-3\,x}"
Got:
    "\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"
**********************************************************************

which is fixed with giac-1.5.0.67 but with the new failure:

sage -t --long usr/lib64/python3.6/site-packages/sage/interfaces/giac.py
**********************************************************************
File "usr/lib64/python3.6/site-packages/sage/interfaces/giac.py", line 45, in sage.interfaces.giac
Failed example:
    x,y=giac('x,y'); giac.int(y/(cos(2*x)+cos(x)),x)     # random
Exception raised:
    Traceback (most recent call last):
      File "/storage/strogdon/gentoo-rap/usr/lib64/python3.6/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/storage/strogdon/gentoo-rap/usr/lib64/python3.6/site-packages/sage/doctest/forker.py", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.giac[7]>", line 1, in <module>
        x,y=giac('x,y'); giac.int(y/(cos(Integer(2)*x)+cos(x)),x)     # random
    ValueError: not enough values to unpack (expected 2, got 1)
**********************************************************************

Now the doctest is marked random but, if I'm not mistaken, that was in 2016.

strogdon commented 5 years ago

Perhaps something needs to be rebuilt?

kiwifb commented 5 years ago

Hi Steve,

The first failure I fixed by patching sage itself after checking that the latex was actually good and proper. The second one started in 1.5.0.65 and I have no clue whatsoever. The test is probably marked random because the integral may be branch dependent. But the problem is not the result, we have an exception instead.

strogdon commented 5 years ago

Yes, I just noticed the patch.

kiwifb commented 5 years ago

This is the only instance of giac.int in the whole sage code and I cannot figure out what it calls.

strogdon commented 5 years ago

Error must be in sage - somewhere. Desired result

    sage: x,y=giac('x,y'); giac.int(y/(cos(2*x)+cos(x)),x)     # random
    y*2*((-(tan(x/2)))/6+(-2*1/6/sqrt(3))*ln(abs(6*tan(x/2)-2*sqrt(3))/abs(6*tan(x/2)+2*sqrt(3))))

from giac

0>> int(y/(cos(2*x)+cos(x)),x)
y*2*(-tan(x/2)/6-2/(3*2*sqrt(3))*ln(abs(6*tan(x/2)-2*sqrt(3))/abs(6*tan(x/2)+2*sqrt(3))))
// Time 0.05
strogdon commented 5 years ago

This

sage: x,y,z=giac('x,y,z')

and this

sage: x=giac('x')

works, but this doesn't

sage: x,y=giac('x,y')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-1f963142d64c> in <module>()
----> 1 x,y=giac('x,y')

ValueError: not enough values to unpack (expected 2, got 1)
kiwifb commented 5 years ago

This is interesting. That's not the part of the statement that I thought was problematic. There should really be one statement per line.

kiwifb commented 5 years ago

Posted on sage-packaging to see if anyone has an idea.

strogdon commented 4 years ago

Looks like there is a giac bug https://xcas.univ-grenoble-alpes.fr/forum/viewtopic.php?f=3&t=2411

kiwifb commented 4 years ago

Dima opened it following discussion on sage-packaging. That's the diagnostic from Antonio Arojas from arch actually.

kiwifb commented 4 years ago

Fixed by 1.5.0.69. Now in overlay.