Re: A Question about Combinatorica
- To: mathgroup at smc.vnet.net
- Subject: [mg102655] Re: A Question about Combinatorica
- From: Helen Read <hpr at together.net>
- Date: Sun, 23 Aug 2009 05:33:21 -0400 (EDT)
- References: <200908210842.EAA13961@smc.vnet.net> <h6o73j$fsa$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
Tomas Garza wrote:
>
> Number of combinations of n objects taken in sets of k, is that what you mean?
> The answer to that is n!/k! (n-k)!
>
> The actual combinations carry in Mathematica the strange name of
> KSubsets, and in order to calculate them you must FIRST call the
> Combinatorica package: thus
>
> <<Combinatorica`
>
> KSubsets[{"A","B","C","D"},3]
> {{A,B,C},{A,B,D},{A,C,D},{B,C,D}}
There is no need to load a package for this. Use the built-in function
Subsets.
Subsets[{"A", "B", "C", "D"}, {3}]
Also useful are the built-in functions Tuples and Permutations.
--
Helen Read
University of Vermont
- References:
- A Question about Combinatorica
- From: Marwa Abd El-Wahaab <m.a.elwahaab@gmail.com>
- A Question about Combinatorica