Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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)