Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

problem extracting the differentials of a chain complex

I'm getting an error when trying to convert a simplicial complex into a chain complex and then extract the differential maps using the .differential operator.

def grid1d(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 < n1:
                    edges.append(((i,j,k),(i+1,j,k)))
                if j < n2:
                    edges.append(((i,j,k),(i,j+1,k)))
                if k < n3:
                    edges.append(((i,j,k),(i,j,k+1)))
    return edges

comp = SimplicialComplex(grid1d(3))
chain = comp.chain_complex()
chain.differential()

Everything runs but the last line which gives me the error:

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

File "/tmp/tmpZ7wtbe/___code___.py", line 5, in module exec compile(u'chain.differential() File "", line 1, in module

File "matrix0.pyx", line 1729, in sage.matrix.matrix0.Matrix.__repr__ (sage/matrix/matrix0.c:9374) File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/misc/sageinspect.py", line 1915, in sage_getvariablename for frame in inspect.stack(): File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1054, in stack return getouterframes(sys._getframe(1), context) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1032, in getouterframes framelist.append((frame,) + getframeinfo(frame, context)) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1007, in getframeinfo lines, lnum = findsource(frame) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 528, in findsource if not sourcefile and file[0] + file[-1] != '<>': IndexError: string index out of range

Any help resolving this problem would be greatly appreciated.

problem extracting the differentials of a chain complex

I'm getting an error when trying to convert a simplicial complex into a chain complex and then extract the differential maps using the .differential operator.

def grid1d(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 < n1:
                    edges.append(((i,j,k),(i+1,j,k)))
                if j < n2:
                    edges.append(((i,j,k),(i,j+1,k)))
                if k < n3:
                    edges.append(((i,j,k),(i,j,k+1)))
    return edges

comp = SimplicialComplex(grid1d(3))
chain = comp.chain_complex()
chain.differential()

Everything runs but the last line which gives me the error:

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

File "/tmp/tmpZ7wtbe/___code___.py", line 5, in module exec compile(u'chain.differential() File "", line 1, in module

File "matrix0.pyx", line 1729, in sage.matrix.matrix0.Matrix.__repr__ (sage/matrix/matrix0.c:9374) File "/home/sage/sage-5.9/local/lib/python2.7/site-packages/sage/misc/sageinspect.py", line 1915, in sage_getvariablename for frame in inspect.stack(): File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1054, in stack return getouterframes(sys._getframe(1), context) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1032, in getouterframes framelist.append((frame,) + getframeinfo(frame, context)) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 1007, in getframeinfo lines, lnum = findsource(frame) File "/home/sage/sage-5.9/local/lib/python/inspect.py", line 528, in findsource if not sourcefile and file[0] + file[-1] != '<>': IndexError: string index out of range

Any help resolving this problem would be greatly appreciated.