# chainComplex(List) -- make a chain complex

## Synopsis

• Function: chainComplex
• Usage:
C = chainComplex{f1,f2,f3,...}
C = chainComplex(f1,f2,f3,...)
• Inputs:
• f1,f2,f3,..., homomorphisms over the same ring, forming a complex
• Outputs:
• C, , the given complex, where f1 == C.dd_1, f2 == CC.dd_2, etc.

## Description

The maps f1, f2, ... must be defined over the same base ring, and they must form a complex: the target of f(i+1) is the source of fi.

The following example illustrates how chainComplex adjusts the degrees of the modules involved to ensure that sources and targets of the differentials correspond exactly.

 i1 : R = ZZ/101[x,y] o1 = R o1 : PolynomialRing i2 : C = chainComplex{matrix{{x,y}},matrix{{x*y},{-x^2}}} 1 2 1 o2 = R <-- R <-- R 0 1 2 o2 : ChainComplex
We check that that this is a complex:
 i3 : C.dd^2 == 0 o3 = true
The homology of this complex:
 i4 : HH C -- ker (107) called with OptionTable: OptionTable{SubringLimit => infinity} -- ker (107) returned CacheFunction: -*a cache function*- -- ker (107) called with Matrix: {1} | xy | -- {1} | -x2 | -- ker (107) returned Module: image 0 assert( ker(map(R^{{-1}, {-1}},R^{{-3}},{{x*y}, {-x^2}})) === (image(map(R^{{-3}},R^0,0)))) o4 = 0 : cokernel | x y | 1 : subquotient ({1} | -y |, {1} | xy |) {1} | x | {1} | -x2 | 2 : image 0 o4 : GradedModule