MathGroup Archive 2001

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

Search the Archive

Re: Matrix of possible combinations of N elements


It does pay to be more specific (and true to mathematical notation),
when asking mathematical questions.
Anyway, if what you realy want is the 'combinations of the set
{A,B,C,D}', here they are:
In[29]:=
                                          4
Module[{indices = IntegerDigits[Range[0, 4 ], 4]}, 
 
  combinations = Union[Union /@ indices] + 1; ({A, B, C, D}[[#1]] & )
/@ combinations]

Out[29]=
{{A}, {B}, {C}, {D}, {A, B}, {A, C}, {A, D}, {B, C}, {B, D}, {C, D},
{A, B, C}, {A, B, D}, {A, C, D}, {B, C, D}, {A, B, C, D}}

Combinations of a set are all the ways in which someone can take some
elements and drop others, whereas Permutations are all the ways in
which someone can 'shuffle' a given set, changing the order of its
elements.
Orestis


  • Prev by Date: Mathematica tensor product
  • Next by Date: Re: I Need advice on converting Mathematica files to JPEGS or Bitmaps
  • Previous by thread: Re: Matrix of possible combinations of N elements
  • Next by thread: Re: Matrix of possible combinations of N elements