# weightRange -- the pair of lowest and highest weights of the monomials

## Synopsis

• Usage:
(lo,hi) = weightRange(w,f)
• Inputs:
• w, a list, of integers, the weight of each variable
• f, , 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*d-1+e-e 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

## Synopsis

• Usage:
(lo,hi) = weightRange f
• Inputs:
• f,
• Outputs:
• lo, an integer, the minimum value for (the first component of) the degrees of the monomials occurring in f
• hi, an integer, the corresponding maximum value
 i8 : R = QQ[x,y]; i9 : weightRange (x^3+y^2)^5 o9 = (10, 15) o9 : Sequence

• degree
• homogenize -- homogenize with respect to a variable
• part -- select terms of a polynomial by degree(s) or weight(s)
• index -- numeric index of a ring variable

## Ways to use weightRange :

• "weightRange(List,RingElement)"
• "weightRange(RingElement)"

## For the programmer

The object weightRange is .