On Tue, Apr 24, 2012 at 12:51:34PM +0200, Nathann Cohen wrote: > Helloooooooo !! > > I vote yes. When I teach this, I call this the swapping diagram (not > standard terminology). The number of swaps gives you the Bruhat > length, if I remember correctly, when you regard S_n as a Coxeter group. > The parity gives you the sign of the permutation, which gives you, in > turn, the > determinant of the associated matrix. It is a very useful diagram:-) > > Hmmm.... I just took a look at it, and it seems I just can not do this for > my own purposes. I mean, this diagram can be written, but Permutations > objets basically *cannot* store a permutation between anything different > from 1 .... n > Well, it just supposes that the elements in the permutation have some > "natural linear ordering", which is the one given by the '<' python > operator. Here is the code from Permutation.inversions : > p = self[:] > inversion_list = [] > for i in range(len(p)): > for j in range(i+1,len(p)): > if p[i] > p[j]: > #inversion_list.append((p[i],p[j])) > inversion_list.append([i,j]) > return inversion_list > So it looks like I cannot trust it with my strings, for instance :-/ > I will write this diagram anyway. It can prove useful to me later, and it > looks like you could use it anyway ^^;
You might want to use permutations from the symmetric group instead:: sage: S = SymmetricGroup(10) sage: x = S.random_element() sage: x.inversions() [(2,3), (2,4), (2,5), (4,5), (3,5), (1,5), (2,6), (4,6), (3,6), (1,6), (5,6), (2,7), (4,7), (3,7), (1,7), (2,8), (4,8)] It has been implemented recently by Mark, and it will work for any Coxeter group. Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.