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

Commit

Permalink
28567: run Macaulay2 f4 and mgb doctests over a finite field
Browse files Browse the repository at this point in the history
  • Loading branch information
mwageringel committed Oct 6, 2019
1 parent 1ad24c3 commit 7038ba2
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/sage/rings/polynomial/multi_polynomial_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3011,12 +3011,6 @@ def _groebner_basis_macaulay2(self, strategy=None):
sage: I = ideal(x*y-z^2, y^2-w^2)
sage: I.groebner_basis('macaulay2') # indirect doctest; optional - macaulay2
[z^4 - x^2*w^2, y*z^2 - x*w^2, x*y - z^2, y^2 - w^2]
sage: I.groebner_basis('macaulay2:gb') # indirect doctest; optional - macaulay2
[z^4 - x^2*w^2, y*z^2 - x*w^2, x*y - z^2, y^2 - w^2]
sage: I.groebner_basis('macaulay2:f4') # indirect doctest; optional - macaulay2
[z^4 - x^2*w^2, y*z^2 - x*w^2, x*y - z^2, y^2 - w^2]
sage: I.groebner_basis('macaulay2:mgb') # indirect doctest; optional - macaulay2
[z^4 - x^2*w^2, y*z^2 - x*w^2, x*y - z^2, y^2 - w^2]
The Groebner basis can be used to compute in
`\ZZ/n\ZZ[x,\ldots]`.
Expand All @@ -3030,10 +3024,19 @@ def _groebner_basis_macaulay2(self, strategy=None):
sage: I = ideal([y^2*z - x^3 - 19^2*x*z, y^2, 19^2])
sage: I.groebner_basis('macaulay2') # optional - macaulay2
[x^3, y^2, 361]
sage: I.groebner_basis('macaulay2:f4') # optional - macaulay2
[x^3, y^2, 361]
sage: I.groebner_basis('macaulay2:mgb') # optional - macaulay2
[x^3, y^2, 361]
Over finite fields, Macaulay2 supports different algorithms to compute
Gröbner bases::
sage: R = PolynomialRing(GF(101), 'x', 4)
sage: I = sage.rings.ideal.Cyclic(R)
sage: gb1 = I.groebner_basis('macaulay2:gb') # optional - macaulay2
sage: I = sage.rings.ideal.Cyclic(R)
sage: gb2 = I.groebner_basis('macaulay2:mgb') # optional - macaulay2
sage: I = sage.rings.ideal.Cyclic(R)
sage: gb3 = I.groebner_basis('macaulay2:f4') # optional - macaulay2
sage: gb1 == gb2 == gb3
True
TESTS::
Expand Down Expand Up @@ -3946,27 +3949,29 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
sage: gb == gb.reduced()
False
but that ``toy:buchberger2`` does.::
but that ``toy:buchberger2`` does. ::
sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching
sage: gb = I.groebner_basis('toy:buchberger2'); gb
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
sage: gb == gb.reduced()
True
Here we use Macaulay2 with three different strategies.::
Here we use Macaulay2 with three different strategies over a finite
field. ::
sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching
sage: R.<a,b,c> = PolynomialRing(GF(101), 3)
sage: I = sage.rings.ideal.Katsura(R,3) # regenerate to prevent caching
sage: I.groebner_basis('macaulay2:gb') # optional - macaulay2
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
[c^3 + 28*c^2 - 37*b + 13*c, b^2 - 41*c^2 + 20*b - 20*c, b*c - 19*c^2 + 10*b + 40*c, a + 2*b + 2*c - 1]
sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching
sage: I = sage.rings.ideal.Katsura(R,3) # regenerate to prevent caching
sage: I.groebner_basis('macaulay2:f4') # optional - macaulay2
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
[c^3 + 28*c^2 - 37*b + 13*c, b^2 - 41*c^2 + 20*b - 20*c, b*c - 19*c^2 + 10*b + 40*c, a + 2*b + 2*c - 1]
sage: I = sage.rings.ideal.Katsura(P,3) # regenerate to prevent caching
sage: I = sage.rings.ideal.Katsura(R,3) # regenerate to prevent caching
sage: I.groebner_basis('macaulay2:mgb') # optional - macaulay2
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
[c^3 + 28*c^2 - 37*b + 13*c, b^2 - 41*c^2 + 20*b - 20*c, b*c - 19*c^2 + 10*b + 40*c, a + 2*b + 2*c - 1]
::
Expand All @@ -3975,7 +3980,7 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
Singular and libSingular can compute Groebner basis with degree
restrictions.::
restrictions. ::
sage: R.<x,y> = QQ[]
sage: I = R*[x^3+y^2,x^2*y+1]
Expand Down Expand Up @@ -4018,7 +4023,7 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
The list of available options is provided at
:class:`~sage.libs.singular.option.LibSingularOptions`.
Note that Groebner bases over `\ZZ` can also be computed.::
Note that Groebner bases over `\ZZ` can also be computed. ::
sage: P.<a,b,c> = PolynomialRing(ZZ,3)
sage: I = P * (a + 2*b + 2*c - 1, a^2 - a + 2*b^2 + 2*c^2, 2*a*b + 2*b*c - b)
Expand Down Expand Up @@ -4783,7 +4788,7 @@ def random_element(self, degree, compute_gb=False, *args, **kwds):
EXAMPLES:
We compute a uniformly random element up to the provided degree.::
We compute a uniformly random element up to the provided degree. ::
sage: P.<x,y,z> = GF(127)[]
sage: I = sage.rings.ideal.Katsura(P)
Expand Down

0 comments on commit 7038ba2

Please sign in to comment.