import vcsn
c = vcsn.context('lal, q')
c
p = c.polynomial('<2>a + <3>b')
p
p.lweight(c.weight('4'))
Instead of p.lweight(w)
, you may write w * p
.
c.weight('4') * p
You may even run the simpler:
4 * p
In the following polynomial, note that 2 and 3 are weights in the polynomial, but 5 is a weight in the expression.
c = vcsn.context('expressionset<lal, q>, q')
c
p = c.polynomial('<2>a*') + c.polynomial('<3><5>b*')
p
4 * p
This is very different from right-scalar product.
p * 4