9.89 XPolynomialΒΆ

The XPolynomial domain constructor implements multivariate polynomials whose set of variables is Symbol. These variables do not commute. The only parameter of this construtor is the coefficient ring which may be non-commutative. However, coefficients and variables commute. The representation of the polynomials is recursive. The abbreviation for XPolynomial is XPOLY.

Other constructors like XPolynomialRing, XRecursivePolynomial as well as XDistributedPolynomial, LiePolynomial and XPBWPolynomial implement multivariate polynomials in non-commutative variables.

We illustrate now some of the facilities of the XPOLY domain constructor.

Define a polynomial ring over the integers.

poly := XPolynomial(Integer)
\[\]
XPolynomialInteger

Type: Domain

Define a first polynomial,

pr: poly := 2*x + 3*y-5
\[\]
-5+x2+y3

Type: XPolynomial Integer

and a second one.

pr2: poly := pr*pr
\[\]
25+x(-20+x4+y6)+y(-30+x6+y9)

Type: XPolynomial Integer

Rewrite pr in a distributive way,

pd := expand pr
\[\]
-5+2x+3y

Type: XDistributedPolynomial(Symbol,Integer)

compute its square,

pd2 := pd*pd
\[\]
25-20x-30y+4x2+6xy+6yx+9y2

Type: XDistributedPolynomial(Symbol,Integer)

and checks that:

expand(pr2) - pd2
\[\]
0

Type: XDistributedPolynomial(Symbol,Integer)

We define:

qr := pr^3
\[\]
-125+x(150+x(-60+x8+y12)+y(-90+x12+y18))+y(225+x(-90+x12+y18)+y(-135+x18+y27))

Type: XPolynomial Integer

and:

qd := pd^3
\[\]
-125+150x+225y-60x2-90xy-90yx-135y2+8x3+12x2y+12xyx+18xy2+12yx2+18yxy+18y2x+27y3

Type: XDistributedPolynomial(Symbol,Integer)

We truncate qd at degree 3:

trunc(qd,2)
\[\]
-125+150x+225y-60x2-90xy-90yx-135y2

Type: XDistributedPolynomial(Symbol,Integer)

The same for qr:

trunc(qr,2)
\[\]
-125+x(150+x(-60)+y(-90))+y(225+x(-90)+y(-135))

Type: XPolynomial Integer

We define:

Word := OrderedFreeMonoid Symbol
\[\]
OrderedFreeMonoidSymbol

Type: Domain

and:

w: Word := x*y^2
\[\]
xy2

Type: OrderedFreeMonoid Symbol

The we can compute the right-quotient of qr by r:

rquo(qr,w)
\[\]
18

Type: XPolynomial Integer

and the shuffle-product of pr by r:

sh(pr,w::poly)
\[\]
x(xyy4+y(xy2+y(-5+x2+y9)))+yxyy3

Type: XPolynomial Integer