====================================================================
XPBWPolynomial examples
====================================================================

Initialisations

  a:Symbol := 'a
    a
                                  Type: Symbol

  b:Symbol := 'b
    b
                                  Type: Symbol

  RN := Fraction(Integer)
    Fraction Integer
                                  Type: Domain

  word := OrderedFreeMonoid Symbol
    OrderedFreeMonoid Symbol
                                  Type: Domain

  lword := LyndonWord(Symbol)
    LyndonWord Symbol
                                  Type: Domain

  base := PoincareBirkhoffWittLyndonBasis Symbol
    PoincareBirkhoffWittLyndonBasis Symbol
                                  Type: Domain

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

  rpoly := XRecursivePolynomial(Symbol, RN)
    XRecursivePolynomial(Symbol,Fraction Integer)
                                  Type: Domain

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

  poly  := XPBWPolynomial(Symbol, RN)
    XPBWPolynomial(Symbol,Fraction Integer)
                                  Type: Domain

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

Let's make some polynomials

  0$poly
    0
                           Type: XPBWPolynomial(Symbol,Fraction Integer)

  1$poly
    1
                           Type: XPBWPolynomial(Symbol,Fraction Integer)

  p : poly := a
    [a]
                           Type: XPBWPolynomial(Symbol,Fraction Integer)

  q : poly := b
    [b]
                           Type: XPBWPolynomial(Symbol,Fraction Integer)

  pq: poly := p*q
    [a b] + [b][a]
                           Type: XPBWPolynomial(Symbol,Fraction Integer)

Coerce to distributed polynomial

  pq :: dpoly
    a b
                      Type: XDistributedPolynomial(Symbol,Fraction Integer)

Check some polynomial operations

  mirror pq
    [b][a]
                      Type: XPBWPolynomial(Symbol,Fraction Integer)

  listOfTerms pq
    [[k= [b][a],c= 1],[k= [a b],c= 1]]
      Type: List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
                        c: Fraction Integer)

  reductum pq
    [a b]
                      Type: XPBWPolynomial(Symbol,Fraction Integer)

  leadingMonomial pq
    [b][a]
                      Type: PoincareBirkhoffWittLyndonBasis Symbol

  coefficients pq
    [1,1]
                      Type: List Fraction Integer

  leadingTerm pq
    [k= [b][a],c= 1]
              Type: Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
                           c: Fraction Integer)

  degree pq
    2
                      Type: PositiveInteger

  pq4:=exp(pq,4)
                          1              1     2       1      2
     1 + [a b] + [b][a] + - [a b][a b] + - [a b ][a] + - [b][a b]
                          2              2             2
   + 
     3               1
     - [b][a b][a] + - [b][b][a][a]
     2               2
                      Type: XPBWPolynomial(Symbol,Fraction Integer)

  log(pq4,4) - pq
   (26)  0
                      Type: XPBWPolynomial(Symbol,Fraction Integer)

Calculations with verification in XDistributedPolynomial.

  lp1 :lpoly := LiePoly liste.10
       3 2
     [a b ]
                      Type: LiePolynomial(Symbol,Fraction Integer)

  lp2 :lpoly := LiePoly liste.11
      2
    [a b a b]
                      Type: LiePolynomial(Symbol,Fraction Integer)

  lp :lpoly := [lp1, lp2]
      3 2 2
    [a b a b a b]
                      Type: LiePolynomial(Symbol,Fraction Integer)

  lpd1: dpoly := lp1
     3 2     2         2 2                    2 2           2    2 3
    a b  - 2a b a b - a b a + 4a b a b a - a b a  - 2b a b a  + b a
                      Type: XDistributedPolynomial(Symbol,Fraction Integer)

  lpd2: dpoly := lp2
      2         2 2          2                    2 2       3        2
     a b a b - a b a - 3a b a b + 4a b a b a - a b a  + 2b a b - 3b a b a
   + 
            2
     b a b a
                      Type: XDistributedPolynomial(Symbol,Fraction Integer)

  lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
      3 2 2         3 2 2 2      3 2     2      3 2             3 2   2 2
     a b a b a b - a b a b a - 3a b a b a b + 4a b a b a b a - a b a b a
   + 
       3 3 3      3 3 2       3 3     2    2       3 2     2       2 2
     2a b a b - 3a b a b a + a b a b a  - a b a b a b  + 3a b a b a b a
   + 
       2           2       2                    2         2 2     2     2 3
     6a b a b a b a b - 12a b a b a b a b a + 3a b a b a b a  - 4a b a b a b
   + 
       2     2 2       2     3 3    2 2 4 2     2 2 3          2 2 2   2
     6a b a b a b a - a b a b a  + a b a b  - 3a b a b a b + 3a b a b a b
   + 
         2 2     3      2 2     2        2 2         2    2 2   2 3
     - 2a b a b a b + 3a b a b a b a - 3a b a b a b a  + a b a b a
   + 
           2   3 2         2   2              2   2 2           2
     3a b a b a b  - 6a b a b a b a b - 3a b a b a b a + 12a b a b a b a b a
   + 
             2     2 2         2 2     2         2 3 3             4 2
     - 3a b a b a b a  - 6a b a b a b a  + 3a b a b a  - 4a b a b a b
   + 
                3                   2   2                  3
     12a b a b a b a b - 12a b a b a b a b + 8a b a b a b a b
   + 
                      2                         2               2 3      2 5 2
     - 12a b a b a b a b a + 12a b a b a b a b a  - 4a b a b a b a  + a b a b
   + 
           2 4            2 3   2        2 2   3        2 2   2
     - 3a b a b a b + 3a b a b a b - 2a b a b a b + 3a b a b a b a
   + 
           2 2       2      2 2 2 3       3   3 2       3   2
     - 3a b a b a b a  + a b a b a  - 2b a b a b  + 4b a b a b a b
   + 
         3   2 2        3                  3     2 2       3 2     2       3 3 3
     2b a b a b a - 8b a b a b a b a + 2b a b a b a  + 4b a b a b a  - 2b a b a
   + 
         2   4 2       2   3            2   3 2         2   2
     3b a b a b  - 6b a b a b a b - 3b a b a b a + 12b a b a b a b a
   + 
           2   2 2 2       2           2       2     2 3          5 2
     - 3b a b a b a  - 6b a b a b a b a  + 3b a b a b a  - b a b a b
   + 
             4 2            3   2             3                  3 2 2
     3b a b a b a + 6b a b a b a b - 12b a b a b a b a + 3b a b a b a
   + 
               2   3            2   2             2 2 3    2 5         2 5 2
     - 4b a b a b a b + 6b a b a b a b a - b a b a b a  + b a b a b - b a b a
   + 
         2 4   2      2 4           2 4 2 2     2 3   3      2 3   2
     - 3b a b a b + 4b a b a b a - b a b a  + 2b a b a b - 3b a b a b a
   + 
      2 3       2
     b a b a b a
                    Type: XDistributedPolynomial(Symbol,Fraction Integer)

  lp :: dpoly - lpd
    0
                    Type: XDistributedPolynomial(Symbol,Fraction Integer)

