# How do I find the image of an element of a differential algebra in the cohomlogy?

Following the documentation on Commutative Differential Graded Algebras, I have defined a differential graded algebra $C$. I have some element $x \in C$, in degree $4$. I can get a basis for the cohomology at degree 4 by

C.cohomology(4)


and generators for cocycles and coboundaries by

C.cocycles(4)
C.coboundaries(4)


How do I check if $x$ is a cocycle, and if it is, what it is in terms of the basis of the cohomology above?

I'm not sure I used the right tags, feel free to edit.

edit retag close merge delete

Sort by » oldest newest most voted I don't think there is a one-line command to do what you want, but some combination of basis_coefficients and cohomology_raw should work.

sage: A.<a,b,c,d> = GradedCommutativeAlgebra(QQ, degrees = (1,1,1,2))
sage: C = A.cdg_algebra({a:b*c})
sage: x = C(a*c*d)
sage: x.differential()  # one way to check whether x is a cocycle
0
sage: x.is_coboundary()
False
sage: x.basis_coefficients()  # x as a raw basis vector
[0, 1, 0, 0]
sage: vector(x.basis_coefficients()) in C.cocycles(4) # another way to check whether x is a cocycle
True

sage: C.cohomology_raw(4)
Vector space quotient V/W of dimension 3 over Rational Field where
V: Vector space of degree 4 and dimension 4 over Rational Field
Basis matrix:
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]
W: Vector space of degree 4 and dimension 1 over Rational Field
Basis matrix:
[1 0 0 0]

more