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
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org