# polynomial.rweight(weight)¶

The left scalar product of a polynomial by a weight.

## Examples¶

In :
import vcsn
c = vcsn.context('lal, q')
c

Out:
$\{\ldots\}\to\mathbb{Q}$
In :
p = c.polynomial('<2>a + <3>b')
p

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

Out:
$\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b$

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

In :
p * c.weight('4')

Out:
$\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b$

You may even run the simpler:

In :
p * 4

Out:
$\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b$

### Polynomials of expressions¶

In the following polynomial, note that 2 and 3 are weights in the polynomial, but 5 is a weight in the expression.

In :
c = vcsn.context('expressionset<lal, q>, q')
c

Out:
$\mathsf{RatE}[\{\ldots\}\to\mathbb{Q}]\to\mathbb{Q}$
In :
p = c.polynomial('<2>a*') + c.polynomial('<3><5>b*')
p

Out:
$\left\langle 2\right\rangle {a}^{*} \oplus \left\langle 3\right\rangle \left\langle 5 \right\rangle \,{b}^{*}$
In :
p * 4

Out:
$\left\langle 2\right\rangle \left\langle 4 \right\rangle \,{a}^{*} \oplus \left\langle 3\right\rangle \left\langle 20 \right\rangle \,{b}^{*}$

This is very different from left-scalar product.

In :
4 * p

Out:
$\left\langle 8\right\rangle {a}^{*} \oplus \left\langle 12\right\rangle \left\langle 5 \right\rangle \,{b}^{*}$