Ask Your Question

Revision history [back]

I'm not sure why this hasn't been implemented in SageMath. It's probably an oversight rather than being due to any difficulties. It's pretty easy to implement. Here is a workaround:

F = FreeGroup(4, names='A,B,C,D')
G = GroupAlgebra(F, ZZ)
A,B,C,D = G.gens()

A1 = matrix(CC,[[0,I],[I,0]])
B1 = matrix(CC,[[I,0],[0,-I]])
C1 = matrix(CC,[[0,1],[-1,0]])

def my_im_gens_(self, codomain, im_gens, base_map=None):
    result = codomain.zero()
    for (g,c) in self._monomial_coefficients.items():
        if base_map:
            c = base_map(c)
        result += c*g(im_gens)
    return result
G.element_class._im_gens_ = my_im_gens_

Then it works:

sage: f = G.hom([A1,B1,C1,C1], check=False)
sage: f(A^2 + B^3 + C) == A1^2 + B1^3 + C1
True