# randomComplexMap(Complex,Complex) -- a random map of chain complexes

## Synopsis

• Function: randomComplexMap
• Usage:
f = randomComplexMap(C,D)
• Inputs:
• C, ,
• D, ,
• Optional inputs:
• Boundary => , default value false, whether the constructed f is a null homotopy
• Cycle => , default value false, whether the constructed f commutes with the differentials
• Degree => an integer, default value 0, the degree of the constructed map of chain complexes
• InternalDegree => a list, default value null, or an integer
• Outputs:
• f, ,

## Description

A random complex map $f : C \to D$ is obtained from a random element in the complex $Hom(C,D)$.

 i1 : S = ZZ/101[a..c] o1 = S o1 : PolynomialRing i2 : C = freeResolution coker matrix{{a*b, a*c, b*c}} 1 3 2 o2 = S <-- S <-- S 0 1 2 o2 : Complex i3 : D = freeResolution coker vars S 1 3 3 1 o3 = S <-- S <-- S <-- S 0 1 2 3 o3 : Complex i4 : f = randomComplexMap(D,C) 1 1 o4 = 0 : S <---------- S : 0 | 24 | 3 3 1 : S <-------------------------------------------------- S : 1 {1} | -36a-30b-29c -29a-24b-38c -39a-18b-13c | {1} | 19a+19b-10c -16a+39b+21c -43a-15b-28c | {1} | -29a-8b-22c 34a+19b-47c -47a+38b+2c | 3 2 2 : S <------------------------------------- S : 2 {2} | 16a+22b+45c 7a+15b-23c | {2} | -34a-48b-47c 39a+43b-17c | {2} | 47a+19b-16c -11a+48b+36c | o4 : ComplexMap i5 : assert isWellDefined f i6 : assert not isCommutative f i7 : assert not isNullHomotopic f

When the random element in the complex $Hom(C,D)$ lies in the kernel of the differential, the associated map of complexes commutes with the differential.

 i8 : g = randomComplexMap(D,C, Cycle => true) 1 1 o8 = 0 : S <----------- S : 0 | -50 | 3 3 1 : S <------------------------------------- S : 1 {1} | 40b-35c -46b+18c 28b+3c | {1} | 11a-11c 46a+22c -28a-37c | {1} | 35a+11b 33a-22b -3a-13b | 3 2 2 : S <------------------------------------- S : 2 {2} | 46b-49c -28a-46b+17c | {2} | -30b-35c -3a+b | {2} | -38a-22b-11c -47a+22b | o8 : ComplexMap i9 : assert isWellDefined g i10 : assert isCommutative g i11 : assert isComplexMorphism g i12 : assert not isNullHomotopic g

When the random element in the complex $Hom(C,D)$ lies in the image of the differential, the associated map of complexes is a null homotopy.

 i13 : h = randomComplexMap(D,C, Boundary => true) 1 1 o13 = 0 : S <----- S : 0 0 3 3 1 : S <------------------------------------- S : 1 {1} | 23b+7c -29b+47c 37b+13c | {1} | -23a-2c 29a-15c -37a+10c | {1} | -7a+2b -47a+15b -13a-10b | 3 2 2 : S <----------------------------------- S : 2 {2} | 29b-48c -37a-29b-18c | {2} | 24b+7c -13a-36b | {2} | 30a+15b-2c -28a-15b | o13 : ComplexMap i14 : assert isWellDefined h i15 : assert isCommutative h i16 : assert isComplexMorphism h i17 : assert isNullHomotopic h i18 : nullHomotopy h 3 1 o18 = 1 : S <----- S : 0 0 3 3 2 : S <----------------------- S : 1 {2} | -23 29 -37 | {2} | -7 -47 -13 | {2} | 2 15 -10 | 1 2 3 : S <------------------ S : 2 {3} | 30 -18 | o18 : ComplexMap

When the degree of the random element in the complex $Hom(C,D)$ is non-zero, the associated map of complexes has the same degree.

 i19 : p = randomComplexMap(D, C, Cycle => true, Degree => -1) 1 o19 = -1 : 0 <----- S : 0 0 1 3 0 : S <----------------------------------------------------------------------------------------------- S : 1 | 19a2-30ab+36b2+40ac+4bc-32c2 36a2+42ab-33b2+13ac-30bc+9c2 20a2+12ab-44b2-13ac-16bc+26c2 | 3 2 1 : S <----------------------------------------------------------------------- S : 2 {1} | -10ab-31b2-20ac+31bc-39c2 -20a2+24ab-48b2-30ac-15bc+39c2 | {1} | -26a2-11ab+33b2+34bc+4c2 33ab-33b2-49ac-19bc+17c2 | {1} | 39a2+27ab+32b2-22ac-9bc-32c2 43a2-8ab-11b2+36ac-8bc | o19 : ComplexMap i20 : assert isWellDefined p i21 : assert isCommutative p i22 : assert not isComplexMorphism p i23 : assert(degree p === -1)

By default, the random element is constructed as a random linear combination of the basis elements in the appropriate degree of $Hom(C,D)$. Given an internal degree, the random element is constructed as maps of modules with this degree.

 i24 : q = randomComplexMap(D, C, Boundary => true, InternalDegree => 2) 1 1 o24 = 0 : S <----------------------------------- S : 0 | -3a2+19ab+16b2-36ac+7bc-9c2 | 3 3 1 : S <--------------------------------------------------------------------------------------------------------------------------------------------------------------------- S : 1 {1} | 32a2b-22ab2-40b3-25a2c-36abc-3b2c+2ac2-29bc2+49c3 47a2b-27ab2-37b3+36a2c+49abc-37b2c+18ac2-22bc2-30c3 -28a2b+18ab2-b3-10a2c+45abc+26b2c-30ac2+9bc2+13c3 | {1} | -35a3+41a2b-45ab2+6a2c-25abc+13b2c-31ac2-4bc2-30c3 -47a3+27a2b+37ab2+a2c-19abc+37b2c+42ac2-47bc2+49c3 28a3-18a2b+ab2+43a2c+21abc+8b2c-30ac2+bc2-30c3 | {1} | 25a3-6a2b+35ab2-13b3-2a2c-50abc+4b2c-49ac2+30bc2 -39a3-31a2b-29ab2-37b3+47a2c-13abc+47b2c+21ac2-49bc2 10a3+10a2b-28ab2+8b3+30a2c-15abc+6b2c-13ac2+21bc2 | 3 2 2 : S <------------------------------------------------------------------------------------------------------------------------------ S : 2 {2} | -47a2b+27ab2+37b3-11a2c+9abc-33b2c-24ac2-11bc2+3c3 28a3+29a2b-26ab2-37b3+46a2c-21abc+50b2c-22ac2+49bc2-16c3 | {2} | 7a2b+21ab2+30b3-25a2c-30abc+30b2c+2ac2-2bc2+49c3 10a3+46a2b+44ab2+14b3+30a2c+31abc+30b2c-13ac2-14bc2 | {2} | -46a3+49a2b+42ab2-37b3-18a2c+23abc-41b2c-28ac2+48bc2-30c3 3a3-41a2b+23ab2+37b3+8a2c-11abc-47b2c+14ac2+49bc2 | o24 : ComplexMap i25 : assert all({0,1,2}, i -> degree q_i === {2}) i26 : assert isHomogeneous q i27 : assert isWellDefined q i28 : assert isCommutative q i29 : assert isComplexMorphism q i30 : source q === C o30 = true i31 : target q === D o31 = true i32 : assert isNullHomotopic q