Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > List Manipulation > Constructing Lists > Tuples >
Mathematica > Data Manipulation > Handling Arrays of Data > Constructing Lists > Tuples >
Mathematica > Data Manipulation > Image Processing & Analysis > Basic Image Manipulation > Handling Arrays of Data > Constructing Lists > Tuples >

Tuples

Tuples
generates a list of all possible n-tuples of elements from list.
Tuples
generates a list of all possible tuples whose i^(th) element is from .
  • The elements of list are treated as distinct, so that Tuples for a list of length k gives output of length .
  • The order of elements in Tuples is based on the order of elements in list, so that Tuples gives .
  • Tuples generates a list of all possible ... arrays of elements in list.
  • The object list need not have head List. The head at each level in the arrays generated by Tuples will be the same as the head of list.
All possible 3-tuples of and :
The first element given is always picked first:
All ways of picking one element from each list:
All possible 3-tuples of and :
In[1]:=
Click for copyable input
Out[1]=
 
The first element given is always picked first:
In[1]:=
Click for copyable input
Out[1]=
 
All ways of picking one element from each list:
In[1]:=
Click for copyable input
Out[1]=
Each occurrence of an element is picked separately:
All possible 2×2 arrays formed from and :
Tuples with any head:
Digits of successive base-2 numbers:
All possible trigrams of and :
Neighborhood rules for an elementary cellular automaton:
Digit sequences, or evolution of a substitution system:
2D lattice of points:
Connect pairs of points in all possible ways:
All possible digit sequences:
Results from Outer involve extra sublists:
Subsets picks each element at most once, and treats reorderings as equivalent:
With one argument, Tuples picks an element from each sublist:
With two arguments, Tuples treats each sublist as a complete element:
3D lattice of points:
New in 5.1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF