# expansion.rweight(weight)¶

The right scalar product of an expansion by a weight.

## Examples¶

In :
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 :
e = c.expression('<2>a<3>bc', 'none')
x = e.expansion()
e

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

Out:
$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 :
x * c.weight('4')

Out:
$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 :
x * 4

Out:
$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 :
(e*4).expansion()

Out:
$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]$