# 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.

edit retag 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.)

( 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.

( 2013-06-05 13:33:34 +0200 )edit

Sort by ยป oldest newest most voted

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.

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?

( 2013-06-05 11:41:06 +0200 )edit

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

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