]>
Book Contents Previous Section 9.89 XPolynomial Next Section 9.91 ZeroDimensionalSolvePackage Book Index

## 9.90 XPolynomialRing

The XPolynomialRing domain constructor implements generalized polynomials with coefficients from an arbitrary Ring (not necessarily commutative) and whose exponents are words from an arbitrary OrderedMonoid (not necessarily commutative too). Thus these polynomials are (finite) linear combinations of words.

This constructor takes two arguments. The first one is a Ring and the second is an OrderedMonoid. The abbreviation for XPolynomialRing is XPR.

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

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

Define the free ordered monoid generated by the symbols.

Word := OrderedFreeMonoid(Symbol)

OrderedFreeMonoidSymbol

Type: Domain

Define the linear combinations of these words with integer coefficients.

poly:= XPR(Integer,Word)

XPolynomialRing(Integer,OrderedFreeMonoidSymbol)

Type: Domain

Then we define a first element from poly.

p:poly := 2 * x - 3 * y + 1

1+2 x-3 y

Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)

And a second one.

q:poly := 2 * x + 1

1+2 x

Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)

We compute their sum,

p + q

2+4 x-3 y

Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)

their product,

p * q

1+4 x-3 y+4 x 2-6 y x

Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)

and see that variables do not commute.

(p+q)**2-p**2-q**2-2*p*q

-6 x y+6 y x

Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)

Now we define a ring of square matrices,

M := SquareMatrix(2,Fraction Integer)

SquareMatrix(2,FractionInteger)

Type: Domain

and the linear combinations of words with these matrices as coefficients.

poly1:= XPR(M,Word)

XPolynomialRing(SquareMatrix(2,FractionInteger), OrderedFreeMonoidSymbol)

Type: Domain

Define a first matrix,

m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]

[1 2 4 8]

Type: SquareMatrix(2,Fraction Integer)

a second one,

m2:M := m1 - 5/4

[-1 4 2 4 27 4]

Type: SquareMatrix(2,Fraction Integer)

and a third one.

m3: M := m2**2

[129 16 13 26 857 16]

Type: SquareMatrix(2,Fraction Integer)

Define a polynomial,

pm:poly1 := m1*x + m2*y + m3*z - 2/3

[-2 3 0 0-2 3]+[1 2 4 8]x+[-1 4 2 4 27 4]y+[129 16 13 26 857 16]z

Type: XPolynomialRing( SquareMatrix(2,Fraction Integer), OrderedFreeMonoid Symbol)

a second one,

qm:poly1 := pm - m1*x

[-2 3 0 0-2 3]+[-1 4 2 4 27 4]y+[129 16 13 26 857 16]z

Type: XPolynomialRing( SquareMatrix(2,Fraction Integer), OrderedFreeMonoid Symbol)

and the following power.

qm**3

[-8 27 0 0-8 27]+[-1 3 8 3 16 3 9]y+[43 4 52 3 104 3 857 12]z+[-129 8-26-52-857 8]y 2+[-3199 32-831 4-831 2-26467 32]y z+[-3199 32-831 4-831 2-26467 32]z y+[-103169 128-6409 4-6409 2-820977 128]z 2+[3199 64 831 8 831 4 26467 64]y 3+[103169 256 6409 8 6409 4 820977 256]y 2 z+[103169 256 6409 8 6409 4 820977 256]y z y+[3178239 1024 795341 128 795341 64 25447787 1024]y z 2+[103169 256 6409 8 6409 4 820977 256]z y 2+[3178239 1024 795341 128 795341 64 25447787 1024]z y z+[3178239 1024 795341 128 795341 64 25447787 1024]z 2 y+[98625409 4096 12326223 256 12326223 128 788893897 4096]z 3

Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
Book Contents Previous Section 9.89 XPolynomial Next Section 9.91 ZeroDimensionalSolvePackage Book Index