# homology of simplicial complexes

I am building a simplicial complex as follows:

sage: S = range(1,7)
sage: Z = SimplicialComplex([S])
sage: T = Z.n_skeleton(1)
sage: T.faces()
{0: set([(4,), (5,), (3,), (1,), (6,), (2,)]), 1: set([(2, 4), (3, 6),
(5, 6), (2, 6), (1, 4), (3, 5), (3, 4), (2, 3), (4, 6), (2, 5), (1, 2),
(1, 3), (4, 5), (1, 5), (1, 6)]), -1: set([()])}
sage: T.homology()
{0: 0, 1: Z^10}


So far everything seems good. Then I try adding a face to T.

sage: T.add_face([1,2,6])
sage: T.faces()
{0: set([(4,), (5,), (3,), (1,), (6,), (2,)]), 1: set([(2, 4), (3, 6),
(5, 6), (1, 5), (1, 4), (3, 5), (3, 4), (2, 3), (4, 6), (2, 5), (1, 2),
(1, 3), (1, 6), (2, 6), (4, 5)]), 2: set([(1, 2, 6)]), -1: set([()])}


So the face seems to have been added.

But then:

sage: T.homology()


results in:

{0: 0, 1: Z^10, 2: 0}


But this doesn't make any sense --- it should say 0:0, 1:Z^9, 2:0, since adding a 2-face kills a class in $H_1(T)$.

Can anyone tell what I'm doing wrong?

edit retag close merge delete

1

[2015-01-05: Just fixed code formatting of this 2013 question. By the way, the patch from ticket #14354 mentioned in John Palmieri's answer was merged in Sage 5.9.beta2, and running the example in the question now gives the correct answer.] [Matt: you could mark John's answer as accepted by clicking the tick mark.]

( 2015-01-05 11:26:00 +0100 )edit

Sort by » oldest newest most voted

There's a bug in the add_face method. Various information about simplicial complexes is cached, especially when computing homology, and when you call add_face, it doesn't modify that cached information, so the homology computation is for the old complex, not the new one. See here for a patch. Meanwhile, as a workaround, do

sage: T.add_face([1,2,6])
sage: T1 = SimplicialComplex(T.facets())


Then T1 will have the correct facets but no cached data, so its homology will be correct.

more