Term orders¶
Sage supports the following term orders:
- Lexicographic (lex)
\(x^a < x^b\) if and only if there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i\). This term order is called ‘lp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='lex') sage: x > y True sage: x > y^2 True sage: x > 1 True sage: x^1*y^2 > y^3*z^4 True sage: x^3*y^2*z^4 < x^3*y^2*z^1 False
- Degree reverse lexicographic (degrevlex)
Let \(\deg(x^a) = a_1 + a_2 + \dots + a_n\), then \(x^a < x^b\) if and only if \(\deg(x^a) < \deg(x^b)\) or \(\deg(x^a) = \deg(x^b)\) and there exists \(1 \le i \le n\) such that \(a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i\). This term order is called ‘dp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='degrevlex') sage: x > y True sage: x > y^2*z False sage: x > 1 True sage: x^1*y^5*z^2 > x^4*y^1*z^3 True sage: x^2*y*z^2 > x*y^3*z False
- Degree lexicographic (deglex)
Let \(\deg(x^a) = a_1 + a_2 + \dots + a_n\), then \(x^a < x^b\) if and only if \(\deg(x^a) < \deg(x^b)\) or \(\deg(x^a) = \deg(x^b)\) and there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i\). This term order is called ‘Dp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='deglex') sage: x > y True sage: x > y^2*z False sage: x > 1 True sage: x^1*y^2*z^3 > x^3*y^2*z^0 True sage: x^2*y*z^2 > x*y^3*z True
- Inverse lexicographic (invlex)
\(x^a < x^b\) if and only if there exists \(1 \le i \le n\) such that \(a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i < b_i\). This order is called ‘rp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='invlex') sage: x > y False sage: y > x^2 True sage: x > 1 True sage: x*y > z False
This term order only makes sense in a non-commutative setting because if P is the ring \(k[x_1, \dots, x_n]\) and term order ‘invlex’ then it is equivalent to the ring \(k[x_n, \dots, x_1]\) with term order ‘lex’.
- Negative lexicographic (neglex)
\(x^a < x^b\) if and only if there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i\). This term order is called ‘ls’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='neglex') sage: x > y False sage: x > 1 False sage: x^1*y^2 > y^3*z^4 False sage: x^3*y^2*z^4 < x^3*y^2*z^1 True sage: x*y > z False
- Negative degree reverse lexicographic (negdegrevlex)
Let \(\deg(x^a) = a_1 + a_2 + \dots + a_n\), then \(x^a < x^b\) if and only if \(\deg(x^a) > \deg(x^b)\) or \(\deg(x^a) = \deg(x^b)\) and there exists \(1 \le i \le n\) such that \(a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i\). This term order is called ‘ds’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='negdegrevlex') sage: x > y True sage: x > x^2 True sage: x > 1 False sage: x^1*y^2 > y^3*z^4 True sage: x^2*y*z^2 > x*y^3*z False
- Negative degree lexicographic (negdeglex)
Let \(\deg(x^a) = a_1 + a_2 + \dots + a_n\), then \(x^a < x^b\) if and only if \(\deg(x^a) > \deg(x^b)\) or \(\deg(x^a) = \deg(x^b)\) and there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i\). This term order is called ‘Ds’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='negdeglex') sage: x > y True sage: x > x^2 True sage: x > 1 False sage: x^1*y^2 > y^3*z^4 True sage: x^2*y*z^2 > x*y^3*z True
- Weighted degree reverse lexicographic (wdegrevlex), positive integral weights
Let \(\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n\) with weights \(w\), then \(x^a < x^b\) if and only if \(\deg_w(x^a) < \deg_w(x^b)\) or \(\deg_w(x^a) = \deg_w(x^b)\) and there exists \(1 \le i \le n\) such that \(a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i\). This term order is called ‘wp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdegrevlex',(1,2,3))) sage: x > y False sage: x > x^2 False sage: x > 1 True sage: x^1*y^2 > x^2*z True sage: y*z > x^3*y False
- Weighted degree lexicographic (wdeglex), positive integral weights
Let \(\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n\) with weights \(w\), then \(x^a < x^b\) if and only if \(\deg_w(x^a) < \deg_w(x^b)\) or \(\deg_w(x^a) = \deg_w(x^b)\) and there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i\). This term order is called ‘Wp’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',(1,2,3))) sage: x > y False sage: x > x^2 False sage: x > 1 True sage: x^1*y^2 > x^2*z False sage: y*z > x^3*y False
- Negative weighted degree reverse lexicographic (negwdegrevlex), positive integral weights
Let \(\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n\) with weights \(w\), then \(x^a < x^b\) if and only if \(\deg_w(x^a) > \deg_w(x^b)\) or \(\deg_w(x^a) = \deg_w(x^b)\) and there exists \(1 \le i \le n\) such that \(a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i > b_i\). This term order is called ‘ws’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('negwdegrevlex',(1,2,3))) sage: x > y True sage: x > x^2 True sage: x > 1 False sage: x^1*y^2 > x^2*z True sage: y*z > x^3*y False
- Degree negative lexicographic (degneglex)
Let \(\deg(x^a) = a_1 + a_2 + \dots + a_n\), then \(x^a < x^b\) if and only if \(\deg(x^a) < \deg(x^b)\) or \(\deg(x^a) = \deg(x^b)\) and there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i > b_i\). This term order is called ‘dp_asc’ in PolyBoRi. Singular has the extra weight vector ordering
(a(1:n),ls)
for this purpose.EXAMPLES:
sage: t = TermOrder('degneglex') sage: P.<x,y,z> = PolynomialRing(QQ, order=t) sage: x*y > y*z # indirect doctest False sage: x*y > x True
- Negative weighted degree lexicographic (negwdeglex), positive integral weights
Let \(\deg_w(x^a) = a_1w_1 + a_2w_2 + \dots + a_nw_n\) with weights \(w\), then \(x^a < x^b\) if and only if \(\deg_w(x^a) > \deg_w(x^b)\) or \(\deg_w(x^a) = \deg_w(x^b)\) and there exists \(1 \le i \le n\) such that \(a_1 = b_1, \dots, a_{i-1} = b_{i-1}, a_i < b_i\). This term order is called ‘Ws’ in Singular.
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('negwdeglex',(1,2,3))) sage: x > y True sage: x > x^2 True sage: x > 1 False sage: x^1*y^2 > x^2*z False sage: y*z > x^3*y False
Of these, only ‘degrevlex’, ‘deglex’, ‘degneglex’, ‘wdegrevlex’, ‘wdeglex’, ‘invlex’ and ‘lex’ are global orders.
Sage also supports matrix term order. Given a square matrix \(A\),
\(x^a <_A x^b\) if and only if \(Aa < Ab\)
where \(<\) is the lexicographic term order.
EXAMPLES:
sage: m = matrix(2,[2,3,0,1]); m
[2 3]
[0 1]
sage: T = TermOrder(m); T
Matrix term order with matrix
[2 3]
[0 1]
sage: P.<a,b> = PolynomialRing(QQ,2,order=T)
sage: P
Multivariate Polynomial Ring in a, b over Rational Field
sage: a > b
False
sage: a^3 < b^2
True
sage: S = TermOrder('M(2,3,0,1)')
sage: T == S
True
Additionally all these monomial orders may be combined to product or block orders, defined as:
Let \(x = (x_1, x_2, \dots, x_n)\) and \(y = (y_1, y_2, \dots, y_m)\) be two ordered sets of variables, \(<_1\) a monomial order on \(k[x]\) and \(<_2\) a monomial order on \(k[y]\).
The product order (or block order) \(<\) \(:=\) \((<_1,<_2)\) on \(k[x,y]\) is defined as: \(x^a y^b < x^A y^B\) if and only if \(x^a <_1 x^A\) or (\(x^a =x^A\) and \(y^b <_2 y^B\)).
These block orders are constructed in Sage by giving a comma separated list of monomial orders with the length of each block attached to them.
EXAMPLES:
As an example, consider constructing a block order where the first four variables are compared using the degree reverse lexicographical order while the last two variables in the second block are compared using negative lexicographical order.
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQ, 6,order='degrevlex(4),neglex(2)')
sage: a > c^4
False
sage: a > e^4
True
sage: e > f^2
False
The same result can be achieved by:
sage: T1 = TermOrder('degrevlex',4)
sage: T2 = TermOrder('neglex',2)
sage: T = T1 + T2
sage: P.<a,b,c,d,e,f> = PolynomialRing(QQ, 6, order=T)
sage: a > c^4
False
sage: a > e^4
True
If any other unsupported term order is given the provided string can be forced to be passed through as is to Singular, Macaulay2, and Magma. This ensures that it is for example possible to calculate a Groebner basis with respect to some term order Singular supports but Sage doesn’t:
sage: T = TermOrder("royalorder")
Traceback (most recent call last):
...
ValueError: unknown term order 'royalorder'
sage: T = TermOrder("royalorder",force=True)
sage: T
royalorder term order
sage: T.singular_str()
'royalorder'
AUTHORS:
David Joyner and William Stein: initial version of multi_polynomial_ring
Kiran S. Kedlaya: added macaulay2 interface
Martin Albrecht: implemented native term orders, refactoring
Kwankyu Lee: implemented matrix and weighted degree term orders
Simon King (2011-06-06): added termorder_from_singular
- class sage.rings.polynomial.term_order.TermOrder(name='lex', n=0, force=False)¶
Bases:
sage.structure.sage_object.SageObject
A term order.
See
sage.rings.polynomial.term_order
for details on supported term orders.- blocks()¶
Return the term order blocks of self.
NOTE:
This method has been added in trac ticket #11316. There used to be an attribute of the same name and the same content. So, it is a backward incompatible syntax change.
EXAMPLES:
sage: t=TermOrder('deglex',2)+TermOrder('lex',2) sage: t.blocks() (Degree lexicographic term order, Lexicographic term order)
- greater_tuple¶
The default
greater_tuple
method for this term order.EXAMPLES:
sage: O = TermOrder() sage: O.greater_tuple.__func__ is O.greater_tuple_lex.__func__ True sage: O = TermOrder('deglex') sage: O.greater_tuple.__func__ is O.greater_tuple_deglex.__func__ True
- greater_tuple_block(f, g)¶
Return the greater exponent tuple with respect to the block order as specified when constructing this element.
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<a,b,c,d,e,f>=PolynomialRing(QQbar, 6, order='degrevlex(3),degrevlex(3)') sage: f = a + c^4; f.lm() # indirect doctest c^4 sage: g = a + e^4; g.lm() a
- greater_tuple_deglex(f, g)¶
Return the greater exponent tuple with respect to the total degree lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='deglex') sage: f = x + y; f.lm() # indirect doctest x sage: f = x + y^2*z; f.lm() y^2*z
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_degneglex(f, g)¶
Return the greater exponent tuple with respect to the degree negative lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degneglex') sage: f = x + y; f.lm() # indirect doctest y sage: f = x + y^2*z; f.lm() y^2*z
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_degrevlex(f, g)¶
Return the greater exponent tuple with respect to the total degree reversed lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degrevlex') sage: f = x + y; f.lm() # indirect doctest x sage: f = x + y^2*z; f.lm() y^2*z
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_invlex(f, g)¶
Return the greater exponent tuple with respect to the inversed lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='invlex') sage: f = x + y; f.lm() # indirect doctest y sage: f = y + x^2; f.lm() y
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_lex(f, g)¶
Return the greater exponent tuple with respect to the lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='lex') sage: f = x + y^2; f.lm() # indirect doctest x
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_matrix(f, g)¶
Return the greater exponent tuple with respect to the matrix term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') sage: y > x^2 # indirect doctest True sage: y > x^3 False
- greater_tuple_negdeglex(f, g)¶
Return the greater exponent tuple with respect to the negative degree lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='negdeglex') sage: f = x + y; f.lm() # indirect doctest x sage: f = x + x^2; f.lm() x sage: f = x^2*y*z^2 + x*y^3*z; f.lm() x^2*y*z^2
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_negdegrevlex(f, g)¶
Return the greater exponent tuple with respect to the negative degree reverse lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='negdegrevlex') sage: f = x + y; f.lm() # indirect doctest x sage: f = x + x^2; f.lm() x sage: f = x^2*y*z^2 + x*y^3*z; f.lm() x*y^3*z
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_neglex(f, g)¶
Return the greater exponent tuple with respect to the negative lexicographical term order.
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: P.<a,b,c,d,e,f>=PolynomialRing(QQbar, 6, order='degrevlex(3),degrevlex(3)') sage: f = a + c^4; f.lm() # indirect doctest c^4 sage: g = a + e^4; g.lm() a
- greater_tuple_negwdeglex(f, g)¶
Return the greater exponent tuple with respect to the negative weighted degree lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: t = TermOrder('negwdeglex',(1,2,3)) sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) sage: f = x + y; f.lm() # indirect doctest x sage: f = x + x^2; f.lm() x sage: f = x^3 + z; f.lm() x^3
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_negwdegrevlex(f, g)¶
Return the greater exponent tuple with respect to the negative weighted degree reverse lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: t = TermOrder('negwdegrevlex',(1,2,3)) sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) sage: f = x + y; f.lm() # indirect doctest x sage: f = x + x^2; f.lm() x sage: f = x^3 + z; f.lm() x^3
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_wdeglex(f, g)¶
Return the greater exponent tuple with respect to the weighted degree lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: t = TermOrder('wdeglex',(1,2,3)) sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) sage: f = x + y; f.lm() # indirect doctest y sage: f = x*y + z; f.lm() x*y
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- greater_tuple_wdegrevlex(f, g)¶
Return the greater exponent tuple with respect to the weighted degree reverse lexicographical term order.
INPUT:
f
- exponent tupleg
- exponent tuple
EXAMPLES:
sage: t = TermOrder('wdegrevlex',(1,2,3)) sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order=t) sage: f = x + y; f.lm() # indirect doctest y sage: f = x + y^2*z; f.lm() y^2*z
This method is called by the lm/lc/lt methods of
MPolynomial_polydict
.
- is_block_order()¶
Return true if self is a block term order.
EXAMPLES:
sage: t=TermOrder('deglex',2)+TermOrder('lex',2) sage: t.is_block_order() True
- is_global()¶
Return true if this term order is definitely global. Return false otherwise, which includes unknown term orders.
EXAMPLES:
sage: T = TermOrder('lex') sage: T.is_global() True sage: T = TermOrder('degrevlex', 3) + TermOrder('degrevlex', 3) sage: T.is_global() True sage: T = TermOrder('degrevlex', 3) + TermOrder('negdegrevlex', 3) sage: T.is_global() False sage: T = TermOrder('degneglex', 3) sage: T.is_global() True
- is_local()¶
Return true if this term order is definitely local. Return false otherwise, which includes unknown term orders.
EXAMPLES:
sage: T = TermOrder('lex') sage: T.is_local() False sage: T = TermOrder('negdeglex', 3) + TermOrder('negdegrevlex', 3) sage: T.is_local() True sage: T = TermOrder('degrevlex', 3) + TermOrder('negdegrevlex', 3) sage: T.is_local() False
- is_weighted_degree_order()¶
Return true if self is a weighted degree term order.
EXAMPLES:
sage: t=TermOrder('wdeglex',(2,3)) sage: t.is_weighted_degree_order() True
- macaulay2_str()¶
Return a Macaulay2 representation of self.
Used to convert polynomial rings to their Macaulay2 representation.
EXAMPLES:
sage: P = PolynomialRing(GF(127), 8,names='x',order='degrevlex(3),lex(5)') sage: T = P.term_order() sage: T.macaulay2_str() '{GRevLex => 3,Lex => 5}' sage: P._macaulay2_().options()['MonomialOrder'] # optional - macaulay2 {MonomialSize => 16 } {GRevLex => {1, 1, 1}} {Lex => 5 } {Position => Up }
- magma_str()¶
Return a MAGMA representation of self.
Used to convert polynomial rings to their MAGMA representation.
EXAMPLES:
sage: P = PolynomialRing(GF(127), 10,names='x',order='degrevlex') sage: magma(P) # optional - magma Polynomial ring of rank 10 over GF(127) Order: Graded Reverse Lexicographical Variables: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9
sage: T = P.term_order() sage: T.magma_str() '"grevlex"'
- matrix()¶
Return the matrix defining matrix term order.
EXAMPLES:
sage: t = TermOrder("M(1,2,0,1)") sage: t.matrix() [1 2] [0 1]
- name()¶
EXAMPLES:
sage: TermOrder('lex').name() 'lex'
- singular_moreblocks()¶
Return a the number of additional blocks SINGULAR needs to allocate for handling non-native orderings like \(degneglex\).
EXAMPLES:
sage: P = PolynomialRing(GF(127),10,names='x',order='lex(3),deglex(5),lex(2)') sage: T = P.term_order() sage: T.singular_moreblocks() 0 sage: P = PolynomialRing(GF(127),10,names='x',order='lex(3),degneglex(5),lex(2)') sage: T = P.term_order() sage: T.singular_moreblocks() 1 sage: P = PolynomialRing(GF(127),10,names='x',order='degneglex(5),degneglex(5)') sage: T = P.term_order() sage: T.singular_moreblocks() 2
- singular_str()¶
Return a SINGULAR representation of self.
Used to convert polynomial rings to their SINGULAR representation.
EXAMPLES:
sage: P = PolynomialRing(GF(127),10,names='x',order='lex(3),deglex(5),lex(2)') sage: T = P.term_order() sage: T.singular_str() '(lp(3),Dp(5),lp(2))' sage: P._singular_() polynomial ring, over a field, global ordering // coefficients: ZZ/127 // number of vars : 10 // block 1 : ordering lp // : names x0 x1 x2 // block 2 : ordering Dp // : names x3 x4 x5 x6 x7 // block 3 : ordering lp // : names x8 x9 // block 4 : ordering C
The
degneglex
ordering is somehow special, it looks like a block ordering in SINGULAR:sage: T = TermOrder("degneglex", 2) sage: P = PolynomialRing(QQ,2, names='x', order=T) sage: T = P.term_order() sage: T.singular_str() '(a(1:2),ls(2))' sage: T = TermOrder("degneglex", 2) + TermOrder("degneglex", 2) sage: P = PolynomialRing(QQ,4, names='x', order=T) sage: T = P.term_order() sage: T.singular_str() '(a(1:2),ls(2),a(1:2),ls(2))' sage: P._singular_() polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering a // : names x0 x1 // : weights 1 1 // block 2 : ordering ls // : names x0 x1 // block 3 : ordering a // : names x2 x3 // : weights 1 1 // block 4 : ordering ls // : names x2 x3 // block 5 : ordering C
The position of the
ordering C
block can be controlled by setting_singular_ringorder_column
attribute to an integer:sage: T = TermOrder("degneglex", 2) + TermOrder("degneglex", 2) sage: T._singular_ringorder_column = 0 sage: P = PolynomialRing(QQ, 4, names='x', order=T) sage: P._singular_() polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering C // block 2 : ordering a // : names x0 x1 // : weights 1 1 // block 3 : ordering ls // : names x0 x1 // block 4 : ordering a // : names x2 x3 // : weights 1 1 // block 5 : ordering ls // : names x2 x3 sage: T._singular_ringorder_column = 1 sage: P = PolynomialRing(QQ, 4, names='y', order=T) sage: P._singular_() polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering c // block 2 : ordering a // : names y0 y1 // : weights 1 1 // block 3 : ordering ls // : names y0 y1 // block 4 : ordering a // : names y2 y3 // : weights 1 1 // block 5 : ordering ls // : names y2 y3 sage: T._singular_ringorder_column = 2 sage: P = PolynomialRing(QQ, 4, names='z', order=T) sage: P._singular_() polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering a // : names z0 z1 // : weights 1 1 // block 2 : ordering C // block 3 : ordering ls // : names z0 z1 // block 4 : ordering a // : names z2 z3 // : weights 1 1 // block 5 : ordering ls // : names z2 z3
- sortkey¶
The default
sortkey
method for this term order.EXAMPLES:
sage: O = TermOrder() sage: O.sortkey.__func__ is O.sortkey_lex.__func__ True sage: O = TermOrder('deglex') sage: O.sortkey.__func__ is O.sortkey_deglex.__func__ True
- sortkey_block(f)¶
Return the sortkey of an exponent tuple with respect to the block order as specified when constructing this element.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<a,b,c,d,e,f>=PolynomialRing(QQbar, 6, order='degrevlex(3),degrevlex(3)') sage: a > c^4 # indirect doctest False sage: a > e^4 True
- sortkey_deglex(f)¶
Return the sortkey of an exponent tuple with respect to the degree lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='deglex') sage: x > y^2 # indirect doctest False sage: x > 1 True
- sortkey_degneglex(f)¶
Return the sortkey of an exponent tuple with respect to the degree negative lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y,z> = PolynomialRing(QQbar, 3, order='degneglex') sage: x*y > y*z # indirect doctest False sage: x*y > x True
- sortkey_degrevlex(f)¶
Return the sortkey of an exponent tuple with respect to the degree reversed lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='degrevlex') sage: x > y^2 # indirect doctest False sage: x > 1 True
- sortkey_invlex(f)¶
Return the sortkey of an exponent tuple with respect to the inversed lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='invlex') sage: x > y^2 # indirect doctest False sage: x > 1 True
- sortkey_lex(f)¶
Return the sortkey of an exponent tuple with respect to the lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='lex') sage: x > y^2 # indirect doctest True sage: x > 1 True
- sortkey_matrix(f)¶
Return the sortkey of an exponent tuple with respect to the matrix term order.
INPUT:
f
- exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='m(1,3,1,0)') sage: y > x^2 # indirect doctest True sage: y > x^3 False
- sortkey_negdeglex(f)¶
Return the sortkey of an exponent tuple with respect to the negative degree lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='negdeglex') sage: x > y^2 # indirect doctest True sage: x > 1 False
- sortkey_negdegrevlex(f)¶
Return the sortkey of an exponent tuple with respect to the negative degree reverse lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='negdegrevlex') sage: x > y^2 # indirect doctest True sage: x > 1 False
- sortkey_neglex(f)¶
Return the sortkey of an exponent tuple with respect to the negative lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQbar, 2, order='neglex') sage: x > y^2 # indirect doctest False sage: x > 1 False
- sortkey_negwdeglex(f)¶
Return the sortkey of an exponent tuple with respect to the negative weighted degree lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: t = TermOrder('negwdeglex',(3,2)) sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) sage: x > y^2 # indirect doctest True sage: x^2 > y^3 True
- sortkey_negwdegrevlex(f)¶
Return the sortkey of an exponent tuple with respect to the negative weighted degree reverse lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: t = TermOrder('negwdegrevlex',(3,2)) sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) sage: x > y^2 # indirect doctest True sage: x^2 > y^3 True
- sortkey_wdeglex(f)¶
Return the sortkey of an exponent tuple with respect to the weighted degree lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: t = TermOrder('wdeglex',(3,2)) sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) sage: x > y^2 # indirect doctest False sage: x > y True
- sortkey_wdegrevlex(f)¶
Return the sortkey of an exponent tuple with respect to the weighted degree reverse lexicographical term order.
INPUT:
f
– exponent tuple
EXAMPLES:
sage: t = TermOrder('wdegrevlex',(3,2)) sage: P.<x,y> = PolynomialRing(QQbar, 2, order=t) sage: x > y^2 # indirect doctest False sage: x^2 > y^3 True
- tuple_weight(f)¶
Return the weight of tuple f.
INPUT:
f
- exponent tuple
EXAMPLES:
sage: t=TermOrder('wdeglex',(1,2,3)) sage: P.<a,b,c>=PolynomialRing(QQbar, order=t) sage: P.term_order().tuple_weight([3,2,1]) 10
- weights()¶
Return the weights for weighted term orders.
EXAMPLES:
sage: t=TermOrder('wdeglex',(2,3)) sage: t.weights() (2, 3)
- sage.rings.polynomial.term_order.termorder_from_singular(S)¶
Return the Sage term order of the basering in the given Singular interface
INPUT:
An instance of the Singular interface.
EXAMPLES:
sage: from sage.rings.polynomial.term_order import termorder_from_singular sage: singular.eval('ring r1 = (9,x),(a,b,c,d,e,f),(M((1,2,3,0)),wp(2,3),lp)') '' sage: termorder_from_singular(singular) Block term order with blocks: (Matrix term order with matrix [1 2] [3 0], Weighted degree reverse lexicographic term order with weights (2, 3), Lexicographic term order of length 2)
A term order in Singular also involves information on orders for modules. This information is reflected in
_singular_ringorder_column
attribute of the term order.sage: singular.ring(0, '(x,y,z,w)', '(C,dp(2),lp(2))') polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering C // block 2 : ordering dp // : names x y // block 3 : ordering lp // : names z w sage: T = termorder_from_singular(singular) sage: T Block term order with blocks: (Degree reverse lexicographic term order of length 2, Lexicographic term order of length 2) sage: T._singular_ringorder_column 0 sage: singular.ring(0, '(x,y,z,w)', '(c,dp(2),lp(2))') polynomial ring, over a field, global ordering // coefficients: QQ // number of vars : 4 // block 1 : ordering c // block 2 : ordering dp // : names x y // block 3 : ordering lp // : names z w sage: T = termorder_from_singular(singular) sage: T Block term order with blocks: (Degree reverse lexicographic term order of length 2, Lexicographic term order of length 2) sage: T._singular_ringorder_column 1