# complex(Module) -- make a chain complex of length zero

## Description

In contrast to complex(HashTable) and complex(List), this constructor provides a convenient method to construct a complex with only one non-zero component.

We illustrate this with a free module.

 i1 : S = ZZ/101[a..d] o1 = S o1 : PolynomialRing i2 : C0 = complex S^2 2 o2 = S 0 o2 : Complex i3 : f = dd^C0 o3 = 0 o3 : ComplexMap i4 : source f, target f 2 2 o4 = (S , S ) 0 0 o4 : Sequence i5 : f == 0 o5 = true i6 : isWellDefined C0 o6 = true i7 : C0 == 0 o7 = false i8 : length C0 o8 = 0
 i9 : C1 = complex(S^2, Base=>3) 2 o9 = S 3 o9 : Complex i10 : C1 == C0[-3] o10 = true i11 : C1_3 2 o11 = S o11 : S-module, free i12 : C1_0 o12 = 0 o12 : S-module

A ring or an ideal will be converted to a module first.

 i13 : C2 = complex S 1 o13 = S 0 o13 : Complex i14 : I = ideal(a^2-b, c^3) 2 3 o14 = ideal (a - b, c ) o14 : Ideal of S i15 : C3 = complex I o15 = image | a2-b c3 | 0 o15 : Complex i16 : C4 = complex (S/I) / S \1 o16 = |------------| | 2 3 | \(a - b, c )/ 0 o16 : Complex i17 : (ring C3, ring C4) S o17 = (S, ------------) 2 3 (a - b, c ) o17 : Sequence

The zero complex over a ring S is most conveniently created by giving the zero module.

 i18 : C5 = complex S^0 o18 = 0 0 o18 : Complex i19 : C5 == 0 o19 = true i20 : dd^C5 == 0 o20 = true i21 : C5_0 o21 = 0 o21 : S-module