Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade giac to 1.5.0-87 #29552

Closed
mkoeppe opened this issue Apr 23, 2020 · 49 comments
Closed

Upgrade giac to 1.5.0-87 #29552

mkoeppe opened this issue Apr 23, 2020 · 49 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Apr 23, 2020

www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/

(from #29521)

Previous updates:

#26315 Upgrade to Giac 1.5
#28101 update giac to 1.5.0-63

Depends on #29521
Depends on #29171

CC: @antonio-rojas @dimpase @frederichan-IMJPRG @sagetrac-parisse @slel @infinity0 @saraedum @tobihan @timokau @kiwifb @mwageringel

Component: packages: standard

Keywords: giac

Work Issues: merge #29171

Author: Matthias Koeppe

Branch/Commit: eb7995f

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/29552

@mkoeppe mkoeppe added this to the sage-9.2 milestone Apr 23, 2020
@mkoeppe
Copy link
Member Author

mkoeppe commented Apr 23, 2020

Dependencies: #29521

@antonio-rojas
Copy link
Contributor

comment:2

1.6.0 is out, causing a few test failures:

age -t --long /usr/lib/python3.8/site-packages/sage/calculus/calculus.py
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/calculus/calculus.py", line 1534, in sage.calculus.calculus.laplace
Failed example:
    laplace(heaviside(t-1), t, s, algorithm='giac')
Expected:
    e^(-s)/s
Got:
    0
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/calculus/calculus.py", line 1548, in sage.calculus.calculus.laplace
Failed example:
    laplace(5*cos(3*t-2)*heaviside(t-2), t, s, algorithm='giac')
Expected:
    5*(s*cos(4)*e^(-2*s) - 3*e^(-2*s)*sin(4))/(s^2 + 9)
Got:
    0
**********************************************************************
1 item had failures:
   2 of  40 in sage.calculus.calculus.laplace
    [418 tests, 2 failures, 9.18 s]
sage -t --long /usr/lib/python3.8/site-packages/sage/interfaces/giac.py
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/interfaces/giac.py", line 41, in sage.interfaces.giac
Failed example:
    giac.factor('x^5 - y^5')
Expected:
    (x-y)*(x^4+x^3*y+x^2*y^2+x*y^3+y^4)
Got:
    (x-y)*(x^2+(-sqrt(5)+1)/2*x*y+y^2)*(x^2+(sqrt(5)+1)/2*x*y+y^2)
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/interfaces/giac.py", line 83, in sage.interfaces.giac
Failed example:
    giac('factor(x^5-1)')
Expected:
    (x-1)*(x^4+x^3+x^2+x+1)
Got:
    (x-1)*(x^2+(-sqrt(5)+1)/2*x+1)*(x^2+(sqrt(5)+1)/2*x+1)
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/interfaces/giac.py", line 95, in sage.interfaces.giac
Failed example:
    giac('(x^5-1)').factor()
Expected:
    (x-1)*(x^4+x^3+x^2+x+1)
Got:
    (x-1)*(x^2+(-sqrt(5)+1)/2*x+1)*(x^2+(sqrt(5)+1)/2*x+1)
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/interfaces/giac.py", line 626, in sage.interfaces.giac.Giac.eval
Failed example:
    giac(s)
Expected:
    (x)->[x+1,x+2]
Got:
    (x)->{ 
      x+1;  
      x+2;  
    }
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/interfaces/giac.py", line 995, 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\cdot x)}"
Got:
    "\frac{x^{4}-y}{y^{2}-3 x}"
**********************************************************************
3 items had failures:
   3 of  24 in sage.interfaces.giac
   1 of   6 in sage.interfaces.giac.Giac.eval
   1 of   2 in sage.interfaces.giac.GiacElement._latex_
    [167 tests, 5 failures, 3.34 s]
----------------------------------------------------------------------
sage -t --long /usr/lib/python3.8/site-packages/sage/calculus/calculus.py  # 2 doctests failed
sage -t --long /usr/lib/python3.8/site-packages/sage/interfaces/giac.py  # 5 doctests failed
----------------------------------------------------------------------

The ones in interfaces/giac.py just need the tests updated, the calculus/calculus.py failures are an upstream issue

1>> laplace(Heaviside(x-1),x,s)
Warning: piecewise indefinite integration does not return a continuous antiderivative
0
// Time 0

@frederichan-IMJPRG
Copy link

comment:3

For 1.6 with laplace I have reported it upstream on giac's forum:
https://xcas.univ-grenoble-alpes.fr/forum/viewtopic.php?f=3&t=2531

but for the sqrt(5) appearing in the doctests of giac.py I suspect some default configuration that is not dependent of the version of giac. Could it be that the user .xcasrc is taken into account?

Then I think it would be more natural to force the configuration to not use sqrt before the computation with:

sage: giac.with_sqrt(0);
NB: this function returns the previous value of this setting so in a doctest it is better to not print the answer)

