Re: Permutations.
- To: mathgroup at smc.vnet.net
- Subject: [mg14805] Re: [mg14771] Permutations.
- From: Jurgen Tischer <jtischer at col2.telecom.com.co>
- Date: Wed, 18 Nov 1998 01:29:06 -0500
- Organization: Universidad del Valle
- References: <199811140808.DAA03469@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Alan, In[1]:= <<DiscreteMath`Combinatorica` In[2]:= KPermutations[li_,n_]:= Flatten[Outer[Part,KSubsets[li,n],Permutations[Range[n]],1],1] Jurgen "Alan W.Hopper" wrote: > > 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
- References:
- Permutations.
- From: "Alan W.Hopper" <awhopper@hermes.net.au>
- Permutations.