polynomial.rweight(weight)

The left scalar product of a polynomial by a weight.

See also:

Examples

In [1]:
import vcsn
c = vcsn.context('lal, q')
c
Out[1]:
$\{\ldots\}\to\mathbb{Q}$
In [2]:
p = c.polynomial('<2>a + <3>b')
p
Out[2]:
$\left\langle 2\right\rangle a \oplus \left\langle 3\right\rangle b$
In [3]:
p.rweight(c.weight('4'))
Out[3]:
$\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b$

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

In [4]:
p * c.weight('4')
Out[4]:
$\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b$

You may even run the simpler:

In [5]:
p * 4
Out[5]:
$\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 [6]:
c = vcsn.context('expressionset<lal, q>, q')
c
Out[6]:
$\mathsf{RatE}[\{\ldots\}\to\mathbb{Q}]\to\mathbb{Q}$
In [7]:
p = c.polynomial('<2>a*') + c.polynomial('<3><5>b*')
p
Out[7]:
$\left\langle 2\right\rangle {a}^{*} \oplus \left\langle 3\right\rangle \left\langle 5 \right\rangle \,{b}^{*}$
In [8]:
p * 4
Out[8]:
$\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 [9]:
4 * p
Out[9]:
$\left\langle 8\right\rangle {a}^{*} \oplus \left\langle 12\right\rangle \left\langle 5 \right\rangle \,{b}^{*}$