computing the cup-product in the cohomology of a simplicial complex

273 views
Skip to first unread message

Felix Breuer

unread,
Dec 3, 2011, 9:15:03 PM12/3/11
to sage-s...@googlegroups.com
Hello everyone!

I would like to compute the cup-product of two chains in the cohomology of a simplicial complex.

What I have so far, is that I have the simplicial complex realized as a SimplicialComplex in sage and I can compute its cohomology groups. They are: {0: 0, 1: Z x Z, 2: Z^28, 3: Z^9}. What I would like to do, is to take two generators of the cohomology group in degree 1 and compute that their cup-product is non-trivial. What is the best way to do this?


As I gather from Trac issue #6102, I can't simply compute the cohomology ring, as this functionality is not yet implemented. So I have to do this by hand, but that's okay. AFAICT, there are two things I need to figure out.

1) How can I get my hands on two representatives of the generators of the first cohomology group? I am not sure, whether I can have sage compute these for me (see ticket #6100). If yes, how? If no, I could maybe construct these two by hand (as I "know" how my simplicial complex "looks"). But in what format do I have to construct these chains so that I can use them in step 2?

2) How can I compute coboundaries of chains in the cochain complex? I know that sage will give me the cochain complex induced by my simplicial complex including the (co)boundary maps. But how do I apply these coboundary maps to chains? What format do these chains need to have?


Sorry, if these questions are somewhat fuzzy, but I am new to sage. Thank you for any help you can give!

Best,
Felix

John H Palmieri

unread,
Dec 4, 2011, 1:35:31 AM12/4/11
to sage-s...@googlegroups.com


On Saturday, December 3, 2011 6:15:03 PM UTC-8, Felix Breuer wrote:
Hello everyone!

I would like to compute the cup-product of two chains in the cohomology of a simplicial complex.

Me too.
 

What I have so far, is that I have the simplicial complex realized as a SimplicialComplex in sage and I can compute its cohomology groups. They are: {0: 0, 1: Z x Z, 2: Z^28, 3: Z^9}. What I would like to do, is to take two generators of the cohomology group in degree 1 and compute that their cup-product is non-trivial. What is the best way to do this?
 


As I gather from Trac issue #6102, I can't simply compute the cohomology ring, as this functionality is not yet implemented. So I have to do this by hand, but that's okay. AFAICT, there are two things I need to figure out.

