# Finite generated algebra cohomology

I have an algebra and a differential over this algebra. I want to construct cohomology ring and find the annihilators of some elements. How could I do that with sage?

My algebra looks like:

variables =  ', '.join(['u{}'.format(i+1) for i in range(n)] + ['v{}'.format(j+1) for j in range(n)])
F = FreeAlgebra(ZZ, n+n, variables)
gens = F.gens()
u = gens[:n]
v = gens[n:]
print u
print v

I = []

# Koszul
for i in range(5):
for j in range(i+1, 5):
I.append(u[i]*u[j] - u[j]*u[i])
# Stanley-Raysner
for i in range(5):
for j in range(i+1, 5):
if j - i != 1 and j-i != 4:
I.append(v[i]*v[j])

A = F.quotient(F * I * F)

edit retag close merge delete

So in the first line above, n=5, to avoid the immediate crash. One can also define F over
B.<u1,u2,u3,u4,u5> = PolynomialRing(ZZ)

then add freely the v-variables. Now we only need to know the graded pieces (the weighting of the variables) and the differential to isolate the $\mathbb Z$-modules in each degree. (Sage may do the job only for some first degrees.)