% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved. % !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk. \newcommand{\XPolynomialXmpTitle}{XPolynomial} \newcommand{\XPolynomialXmpNumber}{9.89} % % ===================================================================== \begin{page}{XPolynomialXmpPage}{9.89 XPolynomial} % ===================================================================== \beginscroll The \spadtype{XPolynomial} domain constructor implements multivariate polynomials whose set of variables is \spadtype{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 \spadtype{XPolynomial} is \spadtype{XPOLY}. Other constructors like \spadtype{XPolynomialRing}, \spadtype{XRecursivePolynomial} \spadtype{XDistributedPolynomial}, \spadtype{LiePolynomial} and \spadtype{XPBWPolynomial} implement multivariate polynomials in non-commutative variables. We illustrate now some of the facilities of the \spadtype{XPOLY} domain constructor. \xtc{ Define a polynomial ring over the integers. }{ \spadpaste{poly := XPolynomial(Integer) \bound{poly}} } \xtc{ Define a first polynomial, }{ \spadpaste{pr: poly := 2*x + 3*y-5 \free{poly} \bound{pr}} } \xtc{ and a second one. }{ \spadpaste{pr2: poly := pr*pr \free{poly} \bound{pr2}} } \xtc{ Rewrite {\bf pr} in a distributive way, }{ \spadpaste{pd := expand pr \free{pr} \bound{pd}} } \xtc{ compute its square, }{ \spadpaste{pd2 := pd*pd \free{pd} \bound{pd2}} } \xtc{ and checks that: }{ \spadpaste{expand(pr2) - pd2 \free{pr2} \free{pd2}} } \xtc{ We define: }{ \spadpaste{qr := pr**3 \free{pr} \bound{qr}} } \xtc{ and: }{ \spadpaste{qd := pd**3 \free{pd} \bound{qd}} } \xtc{ We truncate {\bf qd} at degree {\bf 3}: }{ \spadpaste{ trunc(qd,2) \free{qd}} } \xtc{ The same for {\bf qr}: }{ \spadpaste{trunc(qr,2) \free{qr}} } \xtc{ We define: }{ \spadpaste{Word := OrderedFreeMonoid Symbol \bound{Word}} } \xtc{ and: }{ \spadpaste{w: Word := x*y**2 \free{Word} \bound{w}} } \xtc{ The we can compute the right-quotient of {\bf qr} by {\bf r}: }{ \spadpaste{rquo(qr,w) \free{qr} \free{w}} } \xtc{ and the shuffle-product of {\bf pr} by {\bf r}: }{ \spadpaste{sh(pr,w::poly) \free{pr} \free{w}} } \endscroll \autobuttons \end{page} %