Grobx for Sage
The Python module grobx_sage computes reduced Gröbner bases of Sage's polynomial ideals with
grobx's Python module. Its groebner_basis(I) is called as Sage's I.groebner_basis() is, for the
fields and orders grobx computes in, returns what Sage's returns, and raises an error for anything
else.
import grobx_sage
R.<x,y> = PolynomialRing(GF(7))
grobx_sage.groebner_basis(R.ideal(x^2 + y, x*y - 1))
# [x^2 + y, x*y - 1, y^2 + x]
Setup
sage -pip install grobx-sage installs the module grobx_sage from PyPI into Sage's Python, and
grobx's Python module with it. make dist builds the package from this directory into dist/: the
sdist, and the wheel grobx_sage-<version>-py3-none-any.whl, which sage -pip install takes as
well.
groebner_basis
groebner_basis(I, *, threads=None, seed=None, deadline=None, memory=None, checker=None) returns
the reduced Gröbner basis of the ideal I in its ring's term order. The ring is a multivariate
polynomial ring over ℚ or GF(p), p a prime below 2^64, or a Boolean polynomial ring (Boolean
rings below). The basis is an immutable
PolynomialSequence of monic polynomials of that ring, the largest leading monomial first, as Sage
returns it. The zero ideal's basis is [0].
| Term order of the ring | grobx's order |
|---|---|
degrevlex, Sage's default |
grevlex |
lex |
lex |
degrevlex(k1),…,degrevlex(km) |
block:k1,…,k(m−1): grevlex in each block, the blocks in turn |
The sum TermOrder("degrevlex", k1) + … + TermOrder("degrevlex", km) is the same block order.
The keywords are those of grobx.groebner (grobx's python/README.md, The call). A keyword left
at None takes grobx's default.
| Keyword | Value |
|---|---|
threads |
how many threads the call may use; 0 is all the machine has |
seed |
the seed of every random choice, below 2^64 |
deadline |
a time limit on the whole call, in milliseconds |
memory |
a ceiling on the resident set of Sage's process, in bytes |
checker |
"exact", or the number of random points of the cheap mode |
checker has grobx's checker certify the result: that the basis is a Gröbner basis of I, and
reduced.
Ctrl-C raises grobx's cancel flag. groebner_basis raises KeyboardInterrupt once grobx has
stopped.
The ideal reaches grobx as instance text, its variables renamed v0, v1, …, and the basis comes back
as basis text (grobx's MANUAL.md, Formats). grobx reads ASCII names only, and a Sage variable
may carry any Python identifier.
Boolean rings
A Boolean polynomial ring B = BooleanPolynomialRing(n, names, order=…) is its cover ring
B.cover_ring(), GF(2)[x] in the same term order, modulo the field equations x² + x.
groebner_basis computes the basis of the ideal and the field equations of all variables in the
cover ring, maps it into B, and drops the field equations, which map to 0 there. The result is
PolyBoRi's I.groebner_basis(). The orders are those of groebner_basis above. The zero ideal's
basis is [0], where Sage's own groebner_basis raises IndexError.
Errors
groebner_basis raises:
TypeErrorfor anything but an ideal of a multivariate polynomial ring, an ideal ofPolynomialRing(K, 'x')among them;PolynomialRing(K, 'x', 1)is the multivariate ring in one variable;ValueErrorfor a base ring other than ℚ and GF(p), such as ZZ, RR, GF(p^k), a number field, or a fraction field;ValueErrorfor any other order:deglex, the negative orders, the weighted orders, matrix orders, and a block order with a block that is notdegrevlex;ValueError,grobx.Erroramong them, for what grobx rejects: a prime above 2^64, or a keyword's value;RuntimeErrorwhere a deadline or a memory ceiling stopped the call, and where the checker rejected the basis, with the checker's reason.
Test
make test builds the wheel, installs it under Sage in the Docker image SAGE_IMAGE
(sagemath/sagemath:10.10 by default) with the newest grobx on PyPI, and runs test_grobx_sage.py
against the installed module. It compares groebner_basis
with Sage's groebner_basis on small systems over ℚ, GF(2), GF(65521), and GF(2^64 − 59) and on
random Boolean systems, in degrevlex,
lex, and two block orders, and on rings with Unicode names, one variable, and twelve variables. It
checks the keywords, that every input grobx does not compute raises its error, and that a deadline
and a Ctrl-C stop grobx on cyclic-9.
The wheel and the test reach the container as a tar on standard input. The container's user sage
cannot read a bind mount of a home directory that is closed to others.
Metadata
Release files for grobx-sage 0.73.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grobx_sage-0.73.3.tar.gz | 20.2 kB | Without provenance | Details for grobx_sage-0.73.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grobx_sage-0.73.3-py3-none-any.whl | Python 3 | none | any | Details for grobx_sage-0.73.3-py3-none-any.whl |
Total release size: 38.6 kB
Release files / grobx_sage-0.73.3.tar.gz
| Download URL | grobx_sage-0.73.3.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da799f9d41dac15551e49923604a0878c11f0b6e07d1e8c4fbe5a05425fac663
|
|
BLAKE2b-256 checksum How to use checksums |
101833fc935856500f85c5889af27ff4fbcb0bbd07d5375fca9ddc7a899a25ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / grobx_sage-0.73.3-py3-none-any.whl
| Download URL | grobx_sage-0.73.3-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2f7652f21d9992ba16d829eb6a088c1db4b492c7ebd96162703ac97130ed15b
|
|
BLAKE2b-256 checksum How to use checksums |
bd23c2d18e202b2177e02e1ce9ddce4c1fd8aab7f002c94f4fa800c461e5a60f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for grobx-sage 0.73.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.