# Revision history [back]

The following worked for me:

A.<a,b,c,d,e> = FreeAlgebra( QQ, 5 )
dic = { 1:a, 2:b, 3:c, 4:d, 5:e }
G = SymmetricGroup( 5 )

import random
scalars = dict( [ ( g, QQ( random.choice( [1..10] ) ) ) for g in G ] )

sum( [ scalars[g] * ( + prod( [ dic[g(k)] for k in (1,2,3) ] )
- prod( [ dic[g(k)] for k in (3,4,5) ] ) )
for g in G ] )


However, the result is a liniar combination of words of degree 3, not 5 as in the posted question. (The used scalars were randomly generated.)