Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
28572: fix conversion of quotient rings from Macaulay2 to Sage
Browse files Browse the repository at this point in the history
  • Loading branch information
mwageringel authored and dimpase committed Oct 22, 2019
1 parent 61ca2db commit 84702b4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/sage/interfaces/macaulay2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,13 @@ def _sage_(self):
sage: X.sage() # optional - macaulay2
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x, y)
sage: S = ZZ['x,y'].quotient('x^2-y')
sage: macaulay2(S).sage() == S # optional - macaulay2
True
sage: S = GF(101)['x,y'].quotient('x^2-y')
sage: macaulay2(S).sage() == S # optional - macaulay2
True
sage: R = macaulay2("QQ^2") # optional - macaulay2
sage: R.sage() # optional - macaulay2
Vector space of dimension 2 over Rational Field
Expand Down Expand Up @@ -1430,7 +1437,8 @@ def _sage_(self):
return parent.ideal(*gens)
elif cls_str == "QuotientRing":
#Handle the ZZ/n case
if "ZZ" in repr_str and "--" in repr_str:
ambient = self.ambient()
if ambient.external_string() == 'ZZ':
from sage.rings.all import ZZ, GF
external_string = self.external_string()
zz, n = external_string.split("/")
Expand All @@ -1439,9 +1447,8 @@ def _sage_(self):
#coming from Macaulay 2
return GF(ZZ(n))

ambient = self.ambient()._sage_()
ideal = self.ideal()._sage_()
return ambient.quotient(ideal)
return ambient._sage_().quotient(ideal)
elif cls_str == "PolynomialRing":
from sage.rings.all import PolynomialRing
from sage.rings.polynomial.term_order import inv_macaulay2_name_mapping
Expand Down

0 comments on commit 84702b4

Please sign in to comment.