% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LiePolynomialXmpTitle}{LiePolynomial}
\newcommand{\LiePolynomialXmpNumber}{9.48}
%
% =====================================================================
\begin{page}{LiePolynomialXmpPage}{9.48 LiePolynomial}
% =====================================================================
\beginscroll

%
%
%
%
%


Declaration of domains
\xtc{
}{
\spadpaste{RN    := Fraction Integer \bound{RN}}
}
\xtc{
}{
\spadpaste{Lpoly := LiePolynomial(Symbol,RN) \bound{Lpoly} \free{RN}}
}
\xtc{
}{
\spadpaste{Dpoly := XDPOLY(Symbol,RN) \bound{Dpoly} \free{RN}}
}
\xtc{
}{
\spadpaste{Lword := LyndonWord Symbol \bound{Lword}}
}

Initialisation
\xtc{
}{
\spadpaste{a:Symbol := 'a \bound{a}}
}
\xtc{
}{
\spadpaste{b:Symbol := 'b \bound{b}}
}
\xtc{
}{
\spadpaste{c:Symbol := 'c \bound{c}}
}
\xtc{
}{
\spadpaste{aa: Lpoly := a \bound{aa} \free{Lpoly} \free{a}}
}
\xtc{
}{
\spadpaste{bb: Lpoly := b \bound{bb} \free{Lpoly} \free{b}}
}
\xtc{
}{
\spadpaste{cc: Lpoly := c \bound{cc} \free{Lpoly} \free{c}}
}
\xtc{
}{
\spadpaste{p : Lpoly := [aa,bb] \bound{p} \free{aa} \free{bb} \free{Lpoly}}
}
\xtc{
}{
\spadpaste{q : Lpoly := [p,bb] \bound{q} \free{p} \free{bb} \free{Lpoly}}
}
\xtc{
All the Lyndon words of order 4
}{
\spadpaste{liste : List Lword := LyndonWordsList([a,b], 4) \free{a} \free{b} \free{Lword} \bound{liste}}
}
\xtc{
}{
\spadpaste{r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly \bound{r} \free{Lpoly} \free{p} \free{q} \free{liste}}
}
\xtc{
}{
\spadpaste{s:Lpoly := [p,r] \bound{s} \free{Lpoly} \free{p} \free{r}}
}
\xtc{
}{
\spadpaste{t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5) \bound{t} \free{Lpoly} \free{s} \free{liste} }
}
\xtc{
}{
\spadpaste{degree t \free{t}}
}
\xtc{
}{
\spadpaste{mirror t \free{t}}
}

Jacobi Relation
\xtc{
}{
\spadpaste{Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == [[p,q]$Lpoly, r] + [[q,r]$Lpoly, p] + [[r,p]$Lpoly, q] \free{Lpoly} \bound{J}}
}

Tests
\xtc{
}{
\spadpaste{test: Lpoly := Jacobi(a,b,b) \free{J Lpoly a b} \bound{test1}}
}
\xtc{
}{
\spadpaste{test: Lpoly := Jacobi(p,q,r) \free{J p q r Lpoly} \bound{test2}}
}
\xtc{
}{
\spadpaste{test: Lpoly := Jacobi(r,s,t) \free{J r s t Lpoly} \bound{test3}}
}

Evaluation
\xtc{
}{
\spadpaste{eval(p, a, p)$Lpoly}
}
\xtc{
}{
\spadpaste{eval(p, [a,b], [2*bb, 3*aa])$Lpoly \free{p a b bb aa Lpoly}}
}
\xtc{
}{
\spadpaste{r: Lpoly := [p,c] \free{p c Lpoly} \bound{rr}}
}
\xtc{
}{
\spadpaste{r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly \free{rr a b c aa bb cc Lpoly} \bound{r1}}
}
\xtc{
}{
\spadpaste{r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly \free{rr a b c cc bb aa Lpoly} \bound{r2}}
}
\xtc{
}{
\spadpaste{r + r1 + r2 \free{rr r1 r2}}
}
\endscroll
\autobuttons
\end{page}
%
