Ask Your Question

problem extracting the differentials of a chain complex

asked 2013-06-04 18:25:08 +0200

parsons.kyle.89 gravatar image

updated 2023-01-09 23:59:32 +0200

tmonteil gravatar image

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:
                if j < n2:
                if k < n3:
    return edges

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

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

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

File "/tmp/tmpZ7wtbe/", 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/", line 1915, in sage_getvariablename for frame in inspect.stack(): File "/home/sage/sage-5.9/local/lib/python/", line 1054, in stack return getouterframes(sys._getframe(1), context) File "/home/sage/sage-5.9/local/lib/python/", line 1032, in getouterframes framelist.append((frame,) + getframeinfo(frame, context)) File "/home/sage/sage-5.9/local/lib/python/", line 1007, in getframeinfo lines, lnum = findsource(frame) File "/home/sage/sage-5.9/local/lib/python/", 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.

edit retag flag offensive close merge delete


What happens if you do d0 = chain.differential(0) and d1 = chain.differential(1)? (This may be a bug in the code for displaying large matrices.)

John Palmieri gravatar imageJohn Palmieri ( 2013-06-05 11:28:51 +0200 )edit

Those both give errors nearly identical to the original error. However changing it to comp = SimplicialComplex(grid1d(1)) computes correctly. So maybe it is just something about large matricies. Also matrix.identity(19) computes correctly, but matrix.identity(20) fails with a similar error. I've reported this as a bug.

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-06-05 13:33:34 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-05 11:05:43 +0200

tmonteil gravatar image

updated 2013-06-05 16:05:27 +0200

I cannot reproduce your error from the command line, i got (on sage-5.9-beta5):

sage: chain.differential()
{0: 0 x 64 dense matrix over Integer Ring,
 1: 64 x 144 sparse matrix over Integer Ring}

However i can reproduce it on the notebook. It seems that there is a bug in the notebook preventing it to print the result correctly.

edit flag offensive delete link more


I also didn't get the error in the command line. Is there a reason It would work in the command line but not in the notebook?

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-06-05 11:41:06 +0200 )edit

It seems indeed to be a bug about printing matrices in the notebook.

tmonteil gravatar imagetmonteil ( 2013-06-05 16:12:26 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-06-04 18:25:08 +0200

Seen: 281 times

Last updated: Jun 05 '13