Calculations with verification in XRecursivePolynomial.

  p := 3 * lp
       3 2 2
    3[a b a b a b]
                    Type: XPBWPolynomial(Symbol,Fraction Integer)

  q := lp1
      3 2
    [a b ]
                    Type: XPBWPolynomial(Symbol,Fraction Integer)

  pq:= p * q
       3 2 2        3 2
    3[a b a b a b][a b ]
                    Type: XPBWPolynomial(Symbol,Fraction Integer)

  pr:rpoly := p :: rpoly
       a
    *
           a
        *
               a b b
            *
                a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
               + 
                 b a(a(a b 6 + b a(- 9)) + b a a 3)
           + 
               b
            *
                   a b
                *
                       a
                    *
                         a(a b b(- 3) + b b a 9)
                       + 
                         b(a(a b 18 + b a(- 36)) + b a a 9)
                   + 
                     b(a a(a b(- 12) + b a 18) + b a a a(- 3))
               + 
                   b a
                *
                     a(a(a b b 3 + b a b(- 9)) + b a a b 9)
                   + 
                     b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
       + 
           b
        *
               a
            *
                   a b
                *
                       a
                    *
                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
                       + 
                         b(a b a 36 + b a a(- 9))
                   + 
                     b(a b a a(- 18) + b a a a 9)
               + 
                   b a
                *
                     a(a(a b b(- 12) + b a b 36) + b a a b(- 36))
                   + 
                     b(a(a(a b 24 + b a(- 36)) + b a a 36) + b a a a(- 12))
           + 
               b a a
            *
                 a(a(a b b 3 + b a b(- 9)) + b a a b 9)
               + 
                 b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
   + 
       b
    *
           a
        *
               a
            *
                   a b
                *
                       a
                    *
                         a(a b b(- 6) + b(a b 12 + b a 6))
                       + 
                         b(a b a(- 24) + b a a 6)
                   + 
                     b(a b a a 12 + b a a a(- 6))
               + 
                   b a
                *
                       a
                    *
                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
                       + 
                         b(a b a 36 + b a a(- 9))
                   + 
                     b(a b a a(- 18) + b a a a 9)
           + 
               b a a
            *
                a(a(a b b(- 3) + b b a 9) + b(a(a b 18 + b a(- 36)) + b a a 9))
               + 
                 b(a a(a b(- 12) + b a 18) + b a a a(- 3))
       + 
           b a a a
        *
             a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
           + 
             b a(a(a b 6 + b a(- 9)) + b a a 3)
                      Type: XRecursivePolynomial(Symbol,Fraction Integer)

  qr:rpoly := q :: rpoly
     a(a(a b b 1 + b(a b(- 2) + b a(- 1))) + b(a b a 4 + b a a(- 1)))
   + 
     b(a b a a(- 2) + b a a a 1)
                      Type: XRecursivePolynomial(Symbol,Fraction Integer)

  pq :: rpoly - pr*qr
    0
                      Type: XRecursivePolynomial(Symbol,Fraction Integer)

See Also:
o )show XPBWPolynomial

