Given a module over a local ring, a parameter ideal, and an integer, this method computes the Hilbert-Samuel function for the module. If parameter ideal is not given, the maximal ideal is assumed.
Note: If computing at index n is fast but slows down at n+1, try computing at range (n, n+1). On the other hand, if computing at range (n, n+m) is slow, try breaking up the range.
To learn more read Eisenbud, Commutative Algebra, Chapter 12.
Here is an example from Computations in Algebraic Geometry with Macaulay2, pp. 61:
i1 : R = QQ[x,y,z]; |
i2 : RP = localRing(R, ideal gens R); |
i3 : I = ideal"x5+y3+z3,x3+y5+z3,x3+y3+z5" 5 3 3 5 3 3 5 3 3 o3 = ideal (x + y + z , y + x + z , z + x + y ) o3 : Ideal of RP |
i4 : M = RP^1/I o4 = cokernel | x5+y3+z3 y5+x3+z3 z5+x3+y3 | 1 o4 : RP-module, quotient of RP |
i5 : elapsedTime hilbertSamuelFunction(M, 0, 6) -- 1.05746 seconds elapsed o5 = {1, 3, 6, 7, 6, 3, 1} o5 : List |
i6 : oo//sum o6 = 27 |
An example of using a parameter ideal:
i7 : R = ZZ/32003[x,y]; |
i8 : RP = localRing(R, ideal gens R); |
i9 : N = RP^1 1 o9 = RP o9 : RP-module, free |
i10 : q = ideal"x2,y3" 2 3 o10 = ideal (x , y ) o10 : Ideal of RP |
i11 : elapsedTime hilbertSamuelFunction(N, 0, 5) -- n+1 -- 0.02 seconds -- 0.239361 seconds elapsed o11 = {1, 2, 3, 4, 5, 6} o11 : List |
i12 : elapsedTime hilbertSamuelFunction(q, N, 0, 5) -- 6(n+1) -- 0.32 seconds -- 1.55967 seconds elapsed o12 = {6, 12, 18, 24, 30, 36} o12 : List |
Hilbert-Samuel function with respect to a parameter ideal other than the maximal ideal can be slower.
The object hilbertSamuelFunction is a method function.