MATHEMATICA TUTORIAL

# Grouping and Combining Elements of Lists

 Partition[list,n] partition list into n-element pieces Partition[list,n,d] use offset d for successive pieces Split[list] split list into pieces consisting of runs of identical elements

Functions for grouping together elements of lists.

Here is a list.
 Out[1]=
This groups the elements of the list in pairs, throwing away the single element left at the end.
 Out[2]=
This groups elements in triples. There is no overlap between the triples.
 Out[3]=
This makes triples of elements, with each successive triple offset by just one element.
 Out[4]=
This splits up the list into runs of identical elements.
 Out[5]=
 Tuples[list,n] generate all possible n-tuples of elements from list Tuples[{list1,list2,...}] generate all tuples whose i element is from

Finding possible tuples of elements in lists.

This gives all possible ways of picking two elements out of the list.
 Out[6]=
This gives all possible ways of picking one element from each list.
 Out[7]=

## Tutorial CollectionTutorial Collection

New to Mathematica? Find your learning path »
Have a question? Ask support »