Macaulay2 » Documentation
Packages » LocalRings :: hilbertSamuelFunction
next | previous | forward | backward | up | index | toc

# hilbertSamuelFunction -- Computes the Hilbert-Samuel Function of Modules over Local Rings

- Usage:
    `h = hilbertSamuelFunction(M, n)`
    `L = hilbertSamuelFunction(M, n0, n1)`
    `h = hilbertSamuelFunction(q, M, n)`
    `L = hilbertSamuelFunction(q, M, n0, n1)`
- Inputs:
  - M, a module, a module over a local ring
  - n, an integer, single input to the function
  - n0, an integer, first input to the function
  - n1, an integer, last input to the function
  - q, an ideal, a parameter ideal
- Outputs:
  - h, an integer, the integer output of the Hilbert-Samuel function
  - L, a sequence, an sequence of integer outputs of the Hilbert-Samuel function

## Description

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)
     -- .26013s 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
     -- .0704747s elapsed

    o11 = {1, 2, 3, 4, 5, 6}

    o11 : List

    i12 : elapsedTime hilbertSamuelFunction(q, N, 0, 5) -- 6(n+1) -- 0.32 seconds
     -- .267248s elapsed

    o12 = {6, 12, 18, 24, 30, 36}

    o12 : List

## Caveat

Hilbert-Samuel function with respect to a parameter ideal other than the maximal ideal can be slower.

## See also

- length(Module) -- compute the length of a module

## Ways to use hilbertSamuelFunction:

- `hilbertSamuelFunction(Ideal,Module,ZZ)`
- `hilbertSamuelFunction(Ideal,Module,ZZ,ZZ)`
- `hilbertSamuelFunction(Module,ZZ)`
- `hilbertSamuelFunction(Module,ZZ,ZZ)`

## For the programmer

The object hilbertSamuelFunction is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/LocalRings/doc.m2:371:0.