#6102: cohomology ring of simplicial complexes
----------------------------------+-----------------------------------------
Reporter: bantieau | Owner: bantieau
Type: enhancement | Status: new
Priority: minor | Milestone: sage-4.8
Component: algebraic topology | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
----------------------------------+-----------------------------------------
Changes (by jhpalmieri):
* upstream: => N/A
Comment:
The following code was posted by Felix Breuer on
[https://groups.google.com/d/topic/sage-support/mdEKXfBTHOY/discussion
sage-support]
{{{
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
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6102#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.