Macaulay2 » Documentation
Packages » Macaulay2Doc » modules » Module » length(Module)
next | previous | forward | backward | up | index | toc

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

- Function: length
- Usage:
    `l = length M`
- Inputs:
  - M, a module,
- Outputs:
  - l, an integer, the length of M
- Consequences:
  - In the local case, the length of the module is stored in M.cache.length.

## Description

If M is a graded module over a singly graded polynomial ring or a quotient of a polynomial ring over a field k then length is the same as the degree.

If M is over a local ring then length is computed by summing the output of the Hilbert-Samuel function until it vanishes. Note that in this case the LocalRings package must be loaded first.

## Caveat

In the local case, the input is assumed to have finite length.

## See also

- degree(Module) -- get the degree of a module

## Ways to use this method:

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

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