====================================================================
LiePolynomial examples
====================================================================

====================================================================
Declaration of domains
====================================================================

  RN := Fraction Integer
    Fraction Integer
                     Type: Domain

  Lpoly := LiePolynomial(Symbol,RN)
    LiePolynomial(Symbol,Fraction Integer)
                     Type: Domain

  Dpoly := XDPOLY(Symbol,RN)
    XDistributedPolynomial(Symbol,Fraction Integer)
                     Type: Domain

  Lword := LyndonWord Symbol
    LyndonWord Symbol
                     Type: Domain

====================================================================
Initialisation
====================================================================

  a:Symbol := 'a
    a
                     Type: Symbol

  b:Symbol := 'b 
    b
                     Type: Symbol

  c:Symbol := 'c
    c
                     Type: Symbol

  aa: Lpoly := a 
    [a]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  bb: Lpoly := b
    [b]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  cc: Lpoly := c
    [c]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  p : Lpoly := [aa,bb]
    [a b]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  q : Lpoly := [p,bb]
        2
    [a b ]
                     Type: LiePolynomial(Symbol,Fraction Integer)

All the Lyndon words of order 4

  liste : List Lword := LyndonWordsList([a,b], 4)
                     2       2    3     2 2      3
    [[a],[b],[a b],[a b],[a b ],[a b],[a b ],[a b ]]
                     Type: List LyndonWord Symbol

  r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly
               2         2
    [a b] + 3[a b] + [a b ]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  s:Lpoly := [p,r]
         2                 2
    - 3[a b a b] + [a b a b ]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5)
                  2       2                 2
    2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
                     Type: LiePolynomial(Symbol,Fraction Integer)

  degree t
    5
                     Type: PositiveInteger

  mirror t
                    2       2                 2
    - 2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
                     Type: LiePolynomial(Symbol,Fraction Integer)

====================================================================
Jacobi Relation
====================================================================

 Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == _
   [ [p,q]\$Lpoly, r] + [ [q,r]\$Lpoly, p] + [ [r,p]\$Lpoly, q]  
                    Type: Void

====================================================================
Tests
====================================================================

  test: Lpoly := Jacobi(a,b,b)
    0
                    Type: LiePolynomial(Symbol,Fraction Integer)

  test: Lpoly := Jacobi(p,q,r)
    0
                    Type: LiePolynomial(Symbol,Fraction Integer)

  test: Lpoly := Jacobi(r,s,t)
    0
                    Type: LiePolynomial(Symbol,Fraction Integer)

====================================================================
Evaluation
====================================================================

  eval(p, a, p)$Lpoly
        2
    [a b ]
                    Type: LiePolynomial(Symbol,Fraction Integer)

  eval(p, [a,b], [2*bb, 3*aa])$Lpoly
    - 6[a b]
                    Type: LiePolynomial(Symbol,Fraction Integer)

  r: Lpoly := [p,c]
    [a b c] + [a c b]
                    Type: LiePolynomial(Symbol,Fraction Integer)

  r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly 
    - [a b c]
                    Type: LiePolynomial(Symbol,Fraction Integer)

  r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly 
    - [a c b]
                    Type: LiePolynomial(Symbol,Fraction Integer)

  r + r1 + r2
    0
                    Type: LiePolynomial(Symbol,Fraction Integer)

See Also:
o )help LyndonWord
o )help XDistributedPolynomial
o )show LiePolynomial

