# complex(HashTable) -- make a chain complex

## Synopsis

• Function: complex
• Usage:
complex H
• Inputs:
• H, , each key is an integer indexing a differential, and the value at that key is the map
• Optional inputs:
• Base => an integer, default value 0, ignored when the input is a hash table
• Outputs:
• ,

## Description

A complex is a sequence of objects (e.g. modules), connected by maps called differentials. The composition of any two consecutive maps is zero.

The same data type is used for both chain and cochain complexes. If C is a complex, then we have C^i = C_{-i}.

We construct the Koszul complex on the generators for the ideal of the twisted cubic curve.

 i1 : S = ZZ/101[a..d] o1 = S o1 : PolynomialRing 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 S i3 : F1 = map(S^1,,matrix{{I_0, I_1, I_2}}) o3 = | b2-ac bc-ad c2-bd | 1 3 o3 : Matrix S <--- S i4 : F2 = map(source F1,,matrix{ {0, I_2, -I_1}, {-I_2, 0, I_0}, {I_1, -I_0, 0} }) o4 = {2} | 0 c2-bd -bc+ad | {2} | -c2+bd 0 b2-ac | {2} | bc-ad -b2+ac 0 | 3 3 o4 : Matrix S <--- S i5 : F3 = map(source F2,,matrix{{I_0}, {I_1}, {I_2}}) o5 = {4} | b2-ac | {4} | bc-ad | {4} | c2-bd | 3 1 o5 : Matrix S <--- S i6 : C = complex hashTable{1 => F1, 2 => F2, 3 => F3} 1 3 3 1 o6 = S <-- S <-- S <-- S 0 1 2 3 o6 : Complex i7 : isWellDefined C o7 = true

This is the primary constructor used by all of the more user friendly methods for constructing a chain complex.

## Caveat

This constructor minimizes computation and does very little error checking. To verify that a complex is well constructed, use isWellDefined(Complex).