w = getWeights(r)
If r is a monomial, this will return the weight of r which is simply the sum of the weights of the variables in the support of r each counted with multiplicity equal to its exponent. If r is a polynomial, then the weight of the leading monomial is returned (which may differ from the weights of the other monomials of r).
In the following example, the polynomial ring R is the symmetric algebra over $V$, where $V=\mathbb{C}^4$ and is acted upon by the group $SL_4 (\mathbb{C})$.
|
|
|
|
|
The weight of 0 is undefined, so an error is returned if r is 0.