# Revision history [back]

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]