MathGroup Archive 2004

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

Search the Archive

Re: Generating r-combination or r-permutations with replacement.


Here is a way of doing what you want:

<<DiscreteMath`Combinatorica`

KSubsets[{1,2,3,4},3]

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

Steve Luttrell

"phil" <enfo at ucla.edu> wrote in message news:ckajd2$m4p$1 at smc.vnet.net...
> Is there an easy function in mathematica that generates a set/list that
> consists of r-combinations or r-permutations with replacement?
>
> e.g. I want the set of all possible sets with 3 elements, with entries 
> from
> {1,2,3,4}, and also the set of all possible unordered sets with 3 
> elements,
> with entries from {1,2,3,4}.
>
> Any help is appreciated,
>
> -Philip Lu
>
> 



  • Prev by Date: Subscript problem
  • Next by Date: Strange PV results from Integrate
  • Previous by thread: Re: Generating r-combination or r-permutations with replacement.
  • Next by thread: argMax