Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Why are permutations duplicated with LexicographicPermutations? How to avoid this?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54628] Why are permutations duplicated with LexicographicPermutations? How to avoid this?
  • From: Valentina Mikel <valentina.mikel at po.htnet.hr>
  • Date: Thu, 24 Feb 2005 03:21:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

When I enter

LexicographicPermutations[{a, b, 0, 0}]

the result is following:
{{a, b, 0, 0}, {a, b, 0, 0}, {a, 0, b, 0}, {a, 0, 0, b}, {
   a, 0, b, 0}, {a, 0, 0, b}, {b, a, 0, 0}, {b, a, 0, 0}, {
   b, 0, a, 0}, {b, 0, 0, a}, {b, 0, a, 0}, {b, 0, 0, a}, {
   0, a, b, 0}, {0, a, 0, b}, {0, b, a, 0}, {0, b, 0, a}, {
   0, 0, a, b}, {0, 0, b, a}, {0, a, b, 0}, {0, a, 0, b}, {
   0, b, a, 0}, {0, b, 0, a}, {0, 0, a, b}, {0, 0, b, a}}


Why does the result repeat duplicate cases?
In my case I must perform exact functionality of 
LexicographicPermutations[{0,C,D,0,G,H,J,0,0,P,0,0,T,V,0,X,Y,0,0,4,0,7,8,0}]; 
since there are lots of duplicates I'm trying to implement this in C++ 
for maximum speed.

Can this be avoided in Mathematica itself, and how?


  • Prev by Date: Re: expression formatting inside tables
  • Next by Date: Re: Labels on graphs
  • Previous by thread: Re: Re: Re: Simplify and Abs
  • Next by thread: Re: Why are permutations duplicated with LexicographicPermutations? How to avoid this?