# length(Complex) -- length of a complex

## Synopsis

• Function: length
• Usage:
length C
• Inputs:
• C, ,
• Outputs:

## Description

The length of a complex is the difference between the highest index of a non-zero object and the lowest index of a non-zero object.

Typically, it counts the number of non-zero differentials, e.g. in a free resolution.

 i1 : S = ZZ/101[a,b,c,d]; i2 : C1 = freeResolution coker vars S 1 4 6 4 1 o2 = S <-- S <-- S <-- S <-- S 0 1 2 3 4 o2 : Complex i3 : length C1 o3 = 4 i4 : C2 = C1[5] 1 4 6 4 1 o4 = S <-- S <-- S <-- S <-- S -5 -4 -3 -2 -1 o4 : Complex i5 : length C2 o5 = 4 i6 : C3 = C1 ++ C1[6] 1 4 6 4 1 1 4 6 4 1 o6 = S <-- S <-- S <-- S <-- S <-- 0 <-- S <-- S <-- S <-- S <-- S -6 -5 -4 -3 -2 -1 0 1 2 3 4 o6 : Complex i7 : length C3 o7 = 10

This function always prunes the input complex, so might involve computation.

 i8 : M1 = S^1/(a*b, c*d, a*c, b*c) o8 = cokernel | ab cd ac bc | 1 o8 : S-module, quotient of S i9 : M2 = S^1/(a*b, c*d, a*c) o9 = cokernel | ab cd ac | 1 o9 : S-module, quotient of S i10 : C4 = freeResolution M1 1 4 4 1 o10 = S <-- S <-- S <-- S 0 1 2 3 o10 : Complex i11 : C5 = freeResolution M2 1 3 2 o11 = S <-- S <-- S 0 1 2 o11 : Complex i12 : f = map(M1, M2, 1) o12 = | 1 | o12 : Matrix i13 : C6 = coker extend(C4, C5, matrix f) 1 o13 = cokernel | 1 | <-- cokernel {2} | 1 0 0 | <-- cokernel {3} | 1 0 | <-- S {2} | 0 1 0 | {3} | 0 0 | 0 {2} | 0 0 0 | {3} | 0 1 | 3 {2} | 0 0 1 | {3} | 0 0 | 1 2 o13 : Complex i14 : concentration C6 o14 = (0, 3) o14 : Sequence i15 : length C6 o15 = 2 i16 : prune C6 1 2 1 o16 = S <-- S <-- S 1 2 3 o16 : Complex i17 : concentration prune C6 o17 = (1, 3) o17 : Sequence