# How to make filtered complexes from chain complex maps

We describe the most primitative way to create filtered complexes.

Let C be a chain complex and consider a list of chain complex maps n, φn - 1, …, φ0 } with properties that C is the target of φi, for 0 ≤i ≤n, and the image of φi-1 is a subchain complex of the image of φi, for 1 ≤i ≤n. Given this input data we produce an ascending filtered chain complex FC with the properties that Fk C = C for k ≥n + 1 and Fk C = image φk, for k = 0, …, n.

We now illustrate how this is done in two easy examples. We first make three chain complexes C, D, and E, two chain complex maps, d : D →C and e : E →C, and then compute the resulting filtration of C.

Let’s make our chain complexes C, D, and E.

 `i1 : R = QQ[x,y,z,w] ;` ```i2 : c2 = matrix(R,{{1},{0}}) ; 2 1 o2 : Matrix R <--- R``` ```i3 : c1 = matrix(R,{{0,1}}) ; 1 2 o3 : Matrix R <--- R``` ```i4 : C = chainComplex({c1,c2}) 1 2 1 o4 = R <-- R <-- R 0 1 2 o4 : ChainComplex``` `i5 : D_2 = image matrix(R,{{1}});` `i6 : D_1 = image matrix(R,{{1,0},{0,0}});` `i7 : D_0 = image matrix(R,{{1}});` ```i8 : D = chainComplex({inducedMap(D_0,D_1,C.dd_1),inducedMap(D_1,D_2,C.dd_2)}) o8 = image | 1 | <-- image | 1 0 | <-- image | 1 | | 0 0 | 0 2 1 o8 : ChainComplex``` `i9 : E_2 = image matrix(R,{{0}});` `i10 : E_1 = image matrix(R,{{1,0},{0,0}});` `i11 : E_0 = image matrix(R,{{1}});` ```i12 : E = chainComplex({inducedMap(E_0,E_1,C.dd_1),inducedMap(E_1,E_2,C.dd_2)}) o12 = image | 1 | <-- image | 1 0 | <-- image 0 | 0 0 | 0 2 1 o12 : ChainComplex```

We now make our chain complex maps.

 ```i13 : d = chainComplexMap(C,D,apply(spots C, i-> inducedMap(C_i,D_i,id_C _i))) 1 o13 = 0 : R <--------- image | 1 | : 0 | 1 | 2 1 : R <----------- image | 1 0 | : 1 | 1 0 | | 0 0 | | 0 0 | 1 2 : R <--------- image | 1 | : 2 | 1 | o13 : ChainComplexMap``` ```i14 : e = chainComplexMap(C,E,apply(spots C, i->inducedMap(C_i,E_i, id_C _i))) 1 o14 = 0 : R <--------- image | 1 | : 0 | 1 | 2 1 : R <----------- image | 1 0 | : 1 | 1 0 | | 0 0 | | 0 0 | 1 2 : R <----- image 0 : 2 0 o14 : ChainComplexMap```

We can check that these are indeed chain complex maps:

 ```i15 : isChainComplexMap d o15 = true``` ```i16 : isChainComplexMap e o16 = true```

Now, given the list of chain complex maps {d, e}, we obtain a filtration of C by:

 ```i17 : K = filteredComplex({d,e}) o17 = -1 : image 0 <-- image 0 <-- image 0 0 1 2 0 : image | 1 | <-- image | 1 0 | <-- image 0 | 0 0 | 0 2 1 1 : image | 1 | <-- image | 1 0 | <-- image | 1 | | 0 0 | 0 2 1 1 2 1 2 : R <-- R <-- R 0 1 2 o17 : FilteredComplex```

If we want to specify a minimum filtration degree we can use the Shift option.

 ```i18 : L = filteredComplex({d,e},Shift =>1) o18 = -2 : image 0 <-- image 0 <-- image 0 0 1 2 -1 : image | 1 | <-- image | 1 0 | <-- image 0 | 0 0 | 0 2 1 0 : image | 1 | <-- image | 1 0 | <-- image | 1 | | 0 0 | 0 2 1 1 2 1 1 : R <-- R <-- R 0 1 2 o18 : FilteredComplex``` ```i19 : M = filteredComplex({d,e},Shift =>-1) o19 = 0 : image 0 <-- image 0 <-- image 0 0 1 2 1 : image | 1 | <-- image | 1 0 | <-- image 0 | 0 0 | 0 2 1 2 : image | 1 | <-- image | 1 0 | <-- image | 1 | | 0 0 | 0 2 1 1 2 1 3 : R <-- R <-- R 0 1 2 o19 : FilteredComplex```