expression.lweight(weight)

The left scalar product of an expression by a weight.

See also:

Examples

In [1]:
import vcsn
c = vcsn.context('lal_char, q')
In [2]:
e = c.expression('<2>a<3>bc', 'trivial')
e
Out[2]:
$ \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)$
In [3]:
e.lweight(c.weight('4'))
Out[3]:
$ \left\langle 4 \right\rangle \,\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)$

Instead of e.lweight(w), you may write w * e.

In [4]:
c.weight('4') * e
Out[4]:
$ \left\langle 4 \right\rangle \,\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)$

You may even run the simpler:

In [5]:
4 * e
Out[5]:
$ \left\langle 4 \right\rangle \,\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)$