1 | initial version |
Here is a solution via module_morphism
:
V = CombinatorialFreeModule(SR, [(1,0,0),(0,1,0)], prefix="")
p = [1,0,2] # permutation of tuple indices
H = V.module_morphism(lambda t: V.monomial(tuple(t[i] for i in p)), codomain=V)
e = V.random_element()
print('e =\t',e)
print('H(e) =\t',H(e))
As an example it prints:
e = [(0, 1, 0)] + 2*[(1, 0, 0)]
H(e) = 2*[(0, 1, 0)] + [(1, 0, 0)]