MathGroup Archive 2009

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

Search the Archive

Re: A Question about Combinatorica


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


  • Prev by Date: Re: Re: Re: ParrallelDo and set::noval
  • Next by Date: Re: Strange behavior: random and plot
  • Previous by thread: Re: A Question about Combinatorica
  • Next by thread: printing issue with a simple graphic