==================================================================== XPolynomial Ring ==================================================================== 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) OrderedFreeMonoid Symbol Type: Domain Define the linear combinations of these words with integer coefficients. :: poly:= XPR(Integer,Word) XPolynomialRing(Integer,OrderedFreeMonoid Symbol) Type: Domain Then we define a first element from poly. :: p:poly := 2 * x - 3 * y + 1 1 + 2x - 3y Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol) And a second one. :: q:poly := 2 * x + 1 1 + 2x Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol) We compute their sum, :: p + q 2 + 4x - 3y Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol) their product, :: p * q 2 1 + 4x - 3y + 4x - 6y x Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol) and see that variables do not commute. :: (p+q)**2-p**2-q**2-2*p*q - 6x y + 6y x Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol) Now we define a ring of square matrices, :: M := SquareMatrix(2,Fraction Integer) SquareMatrix(2,Fraction Integer) Type: Domain and the linear combinations of words with these matrices as coefficients. :: poly1:= XPR(M,Word) XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol) 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 + |- - 2 | | 4 | | | | 27| | 4 --| + 4+ Type: SquareMatrix(2,Fraction Integer) and a third one. :: m3: M := m2**2 +129 + |--- 13 | | 16 | | | | 857| |26 ---| + 16+ Type: SquareMatrix(2,Fraction Integer) Define a polynomial, :: pm:poly1 := m1*x + m2*y + m3*z - 2/3 + 2 + + 1 + +129 + |- - 0 | |- - 2 | |--- 13 | | 3 | +1 2+ | 4 | | 16 | | | + | |x + | |y + | |z | 2| +4 8+ | 27| | 857| | 0 - -| | 4 --| |26 ---| + 3+ + 4+ + 16+ Type: XPolynomialRing(SquareMatrix(2,Fraction Integer), OrderedFreeMonoid Symbol) a second one, :: qm:poly1 := pm - m1*x + 2 + + 1 + +129 + |- - 0 | |- - 2 | |--- 13 | | 3 | | 4 | | 16 | | | + | |y + | |z | 2| | 27| | 857| | 0 - -| | 4 --| |26 ---| + 3+ + 4+ + 16+ Type: XPolynomialRing(SquareMatrix(2,Fraction Integer), OrderedFreeMonoid Symbol) and the following power. :: qm**3 + 8 + + 1 8+ +43 52 + + 129 + |- -- 0 | |- - -| |-- -- | |- --- - 26 | | 27 | | 3 3| | 4 3 | | 8 | 2 | | + | |y + | |z + | |y | 8| |16 | |104 857| | 857| | 0 - --| |-- 9| |--- ---| |- 52 - ---| + 27+ + 3 + + 3 12+ + 8 + + + 3199 831 + + 3199 831 + + 103169 6409 + |- ---- - --- | |- ---- - --- | |- ------ - ---- | | 32 4 | | 32 4 | | 128 4 | 2 | |y z + | |z y + | |z | 831 26467| | 831 26467| | 6409 820977| |- --- - -----| |- --- - -----| | - ---- - ------| + 2 32 + + 2 32 + + 2 128 + + +3199 831 + +103169 6409 + +103169 6409 + |---- --- | |------ ---- | |------ ---- | | 64 8 | 3 | 256 8 | 2 | 256 8 | | |y + | |y z + | |y z y |831 26467| | 6409 820977| | 6409 820977| |--- -----| | ---- ------| | ---- ------| + 4 64 + + 4 256 + + 4 256 + + +3178239 795341 + +103169 6409 + +3178239 795341 + |------- ------ | |------ ---- | |------- ------ | | 1024 128 | 2 | 256 8 | 2 | 1024 128 | | |y z + | |z y + | |z y z |795341 25447787| | 6409 820977| |795341 25447787| |------ --------| | ---- ------| |------ --------| + 64 1024 + + 4 256 + + 64 1024 + + +3178239 795341 + +98625409 12326223 + |------- ------ | |-------- -------- | | 1024 128 | 2 | 4096 256 | 3 | |z y + | |z |795341 25447787| |12326223 788893897| |------ --------| |-------- ---------| + 64 1024 + + 128 4096 + Type: XPolynomialRing(SquareMatrix(2,Fraction Integer), OrderedFreeMonoid Symbol) See Also: * )help XPBWPolynomial * )help LiePolynomial * )help XDistributedPolynomial * )help XRecursivePolynomial * )help XPolynomial * )show XPolynomialRing