# Generators of simplicial homology

I have this code to compute the homology of a simplicial complex

S = SimplicialComplex([[5, 2], [5, 2, 1], [5, 0], [5, 1], [4, 3], [4, 3, 0], [4, 2], [4, 0], [3, 0], [3, 1], [2, 1],])
S.homology(generators = True)


The output only consists of the homology, and does not contain the generators. Am I missing something?

edit retag close merge delete

Sort by » oldest newest most voted This looks like a missing feature and/or a bug. Note that the documentation for S.homology() says, regarding generators:

Since trac ticket #6100, the result may not be what you expect when not using CHomP since its return is in terms of the chain complex.

The bug is that there is no result at all, but you can recover it by doing:

sage: S.chain_complex().homology(generators=True)
{0: [(Z, Chain(0:(0, 0, 0, 1, 0, 0)))],
1: [(Z, Chain(1:(0, 1, -1, 0, 0, 0, -1, 1, 0))),
(Z, Chain(1:(0, 0, 0, 0, 1, -1, -1, 1, 1)))],
2: []}


To interpret this, you need to know how the simplicial complex is turned into a chain complex. The simplices in each dimension are sorted in order to construct the matrices representing the boundary maps, so to get the first generator in dimension 1, for example, you would look at

sage: S._n_cells_sorted(1)
[(0, 3), (0, 4), (0, 5), (1, 2), (1, 3), (1, 5), (2, 4), (2, 5), (3, 4)]


The first generator is given by (0, 1, -1, 0, 0, 0, -1, 1, 0), which means the sum of 1 x (item 1 in list), -1 x (item 2), etc.:

(0, 4) - (0, 5) - (2, 4) + (2, 5)

more

1

I don't think it's perfect — it should be fixed — but I'm glad it's helpful.

1