A new chain complex can be made with C = new ChainComplex. This will automatically initialize C.dd, in which the differentials are stored. The modules can be installed with statements like C#i=M and the differentials can be installed with statements like C.dd#i=d. The ring is installed with C.ring = R. It's up to the user to ensure that the composite of consecutive differential maps is zero.
i1 : R = QQ[x,y,z]; |
i2 : d1 = matrix {{x,y}}; |
We take care to use map to ensure that the target of d2 is exactly the same as the source of d1.
i3 : d2 = map(source d1, ,{{y*z},{-x*z}}); |
i4 : d1 * d2 == 0 |
Now we make the chain complex, as explained above.
i5 : C = new ChainComplex; C.ring = R; |
i7 : C#0 = target d1; C#1 = source d1; C#2 = source d2; |
i10 : C.dd#1 = d1; C.dd#2 = d2; |
Our complex is ready to use.
i12 : C |
i13 : HH_0 C |
i14 : prune HH_1 C |
The chain complex we've just made is simple, in the sense that it's a homological chain complex with nonzero modules in degrees 0, 1, ..., n. Such a chain complex can be made also with chainComplex. It goes to a bit of extra trouble to adjust the differentials to match the degrees of the basis elements.
i15 : D = chainComplex(matrix{{x,y}}, matrix {{y*z},{-x*z}}) |
i16 : degrees source D.dd_2 |