If M is finite dimensional over k, the degree of M is its dimension over k. Otherwise, the degree of M is the multiplicity of M, i.e., the integer d such that the Hilbert polynomial of M has the form z |--> d z^e/e! + lower terms in z.
R = ZZ/101[t,x,y,z]; |
degree (R^1 / (ideal vars R)^6) |
degree minors_2 matrix {{t,x,y},{x,y,z}} |
The algorithm computes the hilbertSeries of M (as a rational function), divides both numerator and denominator by 1-T as often as possible, then evaluates both at T=1 and returns the resulting quotient as a (possibly rational) number. When the module has finite length, then the rational function is a polynomial, and evaluating it at 1 returns the dimension over the ground field, which for a graded (homogenous) is the same as the length.