Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Add method to compute the cohomology algebra
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmarco committed Jan 22, 2019
1 parent f2e748d commit 3534f8b
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/sage/algebras/commutative_dga.py
Expand Up @@ -2439,6 +2439,69 @@ def extend(phi, ndegrees, ndifs, nimags, nnames):

return phi

def cohomology_algebra(self, max_degree=3):
"""
Compute a CDGA with trivial differential, that is isomorphic to the cohomology of
self up to``max_degree``
INPUT:
- ``max_degree`` -- integer (default: `3`); degree to which the result is required to
be isomorphic to self's cohomology.
EXAMPLES::
sage: A.<e1,e2,e3,e4,e5,e6,e7> = GradedCommutativeAlgebra(QQ)
sage: d = A.differential({e1:-e1*e6,e2:-e2*e6,e3:-e3*e6,e4:-e5*e6,e5:e4*e6})
sage: B = A.cdg_algebra(d)
sage: M = B.cohomology_algebra()
sage: M
Commutative Differential Graded Algebra with generators ('x0', 'x1', 'x2') in degrees (1, 1, 2) with relations [x2^2] over Rational Field with differential:
x0 --> 0
x1 --> 0
x2 --> 0
sage: M.cohomology(1)
Free module generated by {[x1], [x0]} over Rational Field
sage: B.cohomology(1)
Free module generated by {[e7], [e6]} over Rational Field
sage: M.cohomology(2)
Free module generated by {[x0*x1], [x2]} over Rational Field
sage: B.cohomology(2)
Free module generated by {[e6*e7], [e4*e5]} over Rational Field
sage: M.cohomology(3)
Free module generated by {[x1*x2], [x0*x2]} over Rational Field
sage: B.cohomology(3)
Free module generated by {[e4*e5*e7], [e4*e5*e6]} over Rational Field
"""
DI = self.defining_ideal()
DR = DI.ring()
cohomgens = self.cohomology_generators(max_degree)
chgens = []
degrees = [g.degree() for g in self.gens()]
for d in cohomgens:
for g in cohomgens[d]:
degrees.append(d)
chgens.append(g)
FA = FreeAlgebra(self.base_ring(), self.ngens()+len(chgens), 'x')
NCrels = {}
for i in range(len(degrees)-1):
for j in range(i+1, len(degrees)):
if is_odd(degrees[i]*degrees[j]):
NCrels[FA.gen(j)*FA.gen(i)] = -FA.gen(i)*FA.gen(j)
BR = FA.g_algebra(NCrels)
i1 = DR.hom(BR.gens()[:self.ngens()], check=False)
J = i1(DI) + BR.ideal([BR.gen(self.ngens()+i)-i1(chgens[i].lift()) for i in range(len(chgens))])
elimrels = J.twostd().elimination_ideal(BR.gens()[:self.ngens()])
NA = GradedCommutativeAlgebra(self.base_ring(), ['x{}'.format(i) for i in range(len(chgens))], degrees[self.ngens():])
NArels = []
for g in elimrels.gens():
di = g.dict()
ndi = {e[self.ngens():]:di[e] for e in di}
NArels.append(NA(ndi))
NB = NA.quotient(NA.ideal(NArels))
return NB.cdg_algebra({})




class Element(GCAlgebra.Element):
Expand Down

0 comments on commit 3534f8b

Please sign in to comment.