# expansion.rweight(weight)¶

The right scalar product of an expansion by a weight.

## Examples¶

In [1]:
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.

In [2]:
e = c.expression('<2>a<3>bc', 'none')
x = e.expansion()
e

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

Out[3]:
$a \odot \left[\left\langle 2\right\rangle \left(\varepsilon \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle \right]$

Instead of x.rweight(w), you may write x * w.

In [4]:
x * c.weight('4')

Out[4]:
$a \odot \left[\left\langle 2\right\rangle \left(\varepsilon \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle \right]$

You may even run the simpler:

In [5]:
x * 4

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

The expansion of a scalar product is the scalar product of the expansion:

In [6]:
(e*4).expansion()

Out[6]:
$a \odot \left[\left\langle 2\right\rangle \left(\varepsilon \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle \right]$