import vcsn
c = vcsn.context('lal_char, q')
Note that left-scalar product and right-scalar product are very different: the left-scalar product changes the weights in the polynomials, while the right-scalar product changes the expressions.
e = c.expression('<2>a<3>bc', 'none')
x = e.expansion()
e
x.rweight(c.weight('4'))
Instead of x.rweight(w)
, you may write x * w
.
x * c.weight('4')
You may even run the simpler:
x * 4
The expansion of a scalar product is the scalar product of the expansion:
(e*4).expansion()