With some help of ChatGPT it seems to work now, see the code below.
But there is a problem remaining: The output U does not seem to be regocnized as a finite dimensional algebra over the field (here the rationals QQ). For example the command U.basis() does not work. Is there an easy fix so that the output is really a finite dimensional algebra so that the Sage tools such as .basis() are available?
def extfacealgbasering(K, base_ring):
verts = K._gen_dict.values()
try:
verts = sorted(verts)
except TypeError:
verts = sorted(verts, key=str)
R = ExteriorAlgebra(base_ring, names=verts)
return R
def extfacealg(K, base_ring=ZZ):
R = extfacealgbasering(K, base_ring)
# Now build a dictionary: variable name -> generator
gens = R.gens()
varnames = R.variable_names()
name_to_gen = dict(zip(varnames, gens))
products = []
for f in K.minimal_nonfaces():
prod = R.one()
for v in f:
prod *= name_to_gen[K._gen_dict[v]]
products.append(prod)
return R.quotient(products)
X = SimplicialComplex([[1,2], [0], [3]])
U=extfacealg(X,QQ)
display(U)
How does this relate to
stanley_reisner_ring
? Is it just that the base ring is exterior rather than polynomial? The code defining the Stanley-Reisner ring is pretty short, you could just modify it. See https://github.com/sagemath/sage/blob... and https://github.com/sagemath/sage/blob....Thank you. I tried to modify the code but got an error. Here my attempt:
It seems there is a problem with the multiplication in the exterior algebra.