@antonio-rojas
Copy link
Contributor

comment:4

Replying to @frederichan-IMJPRG:

but for the sqrt(5) appearing in the doctests of giac.py I suspect some default configuration that is not dependent of the version of giac. Could it be that the user .xcasrc is taken into account?

downgrading giac makes those tests pass again, so there's definitely some change in 1.6 involved.

@sagetrac-parisse
Copy link
Mannequin

sagetrac-parisse mannequin commented Jul 9, 2020

comment:5

Yes, it's an improvement, done for geogebra. Forcing the sqrt mode of Xcas to false should fix sage regression test, as explained by Frederic.
Laplace bug is fixed in my source tree, I will make a new release probably next week.

diff desolve.cc desolve.cc~
117c117
<     if (lop(res,at_integrate).empty() && lop(res,at_piecewise).empty() && lop(res,at_sign).empty())
---
>     if (lop(res,at_integrate).empty())

@mkoeppe
Copy link
Member Author

mkoeppe commented Jul 25, 2020

comment:7

Incidentally, with giac 1.5.0-63 on manylinux-2010-standard (from #30195), I get (https://github.com/kliem/sage/runs/908011984)

In file included from misc.cc:9275:
misc.cc: In function 'std::string giac::fetch(const string&)':
misc.cc:9289:28: error: 'CURLOPT_ACCEPT_ENCODING' was not declared in this scope
     curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "deflate");
                            ^~~~~~~~~~~~~~~~~~~~~~~
misc.cc:9289:28: note: suggested alternative: 'CURLOPT_ENCODING'

It should be checked whether this goes away with the update

@kiwifb
Copy link
Member

kiwifb commented Jul 25, 2020

comment:8

Yes, I do remember a problem with curl in an earlier giac. I believe it is fixed in 1.5.0-87+.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

comment:9

Should we continue waiting for another 1.6 patch release or upgrade to latest 1.5.x in the meantime?

@kiwifb
Copy link
Member

kiwifb commented Aug 10, 2020

comment:10

I would be OK to move to 1.5.0-87 already.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

Branch: u/mkoeppe/upgrade_giac_to_1_5_0_87

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

Author: Matthias Koeppe

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

Commit: d2324a6

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

New commits:

d2324a6build/pkgs/giac: Update to 1.5.0.87

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

comment:13

Attachment: giac-1.5.0.87.tar.bz2.gz

Builds OK on macOS

@kiwifb
Copy link
Member

kiwifb commented Aug 10, 2020

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

comment:15

Updating doctests is probably better done together with #29541

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

comment:16

By the way, it seems that we don't install giac correctly (before or after this update):

$ giac --help
// Maximum number of parallel threads 1
// Unable to find keyword file /Applications/usr/share/giac/doc/en/keywords
Help file /Applications/usr/share/giac/doc/en/aide_cas not found
Added 0 synonyms
Help file /Applications/usr/share/giac/aide_cas not found
:1: syntax error  line 1 col 1 at -- in --help  

undef
// dclock2 0.00015
// Time 0
// Total time 0

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 10, 2020

comment:17

Replying to @kiwifb:

You'll need https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/giac-1.5.0.87.patch for sage's doctests.

Let's see...

diff --git a/sage/interfaces/giac.py b/sage/interfaces/giac.py
index 68c9527..3c5fd12 100644
--- a/sage/interfaces/giac.py
+++ b/sage/interfaces/giac.py
@@ -990,7 +990,7 @@ class GiacElement(ExpectElement):
         EXAMPLES::
 
             sage: print(latex(giac('(x^4 - y)/(y^2-3*x)')))
-            "\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"
+            "\frac{x^{4}-y}{y^{2}-3 x}"
 
         """
         return self.parent().eval('latex(%s)'%self.name())

Before or after, this doctest makes no sense.

The _latex_ method is broken -- it adds quotation marks

sage: g = giac('(x^4 - y)/(y^2-3*x)')
sage: g
(x^4-y)/(y^2-3*x)
sage: s = g._sage_()
sage: s
(x^4 - y)/(y^2 - 3*x)
sage: latex(s)
\frac{x^{4} - y}{y^{2} - 3 \, x}
sage: latex(g)
"\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"

Is anyone using this interface at all?

@kiwifb
Copy link
Member

kiwifb commented Aug 10, 2020

comment:19

Replying to @mkoeppe:

Replying to @kiwifb:

You'll need https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/giac-1.5.0.87.patch for sage's doctests.

Let's see...

diff --git a/sage/interfaces/giac.py b/sage/interfaces/giac.py
index 68c9527..3c5fd12 100644
--- a/sage/interfaces/giac.py
+++ b/sage/interfaces/giac.py
@@ -990,7 +990,7 @@ class GiacElement(ExpectElement):
         EXAMPLES::
 
             sage: print(latex(giac('(x^4 - y)/(y^2-3*x)')))
-            "\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"
+            "\frac{x^{4}-y}{y^{2}-3 x}"
 
         """
         return self.parent().eval('latex(%s)'%self.name())

