︠f461ac0f-ab72-447a-9653-547df1f1eb1di︠
%html
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') :
︡c92ec455-a193-4463-ab52-34e84ded6383︡{"html": "\r\nThis 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.\r\n
\r\nBefore 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') :"}︡
︠71c5fb3b-0812-4de8-a8c7-cd07965f145b︠
load(DATA+'FreeAlgebra.sage')
︡bf247676-a9bb-4e12-a28a-9b3adbd87420︡︡
︠190fdb36-d0c6-4191-ab33-93f4951bf59a︠
is_primitive(PBW(Word('ab')))
︡cf01546a-0ce6-4541-9e7f-f839fbfab919︡{"stdout": "True"}︡
︠140df6b1-1a28-46b5-84c8-0075f9cd56ddi︠
%html
First, we need to work with words. The word 'foo' is called with the command Word('foo'). For example :
︡ba19303b-9105-4b47-a9d0-9a6892a4b821︡{"html": "First, we need to work with words. The word 'foo' is called with the command Word('foo'). For example :\r\n"}︡
︠5462905a-9cdc-405b-92c1-15a634e0c777︠
Word('abbb')
︡865c7986-2239-44b6-982b-5460f3673dcc︡{"html": "Word('abbb')"}︡
︠3e3c78d8-21a2-4cdb-a7c7-5aac0cffd809i︠
%html
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 :
︡f565ed0c-46ec-44fa-a606-f4a27bdfa938︡{"html": "\r\nA 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 :\r\n"}︡
︠fe33f669-9e36-4f4a-89c3-e3a072c78b6f︠
Word('abb').is_lyndon()
︡5ec170c9-7526-4dd4-98ca-1ef5053ca114︡{"stdout": "True"}︡
︠b60f91d4-b9fa-485f-865d-8aa815d6376fi︠
%html
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 :
︡857c38a8-f80b-43e0-9287-2c0f0df2dcae︡{"html": "\r\nThe first basis that I implemented is the Poincar\u00e9-Birkhoff-Witt basis of $Q\\langle a,b \\rangle$. For its definition, see Reutenauer, Free Lie algebras, Clarendon Press, 1993.
\r\nIts 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 :\r\n"}︡
︠8a726b43-e626-4b63-b03a-ddf9b6ff826b︠
w=Word('abb')
︡f3a18c4a-190e-4e01-8928-8a8b8a262c20︡︡
︠176d9f58-3bbe-41ec-a143-de4bb10de542︠
w.is_lyndon()
︡b730a714-c959-44b6-a310-70d1819c147b︡{"stdout": "True"}︡
︠91dcadc4-4faf-4661-9448-03db7e80418e︠
Pol=PBW(w)
Pol
︡9ac49ad4-c392-4b7c-8ffc-7450b6639277︡{"stdout": "a*b^2 - 2*b*a*b + b^2*a"}︡
︠e0ab80c7-dfef-426c-bd2f-ea04ddb49063i︠
%html
By the way, the standard bracketing of a word is implemented in Sage and you can call it with LW.standard_bracketing(mot) :
︡260a7233-235e-4990-a3b4-0fa04143c163︡{"html": "\r\nBy the way, the standard bracketing of a word is implemented in Sage and you can call it with LW.standard_bracketing(mot) :\r\n"}︡
︠6360d269-97aa-4fe8-85f6-976420cac590︠
LW.standard_bracketing(Word('ab'))
︡c7053650-3b70-4c5b-9e38-616841201bf2︡{"stdout": "['a', 'b']"}︡
︠f6d20318-744f-44c4-89e6-2c86bd5b1099i︠
%html
You can "realize" this bracketing as a series using the function expbrack :
︡26124d54-18d1-43c0-9d93-39a24ef50683︡{"html": "\r\nYou can \"realize\" this bracketing as a series using the function expbrack :\r\n"}︡
︠ab9a3d78-4842-46b1-85ee-1f6f63f6623c︠
expbrack(LW.standard_bracketing(Word('ab')))
︡fc380555-bbed-4f02-973f-8cb325e2d892︡{"stdout": "a*b - b*a"}︡
︠d5d8c45e-5531-400e-b59b-916c45074922i︠
%html
The usual scalar product (which returns the coefficient of a word in a polynomial) is called ScalProd :
︡904fda70-29dc-4f6b-829f-113883902696︡{"html": "\r\nThe usual scalar product (which returns the coefficient of a word in a polynomial) is called ScalProd :\r\n"}︡
︠af4d01f3-9535-4fa8-a1ae-4b701e80ee2d︠
c1=ScalProd(Pol,Word('abb'))
c2=ScalProd(Pol,Word('abbbbb'))
c3=ScalProd(Pol,Word(''))
c1,c2,c3
︡ac32543d-ac5e-48da-ab46-2d8c853bb9bb︡{"stdout": "(1, 0, 0)"}︡
︠51882d84-84c9-4503-8c85-1dd8fa501794i︠
%html
This allows us to implement the counit $\epsilon$ that returns the constant term of a series :