This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# Part

 or Partgives the i part of expr. counts from the end. or Partis equivalent to . gives a list of the parts , , ... of expr. gives parts m through n. gives parts m through n in steps of s.
• You can make an assignment like to modify any part or sequence of parts in an expression. »
• Part 0 of an expression is its head.
• Common spans of parts include:
 expr[[m;;]] part m through the end expr[[;;n]] from the beginning to part n expr[[;;,j]] column j expr[[m1;;n1,m2;;n2]] submatrix
• When expr is a list, gives a list of parts. In general, the head of expr is applied to the list of parts. »
• You can get a nested list of parts from . Each part has one index from each list.
• If any of the are All or , all parts at that level are kept.
• If expr is a SparseArray object, gives the parts in the corresponding ordinary array. »
• and can be entered as Esc [[ Esc and Esc ]] Esc or \[LeftDoubleBracket] and \[RightDoubleBracket].
 Basic Examples   (10)
Pick out a part of a list:
Pick out a sequence of parts:
Pick out a part of a matrix:
The second row of a matrix:
The second column of a matrix:
An element 2 from the end of a list:
A list of parts:
Reassign a part:
Reassign a sequence of parts:
Part works with expressions of any kind, not just lists:
Part always operates on the FullForm of expressions:
Pick out a part of a list:
 Out[1]=

Pick out a sequence of parts:
 Out[1]=

Pick out a part of a matrix:
 Out[1]=

The second row of a matrix:
 Out[1]=

The second column of a matrix:
 Out[1]=

An element 2 from the end of a list:
 Out[1]=

A list of parts:
 Out[1]=

Reassign a part:
 Out[1]=
 Out[2]=
 Out[3]=

Reassign a sequence of parts:
 Out[1]=
 Out[2]=
 Out[3]=

Part works with expressions of any kind, not just lists:
 Out[1]=
 Out[2]=
 Out[3]=
Part always operates on the FullForm of expressions:
 Out[4]=
 Out[5]//FullForm=
 Scope   (10)
Equivalent forms:
Pick out parts 1 and 3:
Pick out parts 2 and 3 of parts 1 and 3:
Parts 1 through third-to-last:
Shorter notation:
Parts 3 through third-to-last extracted in steps of 2:
Parts extracted in steps of 2 starting at the beginning:
Enter in FullForm:
Enter using Esc [[ Esc and Esc ]] Esc:
Enter as a subscript:
Assign several parts at once:
Assign parts 2 and 3 to be :
Assign different values to parts 1, 3, and 4:
All standard assignment operations work on parts:
Rearrange elements by reassigning parts:
For SparseArray objects, Part gives the parts in the corresponding ordinary array:
Rows or columns are represented as sparse vectors:
Values can also be set:
The zeroth part of an expression is its head:
Heads in the original expression are reused when "lists" of parts are extracted:
 Applications   (4)
Pick out the first solution from an equation:
Pick out all solutions for a univariate equation:
Go through the first 1000 primes, and count how many lie in each possible "mod 10 bin":
Another way to get the same result:
Apply a permutation:
Invert a permutation:
Pick out parts cyclically by using Mod with offset 1:
Take picks out ranges of parts:
Part operates on the FullForm of expressions, not their formatted forms:
Position does not return part specifications in a form that can immediately be used by Part:
Extract extracts parts specified in the way returned by Position:
Successive part extraction is not always equivalent to direct part extraction:
Only parts that already exist can be reassigned: