MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Cyclic permutations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79484] Re: [mg79423] Re: Cyclic permutations
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Fri, 27 Jul 2007 06:04:43 -0400 (EDT)
  • References: <7566865.1185467697017.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

Won't that SameTest equate a lot of permutations that aren't the "same" in  
the OP's requested sense?

perms = Permutations[Range@4]
Signature /@ perms
Union[perms,
  SameTest -> (SameQ @@ (Signature /@ {##}) &)]

{{1, 2, 3, 4}, {1, 2, 4, 3}, {1, 3, 2, 4}, {1, 3, 4, 2}, {1, 4, 2,
   3}, {1, 4, 3, 2}, {2, 1, 3, 4}, {2, 1, 4, 3}, {2, 3, 1, 4}, {2, 3,
   4, 1}, {2, 4, 1, 3}, {2, 4, 3, 1}, {3, 1, 2, 4}, {3, 1, 4, 2}, {3,
   2, 1, 4}, {3, 2, 4, 1}, {3, 4, 1, 2}, {3, 4, 2, 1}, {4, 1, 2,
   3}, {4, 1, 3, 2}, {4, 2, 1, 3}, {4, 2, 3, 1}, {4, 3, 1, 2}, {4, 3,
   2, 1}}

{1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, \
1, 1, -1, -1, 1}

{{1, 2, 3, 4}, {1, 2, 4, 3}}

Only two distinct permutations exist (for ANY list) with that SameTest.

I thought the OP wanted something like

Union[perms /. {a__, 1, b___} :> {1, b, a}]

{{1, 2, 3, 4}, {1, 2, 4, 3}, {1, 3, 2, 4}, {1, 3, 4, 2}, {1, 4, 2,
   3}, {1, 4, 3, 2}}

Bobby

On Thu, 26 Jul 2007 04:36:57 -0500, Bill Rowe <readnewsciv at sbcglobal.net>  
wrote:

> On 7/25/07 at 5:27 AM, peter.king at imperial.ac.uk (King, Peter R)
> wrote:
>
>> I have a set of permutations eg.
>
>> {a,b,c,d}, {a,c,b,d} {b,c,d,a}
>
>> Some of which are just cyclic variations of others (ie. {b,c,d,a} is
>> a cyclic variant of {a,b,c,d}). Is there a simple way of getting rid
>> of these, so that the above set just becomes
>
>> {a,b,c,d}, {a,c,b,d}
>
>> I am quite happy to select the cyclic variant to be kept arbitrarily
>> (or using lexical ordering, I'm not particularly concerned).
>
> One way to do this would be to use Union with Signature, i.e.,
>
> In[5]:= Union[{{a, b, c, d}, {a, c, b, d}, {b, c, d, a}},
>   SameTest -> (SameQ @@ (Signature /@ {##}) &)]
>
> Out[5]= {{a, b, c, d}, {a, c, b, d}}
> --
> To reply via email subtract one hundred and four
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: Letting functions not evaluate
  • Next by Date: Re: Re: Locator question
  • Previous by thread: Re: Cyclic permutations
  • Next by thread: Re: Cyclic permutations