# Revision history [back]

### error computing homology of a simplicial complex

I'm running code to first generate a simplicial complex that is just a 3 dimensional lattice. I'm then adding square plaquettes. However, I get an error sometimes when I try to calculate homology. Specifically, when I run the code below I get the error:

ValueError: The differentials d_{2} and d_{1} are not compatible: their composition is not zero.

This seems strange since a simplicial complex should always have homology. The error persists even when I specify the homology function to use different algorithms.

def grid(n1, n2=None, n3=None):
if n2 == None:
n2 = n1
if n3 == None:
n3 = n1
edges = []
for i in range(n1+1):
for j in range(n2+1):
for k in range(n3+1):
if i < n:
edges.append(((i,j,k),(i+1,j,k)))
if j < n:
edges.append(((i,j,k),(i,j+1,k)))
if k < n:
edges.append(((i,j,k),(i,j,k+1)))
return edges

t0 = SimplicialComplex(grid(2))
t0.homology()


The full text of the error is:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_8.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("I2dpdmVzIGVycm9yIHNhdmUhISEKdDAgPSBTaW1wbGljaWFsQ29tcGxleChncmlkKDIpKQphZGRfcGxhcXVldHRlKHQwLCAoMCwwLDEsMCkpCmFkZF9wbGFxdWV0dGUodDAsICgwLDAsMSwxKSkKYWRkX3BsYXF1ZXR0ZSh0MCwgKDIsMiwwLDEpKQp0MC5ob21vbG9neSgp"),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/tmp/tmpBNPSQ1/___code___.py", line 7, in <module> exec compile(u't0.homology() File "", line 1, in <module>

File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/homology/cell_complex.py", line 549, in homology return self._homology_(dim, *kwds) File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/homology/simplicial_complex.py", line 1925, in _homology_ cochain=cohomology, *kwds) File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/homology/simplicial_complex.py", line 1788, in chain_complex return ChainComplex(data=differentials, degree=-1, **kwds) File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/homology/chain_complex.py", line 462, in __init__ raise ValueError, "The differentials d_{%s} and d_{%s} are not compatible: their composition is not zero." % (n, n+degree) ValueError: The differentials d_{2} and d_{1} are not compatible: their composition is not zero.

 2 retagged tmonteil 25528 ●29 ●183 ●476 http://wiki.sagemath.o...

### error computing homology of a simplicial complex

I'm running code to first generate a simplicial complex that is just a 3 dimensional lattice. I'm then adding square plaquettes. However, I get an error sometimes when I try to calculate homology. Specifically, when I run the code below I get the error:

ValueError: The differentials d_{2} and d_{1} are not compatible: their composition is not zero.

This seems strange since a simplicial complex should always have homology. The error persists even when I specify the homology function to use different algorithms.

def grid(n1, n2=None, n3=None):
if n2 == None:
n2 = n1
if n3 == None:
n3 = n1
edges = []
for i in range(n1+1):
for j in range(n2+1):
for k in range(n3+1):
if i < n:
edges.append(((i,j,k),(i+1,j,k)))
if j < n:
edges.append(((i,j,k),(i,j+1,k)))
if k < n:
edges.append(((i,j,k),(i,j,k+1)))
return edges

t0 = SimplicialComplex(grid(2))