Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 45856
Kernel: Python 3

polynomial.rweight(weight)

The left scalar product of a polynomial by a weight.

See also:

Examples

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

{}Q\{\ldots\}\to\mathbb{Q}

p = c.polynomial('<2>a + <3>b') p

2a3b\left\langle 2\right\rangle a \oplus \left\langle 3\right\rangle b

p.rweight(c.weight('4'))

8a12b\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b

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

p * c.weight('4')

8a12b\left\langle 8\right\rangle a \oplus \left\langle 12\right\rangle b

You may even run the simpler:

p * 4

8a12b\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.

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

RatE[{}Q]Q\mathsf{RatE}[\{\ldots\}\to\mathbb{Q}]\to\mathbb{Q}

p = c.polynomial('<2>a*') + c.polynomial('<3><5>b*') p

2a35b\left\langle 2\right\rangle {a}^{*} \oplus \left\langle 3\right\rangle \left\langle 5 \right\rangle \,{b}^{*}

p * 4

24a320b\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.

4 * p

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