# regularity(Complex) -- compute the Castelnuovo-Mumford regularity

## Description

Given a free complex $C$ over a standard graded polynomial ring, the regularity $r$ of $C$ is the smallest integer such that each basis element of $C_i$ has degree at most $i + r$.

 i1 : R = ZZ/101[a..d]; i2 : I = ideal(b^2-a*c, b*c-a*d, c^2-b*d) 2 2 o2 = ideal (b - a*c, b*c - a*d, c - b*d) o2 : Ideal of R i3 : C = freeResolution(R^1/I) 1 3 2 o3 = R <-- R <-- R 0 1 2 o3 : Complex i4 : betti C 0 1 2 o4 = total: 1 3 2 0: 1 . . 1: . 3 2 o4 : BettiTally i5 : regularity C o5 = 1 i6 : regularity I o6 = 2 i7 : regularity (R^1/I) o7 = 1 i8 : assert(regularity C === regularity(R^1/I))

The regularity is the label of the last row of the Betti table of $C$.

 i9 : betti C 0 1 2 o9 = total: 1 3 2 0: 1 . . 1: . 3 2 o9 : BettiTally i10 : betti(C[3]) -3 -2 -1 o10 = total: 1 3 2 3: 1 . . 4: . 3 2 o10 : BettiTally i11 : regularity(C[3]) o11 = 4

Here is a slightly more complicated example.

 i12 : J = ideal(a^3, b^3, c^3, d^3, (a+b+c+d)^3); o12 : Ideal of R i13 : FJ = freeResolution J 1 5 17 20 7 o13 = R <-- R <-- R <-- R <-- R 0 1 2 3 4 o13 : Complex i14 : betti FJ 0 1 2 3 4 o14 = total: 1 5 17 20 7 0: 1 . . . . 1: . . . . . 2: . 5 . . . 3: . . . . . 4: . . 16 10 1 5: . . 1 10 6 o14 : BettiTally i15 : regularity FJ o15 = 5

Although Castelnuovo-Mumford regularity is defined in more general settings (e.g. toric varieties with multi-degrees) this method does not currently handle these extensions. Similarly, Castelnuovo-Mumford regularity can be defined for non-free complexes, but this method doesn't handle that case either.