# complex(ChainComplex) -- translate between data types for chain complexes

## Synopsis

• Function: complex
• Usage:
D = complex C
• Inputs:
• C, ,
• Optional inputs:
• Base => ..., default value 0, make a chain complex
• Outputs:
• D, ,

## Description

Both ChainComplex and Complex are Macaulay2 types that implement chain complexes of modules over rings. The plan is to replace ChainComplex with this new type. Before this happens, this function allows interoperability between these types.

The first example is the minimal free resolution of the twisted cubic curve.

 i1 : R = ZZ/32003[a..d]; i2 : I = monomialCurveIdeal(R, {1,2,3}) 2 2 o2 = ideal (c - b*d, b*c - a*d, b - a*c) o2 : Ideal of R i3 : M = R^1/I o3 = cokernel | c2-bd bc-ad b2-ac | 1 o3 : R-module, quotient of R i4 : C = resolution M 1 3 2 o4 = R <-- R <-- R <-- 0 0 1 2 3 o4 : ChainComplex i5 : D = complex C 1 3 2 o5 = R <-- R <-- R 0 1 2 o5 : Complex i6 : D1 = freeResolution M 1 3 2 o6 = R <-- R <-- R 0 1 2 o6 : Complex i7 : assert(D == D1)

In the following example, note that a different choice of sign is chosen in the new Complexes package.

 i8 : C1 = Hom(C, R^1) 2 3 1 o8 = 0 <-- R <-- R <-- R -3 -2 -1 0 o8 : ChainComplex i9 : D1 = complex C1 2 3 1 o9 = R <-- R <-- R -2 -1 0 o9 : Complex i10 : D2 = Hom(D, R^1) 2 3 1 o10 = R <-- R <-- R -2 -1 0 o10 : Complex i11 : D1.dd_-1 o11 = {-3} | c -b a | {-3} | -d c -b | 2 3 o11 : Matrix R <--- R i12 : D2.dd_-1 o12 = {-3} | -c b -a | {-3} | d -c b | 2 3 o12 : Matrix R <--- R i13 : assert(D1 != D2)

## Caveat

This is a temporary method to allow comparisons among the data types, and will be removed once the older data structure is replaced