Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: obtaining an ordered subset of k elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73519] Re: [mg73498] Re: obtaining an ordered subset of k elements
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 21 Feb 2007 01:40:43 -0500 (EST)
  • References: <cFfCh.12521$aF5.12165@tornado.fastwebnet.it> <200702201118.GAA07759@smc.vnet.net>

A very much faster way, without the need for the Combinatorica  
package, is:

Flatten[Permutations /@ Subsets[Range[6], {3}], 1]

Note that the order of elements returned is not the same.

Andrzej Kozlowski


On 20 Feb 2007, at 12:18, digrpat wrote:

> an example with 3 elements chosen from a set of 6
>
> << DiscreteMath`Combinatorica`
>
> Sort[Flatten[Map[LexicographicPermutations, KSubsets[{1, 2, 3, 4,  
> 5, 6},
> 3]], 1]]
>
>
>
> "GiulioC" <giulio.castorinaNOSPAM at fastwebnet.it> wrote in message
> news:cFfCh.12521$aF5.12165 at tornado.fastwebnet.it...
>> Hello All,
>>
>> I am in trouble as I cannot find no way to obtain an ordered  
>> subsets of k
>> elements with mathematica 5.2. I didnt find any  
>> solutions...Mathematica
>> seems hadle just Permutations (n=r) or unordered subsets of k  
>> elements
>> (KSubsets). What I want is what is explained here
>> (http://mathworld.wolfram.com/Permutation.html)  at the 8th text row
>> ...but no Mathematica function is showed :(
>> Please note I dont want just the "number" of total rearrangement  
>> but I
>> want a named list of all subsets of k elements
>>
>> Any solutions? I hope yes...
>>
>> Cheers
>>
>> Giulio
>>
>>
>>
>>
>
>
>
>  Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
>     ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
>                 http://www.usenet.com
>



  • Prev by Date: LogPlot and Epilog
  • Next by Date: Re: FullGraphics question
  • Previous by thread: Re: obtaining an ordered subset of k elements
  • Next by thread: Re: obtaining an ordered subset of k elements