In that case, this might do it sage: PermutationOptions(display='list') sage: L1 = [5,3,8,6] sage: L2 = copy(L1) sage: L1.sort() sage: L = [L2.index(x)+1 for x in L1] sage: p = Permutation(L); p; p.to_cycles() [2, 1, 4, 3] [(1, 2), (3, 4)] sage: p.signature() 1 sage: p.to_permutation_group_element().sign() 1
On Mon, Jun 30, 2008 at 9:12 PM, John H Palmieri <[EMAIL PROTECTED]> wrote: > > > > On Jun 30, 5:16 pm, "David Joyner" <[EMAIL PROTECTED]> wrote: >> Do you mean the tuple is represented in the disjoint cycle notation and >> is a cyclic permutation? In that case, you can use: >> >> sage: PermutationGroupElement('(3,6,4)').sign() >> 1 >> sage: PermutationGroupElement('(5,3,6,4)').sign() >> -1 >> > > No, by "one-line permutation notation", I mean that (3,6,4) means the > permutation where 3 -> 3, 4 -> 6, and 6 -> 4, while (5,3,8,6) is the > permutation of (3,5,8,6) in which 3 and 5 have been interchanged, as > have 6 and 8. > > >> On Mon, Jun 30, 2008 at 7:17 PM, John H Palmieri <[EMAIL PROTECTED]> wrote: >> >> >> >> > Suppose I have a tuple x of distinct non-negative integers. Is there >> > a quick way to find the sign of this, as a permutation of Set(x)? (I >> > want to view x as the one-line permutation notation form, so (3,6,4) >> > will have sign -1, while (5,3,8,6) will have sign 1.) >> >> > The things I can find in combinat/... don't quite seem to do what I >> > want. I can build something myself, but if there is a quick solution, >> > I would prefer that. > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---