Before or after, this doctest makes no sense.

The _latex_ method is broken -- it adds quotation marks

sage: g = giac('(x^4 - y)/(y^2-3*x)')
sage: g
(x^4-y)/(y^2-3*x)
sage: s = g._sage_()
sage: s
(x^4 - y)/(y^2 - 3*x)
sage: latex(s)
\frac{x^{4} - y}{y^{2} - 3 \, x}
sage: latex(g)
"\frac{(x^{4}-y)}{(y^{2}-3\cdot x)}"

Is anyone using this interface at all?

I don't know :) - the pexpect interface and the optional giacpy_sage package are the only way to interact with giac right now. I cannot find anything linked with libgiac in sagelib.
But the latex interface in particular? I don't know. The latex spat out for that doctest is different in the currently shipped giac, 1.5.0-63 and 1.5.0-87.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 10, 2020

Changed commit from d2324a6 to 0971326

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 10, 2020

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

0971326sage.interfaces.giac.GiacElement._latex_: Fix implementation and doctest, make doctest more flexible

@frederichan-IMJPRG
Copy link

comment:30

So the answer was that it is a modification usefull for very low memory systems (calculators). Whether or not these extra lines will be put inside an #ifdef in later versions of giac is still in discussion.
I guess we can let it as is

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 16, 2020

Changed dependencies from #29521 to #29521, #29171

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 16, 2020

Work Issues: merge #29171

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 16, 2020

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 17, 2020

Changed commit from c076383 to eb7995f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 17, 2020

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

4805622build/pkgs/giac/spkg-src: Patch with giac-1.5.0.87-gsl_lapack.patch; remove old giac autotools patches
1cec2e7build/pkgs/giac/spkg-install.in: Remove --disable-lapack
eb7995fbuild/pkgs/giac/dependencies: Add curl, glpk

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 17, 2020

Attachment: giac-1.5.0.87p0.tar.bz2.gz

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 17, 2020

Changed reviewer from github.com/mkoeppe/sage/actions/runs/203238491, ... to github.com/mkoeppe/sage/actions/runs/211389096, github.com/mkoeppe/sage/actions/runs/211389095, ...

@fchapoton
Copy link
Contributor

Changed keywords from none to giac

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 19, 2020

comment:39

Needs review!

@dimpase
Copy link
Member

dimpase commented Aug 20, 2020

comment:40
$ giac
// Maximum number of parallel threads 1
Help file /Applications/usr/share/giac/aide_cas not found
// Unable to find keyword file /Applications/usr/share/giac/doc/en/keywords
Help file /Applications/usr/share/giac/doc/en/aide_cas not found
Added 0 synonyms
Welcome to giac readline interface
(c) 2001,2018 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
See http://www.gnu.org for license details
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>> 

something with keywords ? (This is on macOS 10.15).

@dimpase
Copy link
Member

dimpase commented Aug 20, 2020

comment:41

but linking to openblas is fixed, good.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 20, 2020

comment:42

Replying to @dimpase:

$ giac
// Maximum number of parallel threads 1
Help file /Applications/usr/share/giac/aide_cas not found
// Unable to find keyword file /Applications/usr/share/giac/doc/en/keywords
Help file /Applications/usr/share/giac/doc/en/aide_cas not found
Added 0 synonyms
Welcome to giac readline interface
(c) 2001,2018 B. Parisse & others
Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html
Released under the GPL license 3.0 or above
See http://www.gnu.org for license details
May contain BSD licensed software parts (lapack, atlas, tinymt)
-------------------------------------------------
Press CTRL and D simultaneously to finish session
Type ?commandname for help
0>> 

something with keywords ? (This is on macOS 10.15).

Frederic indicates that these messages are not error messages. See #29171 comment:47

@frederichan-IMJPRG
Copy link

comment:43

Moreover, for the keyword message, I have tried on linux with parisse's debian package.
with LANG=C I have also the same (0 synonyms added)
with LANG=en_US I have 26 synonyms added but all are GUI related (turtle mode).
so I don't think that it is a problem.
so this ticket looks good to me.
tested on fedora fc30.x86_64 (make test was OK)

@dimpase
Copy link
Member

dimpase commented Aug 20, 2020

comment:44

ok

@dimpase
Copy link
Member

dimpase commented Aug 20, 2020

Changed reviewer from github.com/mkoeppe/sage/actions/runs/211389096, github.com/mkoeppe/sage/actions/runs/211389095, ... to Dima Pasechnik

@vbraun
Copy link
Member

vbraun commented Aug 26, 2020

Changed branch from u/mkoeppe/upgrade_giac_to_1_5_0_87 to eb7995f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants