Thank you for your answer which was very useful. I have now another problem. In order to define the product of two primitive elements (P_l for l a Lyndon word), I think I need the structure equivalent to that of the CombinatorialFreeModule but in the case of monoids, something that others have already dreamt of: https://groups.google.com/forum/#!topic/sage-combinat-devel/E5aETiD7GNU. To be clear, I would like to have a monoid whose generators are indexed by Lyndon words. Does it exist? Matthieu
Le mercredi 3 juillet 2013 14:54:16 UTC+2, Nicolas M. Thiéry a écrit : > > On Sun, Jun 30, 2013 at 04:52:18PM -0700, Matthieu Deneufch�tel wrote: > > I try to implement the Poincare-Birkhoff-Witt basis of the free > algebra. > > I defined the elements of this basis and a function which gives the > > expansion of an element of the free algebra on this basis; actually, > it > > returns a dictionary whose keys are monomials and whose values are > the > > corresponding coefficients. > > I would like to define a new basis of the free algebra, but I don't > know > > which structure I should use. Is there a "canonical way"? Should I > use a > > CombinatorialFreeModule? > > There might be some documentation I should have read before asking > any > > question. Please tell me where I should have a look. > > Sounds like a good candidate for having a: > > class > PoincareBirkhoffWittBasisOfFreeAlgebra(CombinatorialFreeModule): > ... > > and making your change of basis function into a morphism. And possibly > a shortcut: > > sage: F = FreeAlgebra(...) > sage: PBW = F.poincare_birkhof_witt_basis() > > In the long run, if more bases come in, you might consider having a > "FreeAlgebraWithRealizations" similar to Sym with its several bases. > > A natural starting point in the documentation is: > > > http://combinat.sagemath.org/doc/thematic_tutorials/tutorial-implementing-algebraic-structures.html > > > with its prerequisite: > > > http://combinat.sagemath.org/doc/reference/modules/sage/modules/tutorial_free_modules.html > > > Good luck! > Nicolas > -- > Nicolas M. Thi�ry "Isil" <nth...@users.sf.net <javascript:>> > http://Nicolas.Thiery.name/ > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.