1% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved. 2% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk. 3\newcommand{\XPolynomialXmpTitle}{XPolynomial} 4\newcommand{\XPolynomialXmpNumber}{9.93} 5% 6% ===================================================================== 7\begin{page}{XPolynomialXmpPage}{9.93 XPolynomial} 8% ===================================================================== 9\beginscroll 10 11% 12% 13% 14% 15% 16 17 18The \spadtype{XPolynomial} domain constructor implements multivariate polynomials 19whose set of variables is \spadtype{Symbol}. 20These variables do not commute. 21The only parameter of this constructor is 22the coefficient ring which may be non-commutative. 23However, coefficients and variables commute. 24The representation of the polynomials is recursive. 25The abbreviation for \spadtype{XPolynomial} is \spadtype{XPOLY}. 26 27Other constructors like \spadtype{XPolynomialRing}, 28\spadtype{XRecursivePolynomial}, 29\spadtype{XDistributedPolynomial}, 30\spadtype{LiePolynomial} and 31\spadtype{XPBWPolynomial} 32implement multivariate polynomials 33in non-commutative variables. 34 35We illustrate now some of the facilities of the \spadtype{XPOLY} domain constructor. 36 37 38\xtc{ 39Define a polynomial ring over the integers. 40}{ 41\spadpaste{poly := XPolynomial(Integer) \bound{poly}} 42} 43 44\xtc{ 45Define a first polynomial, 46}{ 47\spadpaste{pr: poly := 2*x + 3*y-5 \free{poly} \bound{pr}} 48} 49 50 51\xtc{ 52and a second one. 53}{ 54\spadpaste{pr2: poly := pr*pr \free{poly} \bound{pr2}} 55} 56 57\xtc{ 58Rewrite {\bf pr} in a distributive way, 59}{ 60\spadpaste{pd := expand pr \free{pr} \bound{pd}} 61} 62 63\xtc{ 64compute its square, 65}{ 66\spadpaste{pd2 := pd*pd \free{pd} \bound{pd2}} 67} 68 69\xtc{ 70and checks that: 71}{ 72\spadpaste{expand(pr2) - pd2 \free{pr2} \free{pd2}} 73} 74 75 76\xtc{ 77We define: 78}{ 79\spadpaste{qr := pr^3 \free{pr} \bound{qr}} 80} 81 82\xtc{ 83and: 84}{ 85\spadpaste{qd := pd^3 \free{pd} \bound{qd}} 86} 87 88\xtc{ 89We truncate {\bf qd} at degree {\bf 3}: 90}{ 91\spadpaste{trunc(qd,2) \free{qd}} 92} 93 94\xtc{ 95The same for {\bf qr}: 96}{ 97\spadpaste{trunc(qr,2) \free{qr}} 98} 99 100\xtc{ 101We define: 102}{ 103\spadpaste{Word := FreeMonoid Symbol \bound{Word}} 104} 105 106\xtc{ 107and: 108}{ 109\spadpaste{w: Word := x*y^2 \free{Word} \bound{w}} 110} 111 112\xtc{ 113The we can compute the right-quotient of {\bf qr} by {\bf r}: 114}{ 115\spadpaste{rquo(qr,w) \free{qr} \free{w}} 116} 117 118\xtc{ 119and the shuffle-product of {\bf pr} by {\bf r}: 120}{ 121\spadpaste{sh(pr,w::poly) \free{pr} \free{w}} 122} 123\endscroll 124\autobuttons 125\end{page} 126% 127