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)
Type: Domain
Define the linear combinations of these words with integer coefficients.
|
Type: Domain
Then we define a first element from poly.
p:poly := 2 * x - 3 * y + 1
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
And a second one.
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
We compute their sum,
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
their product,
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
and see that variables do not commute.
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
Now we define a ring of square matrices,
M := SquareMatrix(2,Fraction Integer)
|
Type: Domain
and the linear combinations of words with these matrices as coefficients.
|
Type: Domain
Define a first matrix,
m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
Type: SquareMatrix(2,Fraction Integer)
a second one,
Type: SquareMatrix(2,Fraction Integer)
and a third one.
Type: SquareMatrix(2,Fraction Integer)
Define a polynomial,
pm:poly1 := m1*x + m2*y + m3*z - 2/3
|
Type:
XPolynomialRing(
SquareMatrix(2,Fraction Integer),
OrderedFreeMonoid Symbol)
a second one,
|
Type:
XPolynomialRing(
SquareMatrix(2,Fraction Integer),
OrderedFreeMonoid Symbol)
and the following power.
|
Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)