1) How can I get my hands on two representatives of the generators of the first cohomology group? I am not sure, whether I can have sage compute these for me (see ticket #6100). If yes, how? If no, I could maybe construct these two by hand (as I "know" how my simplicial complex "looks"). But in what format do I have to construct these chains so that I can use them in step 2?

If you install the optional Sage package "chomp", then it should be able to give you representatives.  Type "sage -i chomp" (or while you're running Sage, I think "install_package('chomp')" should work).  Once you've installed chomp, do this:

sage: X = (your favorite simplicial complex)
sage: X.cohomology(generators=True)


2) How can I compute coboundaries of chains in the cochain complex? I know that sage will give me the cochain complex induced by my simplicial complex including the (co)boundary maps. But how do I apply these coboundary maps to chains? What format do these chains need to have?

Actually, it might be better to do this:

sage: X = ...  # some simplicial complex
sage: C = X.chain_complex(cochain=True)  # its cochain complex
sage: print C._chomp_repr_()

This prints a basis for the cochains in each dimension, along with the coboundary of each element, but note that the dimensions are wrong.  Oops, just found a bug.  For example, if X only has 0-, 1-, and 2-simplices, then when you print C._chomp_repr_(), the elements which say they're in dimension 0 are actually in dimension 2, etc.: the chain complex is printed upside-down.

sage: C.homology(generators=True)

This should now print the cohomology groups along with generators for each one, as a vector in terms of the basis given in the previous step.  The chain complex itself is stored as a collection of matrices (representing the coboundary maps), so you can just multiply any vector of the appropriate dimension by the coboundary matrix to compute the coboundary.

Try this out and see if it's helpful.  Improving the simplicial complex stuff in Sage is on the to-do list, as you've observed.  Progress has been slow...

--
John

Felix Breuer

unread,
Dec 4, 2011, 2:23:41 PM12/4/11
to sage-s...@googlegroups.com
Hi John!

Thanks for your detailed answer! I will try to figure this out and get back to you!

Felix

Felix Breuer

unread,
Dec 4, 2011, 10:47:13 PM12/4/11
to sage-s...@googlegroups.com
Hello again!

I have followed your instructions and come up with the following:

X = simplicial_complexes.Torus()
C = X.chain_complex(cochain=True)
print C._chomp_repr_()
H = C.homology(generators=True)
gen1 = H[1][1][0]
gen2 = H[1][1][1]
d1 = C.differential()[1]

This works very well so far. In particular d1*gen1 gives the zero vector as it should. Now: How can I get the bijection between the indices of the vectors gen1 and gen2 and the corresponding 1-faces in X? C._chomp_repr_() gives the boundary matrices in the form:

dimension 1
   boundary a1 = - 1 * a3 - 1 * a10 
   boundary a2 = - 1 * a2 - 1 * a5 
   boundary a3 = + 1 * a4 + 1 * a9 
   boundary a4 = + 1 * a6 + 1 * a12 
   boundary a5 = + 1 * a2 + 1 * a11 
   boundary a6 = - 1 * a4 - 1 * a11 
   boundary a7 = + 1 * a4 + 1 * a8 
   boundary a8 = + 1 * a5 + 1 * a14 
   boundary a9 = - 1 * a9 + 1 * a10 
   boundary a10 = + 1 * a1 + 1 * a6 
   boundary a11 = - 1 * a6 - 1 * a8 
   boundary a12 = + 1 * a5 + 1 * a7 
   boundary a13 = + 1 * a8 + 1 * a14 
   boundary a14 = + 1 * a7 + 1 * a9 ...

But I don't see any information what face, say, a1 corresponds to. Am I missing something?

Thank you very much for your help!

Felix

John H Palmieri

unread,
Dec 4, 2011, 10:57:39 PM12/4/11
to sage-s...@googlegroups.com

You should be able to do

  sage: X.n_faces(1)

to get the list of 1-simplices.  a_i should be dual to the ith element in that list.

--
John

Felix Breuer

unread,
Dec 5, 2011, 9:07:56 PM12/5/11
to sage-s...@googlegroups.com
Here is a first implementation of the cup product. I hope (of course) that the code is correct, but it is certainly not very idomatic. Any suggestions for improvement are welcome!

def cup_product(X,c1,dim1,c2,dim2):
    d = dim1 + dim2 
    faces1 = list(X.n_faces(dim1))
    faces2 = list(X.n_faces(dim2))
    faces = list(X.n_faces(d))
    res = []
    for sigma in faces:
        sigma1 = Simplex(sigma[0:dim1+1])
        sigma2 = Simplex(sigma[dim1:d+1])
        index1 = faces1.index(sigma1)
        index2 = faces2.index(sigma2)
        coeff1 = c1[index1]
        coeff2 = c2[index2]
        coeff = coeff1 * coeff2
        res.append(coeff)
    return vector(tuple(res))

To use it on the Torus, for example, you can do this:

X = simplicial_complexes.Torus()
C = X.chain_complex(cochain=True)
H = C.homology(generators=True)
gen1 = H[1][1][0]
gen2 = H[1][1][1]
d1 = C.differential()[1]
q = cup_product(X,gen1,1,gen1,1)
print q
print d1.solve_right(q)
p = cup_product(X,gen1,1,gen2,1)
print p
print d1.solve_right(p) #error

The last line throws an error, because p is not in the image of d1. This shows that p, the cup product of the two generator of the cohomology group in degree 1, is a non-trivial element of the cohomology group in degree 2.

If there is interest, I would be willing to put in the additional work to add this function to Sage. But for that I would need to learn about the all the other issues that I don't know anything about but that I should take care of first :)

Cheers,
Felix

John H Palmieri

unread,
Jan 4, 2012, 7:02:04 PM1/4/12
to sage-s...@googlegroups.com


On Monday, December 5, 2011 6:07:56 PM UTC-8, Felix Breuer wrote:
Here is a first implementation of the cup product.

[snip]
 
If there is interest, I would be willing to put in the additional work to add this function to Sage. But for that I would need to learn about the all the other issues that I don't know anything about but that I should take care of first :)

This looks good at first glance. I keep hoping that I'll have time to look at it more carefully and provide detailed feedback, but it hasn't happened yet.  If you have time, please continue to work on it.  If not, then thank you for this contribution; someone ought to be able to make it fit into the rest of the cohomology framework in Sage.  I've posted your code to the relevant trac ticket so that we don't lose it.

--
John

Felix Breuer

unread,
Jan 4, 2012, 9:04:03 PM1/4/12
to sage-s...@googlegroups.com
I'd be happy to do some more work on it. I would need some pointers, though, on what still needs to be done. I can write up some documentation next week.

Cheers,
Felix

PS: I am at the Joint Meetings right now. Are you at JMM? Or are there any Sage-related events at JMM?

kcrisman

unread,
Jan 4, 2012, 10:53:37 PM1/4/12
to sage-support
Hee hee! See http://wiki.sagemath.org/jmms2012 to help out. If you
search the Joint Meeting full program, you'll see a couple linear
algebra pedagogy talks using Sage, a number of talks by Sage
developers like William Stein and Jason Grout which probably use
Sage, ... stop by the Sage booth (all the way in the back right of the
hall) for more info. See you there!

Jason Grout

unread,
Jan 5, 2012, 10:07:12 AM1/5/12
to sage-s...@googlegroups.com

And don't forget that if you can stay for a few days after, there is
Sage Days 35.5:

http://wiki.sagemath.org/days35.5

Thanks,

Jason


Reply all
Reply to author
Forward
0 new messages