MathGroup Archive 1998

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

Search the Archive

Permutations.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14771] Permutations.
  • From: "Alan W.Hopper" <awhopper at hermes.net.au>
  • Date: Sat, 14 Nov 1998 03:08:02 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Greetings,


For the combinations of n objects taken k at a time, (where order counts
and there is no duplication), the function KSubsets is the one to use.
e.g.
      In[1]:= <<DiscreteMath`Combinatorica`

      In[2]:= Table[KSubsets[{a,b,c,d}, k], {k, 4}]

     Out[3]= {{{a}, {b}, {c}, {d}},
              {{a,b}, {a,c}, {b,c}, {b,d}, {c,d}},
              {{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}},
              {{a,b,c,d}}}

But likewise in wanting to find all the permutation subsets (with no 
duplication and order not counting), of a numerical or symbolic list,
there does not seem to be a function anywhere (including the packages),
to achieve this goal.
 
(By n!/(n-k)!, there will be be; 4, 12, 24, 24  permutations  taken k =
1, 2, 3, 4  at a time, for a 4 element list).

The built-in function Permutations and also LexicographicPermutations 
(from Combinatorica) do not take a second argument, as KSubsets does,
and so only the (n, k=n) permutations (24 in the example ) can be
found.

I would appreciate some assistance to find a way to generate all of the
permutation subsets, in List, Table or Column form.


Alan W.Hopper
awhopper at hermes.net.au


  • Prev by Date: Re: Differentiating Piecewise Functions
  • Next by Date: splines and interpolation
  • Previous by thread: piecewise coloring
  • Next by thread: Re: Permutations.