-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Infinite loop in gcd() via pynac-0.2.1 #10284
Comments
Replying to @sagetrac-bgoodri: > So, it appears as if we need to use Singular or sync to at least GiNaC 1.5.8 . If there isn't a straightforward way to adopt the patch that went into GiNaC 1.5.x, I don't think it's worth the time to sync the gcd code in pynac with the latest version in GiNaC. Multivariate gcd is a hard problem. IMHO, we should have a single, well-tested, fast implementation and use that everywhere in Sage, rather than rely on the efforts of each upstream developer team to implement their own with a unique set of bugs. Using Factory as a library doesn't look too hard: http://www.singular.uni-kl.de/svn/trunk/factory/examples/gcd.cc The README file is helpful, although I'm not sure if there is any other documentation available: http://www.singular.uni-kl.de/svn/trunk/factory/README I'm quite sure we would get good feedback from the current developers if the issues are discussed at the libsingular-devel list: http://groups.google.com/group/libsingular-devel It seems that once the necessary changes are made in pynac to use Factory for gcd's, it would be straightforward to plug in another library, perhaps giac, later. |
comment:2
Replying to @burcin: All valid points. Maybe we should move the discussion to sage-devel to get more input? If you want a quick hack fix for this particular bug, I think it would suffice to add some logic to py_gcd to coerce rational expressions with a .polynomial(QQ) and call gcd() from sage/rings/polynomial/multi_polynomial_libsingular instead of gcd() from sage/rings/arith . I tried that a couple of days ago and it was insufficient to fix #10268, but it would presumably fix this bug. Not that #10268 is a killer feature but GiNaC does seem to have a significant speed advantage over Maxima at simplifying rationals. As for the more general GiNaC / pynac vs. Singular / Factory comparison (not to mention giac), I haven't investigated enough to have a super strong opinion about it. I agree it would be easier to maintain if there were only one interface. On the other hand, it is good to make it possible to use whatever might be fastest and have the most features for a particular problem. Also, in both cases, we are lagging behind upstream, but they have a lot of the same algorithms now. Singular 3.1-2 fixed / improved a lot of multivariate polynomial stuff but sage currently ships with 3.0-something. Similarly, GiNaC 1.5.8 fixed this bug and 1.5.0 added a lot of functionality in the polynomials/ directory, but pynac is based on 1.4-something. What I like about (the latest) GiNaC is that it is closer to the sage SR concept, whereas Singular is more literal about its rings. For example, you can do this
and similarly with other transcendental numbers and trig and so forth. AFAIK, Singular would throw an error about QQness instead of determining that Pi - 1 was the greatest common factor. There is a lot to like about Singular too, which is probably why William wrote those things in TODO.txt and the docstrings. Some of that seems to have changed in the last couple of years though. |
comment:8
(Optionally) fixed in Pynac-0.6.6. |
Dependencies: pynac-0.7.1 |
comment:9
Unconditionally fixed in pynac git master by adding a libfactory interface and using its GCD. Fix will be in pynac-0.7.1. |
Changed dependencies from pynac-0.7.1 to #21963 |
comment:11
Fixed via pynac-0.7.1, the doctest is already included in |
comment:12
ok |
Reviewer: Frédéric Chapoton |
This bug was fixed in GiNaC 1.5.x but pynac forked off the 1.4.x branch. See
http://www.ginac.de/ginac.git?p=ginac.git;a=commit;h=edf1ae46a926d0a718063c149b78c1b9a7ec2043
Translated to sage syntax from the GiNaC 1.5.x unit tests:
So, it appears as if we need to use Singular or sync to at least GiNaC 1.5.8 .
Depends on #21963
Upstream: Fixed upstream, in a later stable release.
Component: symbolics
Keywords: gcd
Reviewer: Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/10284
The text was updated successfully, but these errors were encountered: