Synopsis

 Usage:
 (lo,hi) = weightRange(w,f)

Inputs:

w, a list, of integers, the weight of each variable

f, a ring element, in a polynomial ring

Outputs:

lo, an integer, the least weight of the monomials of f

hi, an integer, the greatest weight of the monomials of f
The weight of a monomial is the dot product of w and the exponent vector. If the weight vector has length smaller than the number of variables, the other variables are assumed to have weight zero. If there are too many weights given, the extras are silently ignored.
i1 : R = QQ[a..g]
o1 = R
o1 : PolynomialRing

i2 : f = a^3+b^2*c+3*f^10*d1+ee
10 3 2
o2 = 3d*f + a + b c  1
o2 : R

i3 : weightRange({1,1,0,0,0,0,0},f)
o3 = (0, 3)
o3 : Sequence

Use
terms and
weightRange together to select the terms which have a given weight.
i4 : f = a^2*b+3*a^2*c+b*c+1
2 2
o4 = a b + 3a c + b*c + 1
o4 : R

i5 : sum select(terms f, t > (weightRange({1,0},t))#0 == 2)
2 2
o5 = a b + 3a c
o5 : R

If the coefficient ring is a polynomial ring, one can use the weights of these variables too. The order of weights is the same as the order of variables (see
index)
i6 : S = R[x,y];

i7 : weightRange({0,0,3,7},a*x^2+b*x*y)
o7 = (3, 7)
o7 : Sequence
