This worksheet describes a set of functions that deal with the free algebra $Q\langle a,b \rangle$ on two generators with the shuffle product and implement its bialgebra structure and some of its bases.
Before getting started, you need to make sure that the functions are loaded in this session. To do so, evaluate the following commands (the result of the second one should be 'True') :
load(DATA+'FreeAlgebra.sage')
is_primitive(PBW(Word('ab')))
First, we need to work with words. The word 'foo' is called with the command Word('foo'). For example :
A lot of functions relative to words are already defined in sage. For example, it is easy to know if a word is a Lyndon word, using the following :
The first basis that I implemented is the Poincaré-Birkhoff-Witt basis of $Q\langle a,b \rangle$. For its definition, see Reutenauer, Free Lie algebras, Clarendon Press, 1993.
Its elements are indexed by words and denoted by $P_w$. If $w = \ell$ is a Lyndon word, then $P_\ell$ is obtained by standard bracketing :
By the way, the standard bracketing of a word is implemented in Sage and you can call it with LW.standard_bracketing(mot) :
LW.standard_bracketing(Word('ab'))
You can "realize" this bracketing as a series using the function expbrack :
expbrack(LW.standard_bracketing(Word('ab')))
The usual scalar product (which returns the coefficient of a word in a polynomial) is called ScalProd :
c1=ScalProd(Pol,Word('abb'))
c2=ScalProd(Pol,Word('abbbbb'))
c3=ScalProd(Pol,Word(''))
c1,c2,c3
This allows us to implement the counit $\epsilon$ that returns the constant term of a series :