It is possible to set up a polynomial ring so that the degree of an element is a vector of integers. For this, the option
Degrees is used, together with a list of degrees for the variables in the ring. Each degree is itself a list of integers. The degrees given must all be of the same length, and length zero is allowed, to get an ungraded ring.
i1 : R = ZZ/101[a,b,c,Degrees=>{{1,2},{2,1},{1,0}}]
o1 = R
o1 : PolynomialRing
|
i2 : describe R
ZZ
o2 = --- [a, b, c, Degrees => {{1, 2}, {2, 1}, {1, 0}}]
101
|
i3 : degree a
o3 = {1, 2}
o3 : List
|
i4 : degree b^2
o4 = {4, 2}
o4 : List
|
i5 : degree 0_R
o5 = -infinity
o5 : InfiniteNumber
|
i6 : degree 1_R
o6 = {0, 0}
o6 : List
|
A random element of bi-degree
{m,n} can be obtained with
random.
i7 : random({15,15},R)
5 5 6 3 3 7 6
o7 = 35a b - 2a b c - 22a b*c
o7 : R
|
The function
degree applied to a polynomial will return the least upper bound of the degrees of its monomials.
i8 : degree (a+b)
o8 = {2, 2}
o8 : List
|
We may recover the number of integers in each degree list for our ring as follows.
i9 : degreeLength R
o9 = 2
|
i10 : degreeLength ZZ
o10 = 0
|
The case when the first degree of some variable is not positive
The only restriction on degrees is that the entries be small integer values, possibly zero or negative. The notion of small depends on the size of exponents one wants: the degree of each monomial occuring should fit in a 32 bit integer (or 64 bit integer, on 64 bit machines).
Nonetheless, there are several routines (e.g.,
basis,
random) which require that each multidegree be finite dimensional, and therefore require a
Heft vector. This is a vector of (small) integers,
w = (w0, ..., wd-1) of length the
degreeLength of the ring, such that the dot product of w with the degree of each variable is a positive integer. Provide this vector when constructing the ring.
i11 : R = QQ[a,b,c,Degrees=>{{1,0},{-2,1},{-3,1}}, Heft=>{1,4}];
|
i12 : random({1,1},R)
7 3 9 4
o12 = - -*a b - -*a c
2 8
o12 : R
|
i13 : basis({1,1},R)
o13 = | a4c a3b |
1 2
o13 : Matrix R <--- R
|
If the vector is not provided, many computations will work (e.g., Groebner bases), but operations requiring finite bases for a multidegree (such as
basis and
random) will raise errors.