# ComplexMap == ComplexMap -- whether two complex maps are equal

## Synopsis

• Operator: ==
• Usage:
f == g
f == 0
f == 1
• Inputs:
• f, , or 0, or 1.
• g, , or 0, or 1.
• Outputs:
• , that is true when f and g are equal

## Description

Two complex maps are equal if they have the same source, the same target, and $f_i = g_i$ for all $i$.

 i1 : S = ZZ/101[a..c] o1 = S o1 : PolynomialRing i2 : C = freeResolution coker vars S 1 3 3 1 o2 = S <-- S <-- S <-- S 0 1 2 3 o2 : Complex i3 : f = id_C 1 1 o3 = 0 : S <--------- S : 0 | 1 | 3 3 1 : S <----------------- S : 1 {1} | 1 0 0 | {1} | 0 1 0 | {1} | 0 0 1 | 3 3 2 : S <----------------- S : 2 {2} | 1 0 0 | {2} | 0 1 0 | {2} | 0 0 1 | 1 1 3 : S <------------- S : 3 {3} | 1 | o3 : ComplexMap i4 : assert(f == 1) i5 : f === id_C[-1][1] o5 = false i6 : f == id_C[-1][1] o6 = true

A complex map is equal to zero if all the maps are zero. This could require computation to determine if something that is superficially not zero is in fact zero.

 i7 : assert(0 * id_C == 0)
 i8 : g = randomComplexMap(C, C) 1 1 o8 = 0 : S <---------- S : 0 | 24 | 3 3 1 : S <----------------------- S : 1 {1} | -36 19 -29 | {1} | -30 19 -8 | {1} | -29 -10 -22 | 3 3 2 : S <----------------------- S : 2 {2} | -29 -16 34 | {2} | -24 39 19 | {2} | -38 21 -47 | 1 1 3 : S <--------------- S : 3 {3} | -39 | o8 : ComplexMap i9 : h = canonicalMap(coker g, target g) 1 o9 = 0 : cokernel | 24 | <----- S : 0 0 3 1 : cokernel {1} | -36 19 -29 | <----- S : 1 {1} | -30 19 -8 | 0 {1} | -29 -10 -22 | 3 2 : cokernel {2} | -29 -16 34 | <----- S : 2 {2} | -24 39 19 | 0 {2} | -38 21 -47 | 1 3 : cokernel {3} | -39 | <----- S : 3 0 o9 : ComplexMap i10 : assert(h == 0)

Testing whether a map is equal to 1 is a shorthand for determining if the complex map is the identity. Although the matrices may appear to be the identity, the map is not the identity when the source and target are not equal.

 i11 : g = randomComplexMap(C, C, InternalDegree=>1, Cycle=>true) 1 1 o11 = 0 : S <------------------- S : 0 | -33a-3b+13c | 3 3 1 : S <--------------------------------------------- S : 1 {1} | -33a+25b-41c -37b+34c -45b+33c | {1} | -28a+16c 4a-3b+4c 45a-37c | {1} | -47a-16b -34a+9b 35a+34b+13c | 3 3 2 : S <---------------------------------------------- S : 2 {2} | 4a+25b-43c 45a+38c 45b-22c | {2} | -34a+2b 35a-13b-41c -48b+34c | {2} | -47a+16b 47a+16c -18a+34b+4c | 1 1 3 : S <------------------------ S : 3 {3} | -18a-13b-43c | o11 : ComplexMap i12 : h = canonicalMap(coker g, target g) 1 o12 = 0 : cokernel | -33a-3b+13c | <--------- S : 0 | 1 | 3 1 : cokernel {1} | -33a+25b-41c -37b+34c -45b+33c | <----------------- S : 1 {1} | -28a+16c 4a-3b+4c 45a-37c | {1} | 1 0 0 | {1} | -47a-16b -34a+9b 35a+34b+13c | {1} | 0 1 0 | {1} | 0 0 1 | 3 2 : cokernel {2} | 4a+25b-43c 45a+38c 45b-22c | <----------------- S : 2 {2} | -34a+2b 35a-13b-41c -48b+34c | {2} | 1 0 0 | {2} | -47a+16b 47a+16c -18a+34b+4c | {2} | 0 1 0 | {2} | 0 0 1 | 1 3 : cokernel {3} | -18a-13b-43c | <------------- S : 3 {3} | 1 | o12 : ComplexMap i13 : assert(h != 1)

Testing for equality is not the same testing for isomorphism. In particular, different presentations of a complex need not be equal.

 i14 : D = prune image g 1 3 3 1 o14 = S <-- S <-- S <-- S 0 1 2 3 o14 : Complex i15 : p = D.cache.pruningMap 1 o15 = 0 : image | -33a-3b+13c | <------------- S : 0 {1} | 1 | 3 1 : image {1} | -33a+25b-41c -37b+34c -45b+33c | <----------------- S : 1 {1} | -28a+16c 4a-3b+4c 45a-37c | {2} | 1 0 0 | {1} | -47a-16b -34a+9b 35a+34b+13c | {2} | 0 1 0 | {2} | 0 0 1 | 3 2 : image {2} | 4a+25b-43c 45a+38c 45b-22c | <----------------- S : 2 {2} | -34a+2b 35a-13b-41c -48b+34c | {3} | 1 0 0 | {2} | -47a+16b 47a+16c -18a+34b+4c | {3} | 0 1 0 | {3} | 0 0 1 | 1 3 : image {3} | -18a-13b-43c | <------------- S : 3 {4} | 1 | o15 : ComplexMap i16 : p == 1 o16 = false i17 : assert(coker p == 0 and ker p == 0) i18 : assert(prune p == 1)