Tuples
Tuples[list,n]
generates a list of all possible n‐tuples of elements from list.
Tuples[{list1,list2,…}]
generates a list of all possible tuples whose i element is from listi.
Tuples[list,{n1,n2,…}]
generates a list of all possible … arrays of elements in list.
Details
- The elements of list are treated as distinct, so that Tuples[list,n] for a list of length k gives output of length kn.
- Tuples[list,n] is equivalent to Tuples[Table[list,n]].
- The order of elements in Tuples[list,n] is based on the order of elements in list, so that Tuples[{a1,…,ak},n] gives .
- 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.
Examples
open allclose allBasic Examples (3)
Generalizations & Extensions (3)
Applications (8)
Properties & Relations (4)
Possible Issues (1)
Wolfram Research (2004), Tuples, Wolfram Language function, https://reference.wolfram.com/language/ref/Tuples.html.
Text
Wolfram Research (2004), Tuples, Wolfram Language function, https://reference.wolfram.com/language/ref/Tuples.html.
CMS
Wolfram Language. 2004. "Tuples." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Tuples.html.
APA
Wolfram Language. (2004). Tuples. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Tuples.html