Take
Details
- Take uses the standard sequence specification:
-
All all elements None no elements n elements 1 through n UpTo[n] elements 1 up to at most n, as available -n last n elements {n} element n only {m,n} elements m through n inclusive {m,n,s} elements m through n in steps of s - Take can be used on an object with any head, not necessarily List.
- Take[list,seq1,seq2] effectively extracts a submatrix from list.
- Applying Take to a SparseArray object normally yields another SparseArray object.
- Applying Take to an Association object yields an Association containing elements from the specified positions.
Examples
open all close allBasic Examples (6)
Take the first 4 elements from a list:
Take[{a, b, c, d, e, f}, 4]Take[{a, b, c, d, e, f}, -3]Take[{a, b, c, d, e, f}, {2, 4}]Take the second element from an Association:
Take[<|1 -> a, 2 -> b, 3 -> c|>, {2}]Take all but the first element from an Association:
Take[<|1 -> a, 2 -> b, 3 -> c, 4 -> d|>, {2, -1}]Take every other element from 2 to 6 from an Association:
Take[<|1 -> a, 2 -> b, 3 -> c, 4 -> d, 5 -> e, 6 -> f|>, {2, 6, 2}]Scope (8)
Take elements from the second to the second-to-last:
Take[{a, b, c, d, e, f}, {2, -2}]Take[{a, b, c, d, e, f}, {1, -1, 2}]Take the first two rows of a matrix:
Take[{{11, 12, 13}, {21, 22, 23}, {31, 32, 33}}, 2]Take all rows, and the first two columns:
Take[{{11, 12, 13}, {21, 22, 23}, {31, 32, 33}}, All, 2]Take the first two rows, and the last column:
Take[{{11, 12, 13}, {21, 22, 23}, {31, 32, 33}}, 2, -1]Take[(| | | | | |
| :- | :- | :- | :- | :- |
| 11 | 12 | 13 | 14 | 15 |
| 21 | 22 | 23 | 24 | 25 |
| 31 | 32 | 33 | 34 | 35 |
| 41 | 42 | 43 | 44 | 45 |
| 51 | 52 | 53 | 54 | 55 |), {2, 4}, {3, 5}]//MatrixFormTake every other row and column:
Take[(| | | | | |
| :- | :- | :- | :- | :- |
| 11 | 12 | 13 | 14 | 15 |
| 21 | 22 | 23 | 24 | 25 |
| 31 | 32 | 33 | 34 | 35 |
| 41 | 42 | 43 | 44 | 45 |
| 51 | 52 | 53 | 54 | 55 |), {1, -1, 2}, {1, -1, 2}]//MatrixFormTake the first 4 elements if possible, else as many as are available:
Take[{a, b, c}, UpTo[4]]Generalizations & Extensions (2)
Take works with any head, not just List:
Take[a + b + c + d + e + f, 3]Take[{a + b + c, t + u + v, x + y + z}, 2, 2]Take[(a + b + c)(t + u + v)(x + y + z), 2, 2]Take works with SparseArray objects:
Take[SparseArray[Range[1000]], {100, 105}]Normal[%]Applications (2)
ArrayPlot[CellularAutomaton[150, {{1}, 0}, 50]]ArrayPlot[Take[CellularAutomaton[150, {{1}, 0}, 50], {20, -20}, {20, -20}]]Sample every third cell in an image:
ArrayPlot[CellularAutomaton[30, {{1}, 0}, 50]]ArrayPlot[Take[CellularAutomaton[30, {{1}, 0}, 50], {1, -1, 3}, {1, -1, 3}]]Properties & Relations (5)
Take and Drop are complementary:
Take[{a, b, c, d, e, f, g, h}, {2, -4, 2}]Drop[{a, b, c, d, e, f, g, h}, {2, -4, 2}]Take is often equivalent to Part extraction with Range:
Take[{a, b, c, d, e, f, g, h}, 4]{a, b, c, d, e, f, g, h}[[Range[4]]]Take[{a, b, c, d, e, f, g, h}, {2, 7, 2}]{a, b, c, d, e, f, g, h}[[Range[2, 7, 2]]]Take is equivalent to Part extraction with Span:
e = Array[Subscript[x, #]&, 7]Take[e, {-1, 1, -2}]e[[-1 ;; 1 ;; -2]]Take gives an array whose first dimensions are its arguments:
Dimensions[Take[Array[a, {10, 10, 10, 10}], 3, 4]]Reverse[e] is equivalent to Take[e,{-1,1,-1}]:
e = Array[Subscript[x, #]&, 7]Reverse[e]Take[e, {-1, 1, -1}]Possible Issues (1)
Take always returns a list, even if it is just taking a single element:
Take[{a, b, c, d, e}, -1]Tech Notes
Related Guides
-
▪
- Parts of Expressions ▪
- Parts of Matrices ▪
- List Manipulation ▪
- Basic Image Manipulation ▪
- Rearranging & Restructuring Lists ▪
- Elements of Lists ▪
- Computation with Structured Datasets ▪
- Numerical Data ▪
- Language Overview ▪
- Handling Arrays of Data ▪
- Tabular Objects ▪
- Incrementals ▪
- Structural Operations on Expressions
History
Introduced in 1988 (1.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2003 (5.0) ▪ 2014 (10.0) ▪ 2015 (10.3)
Text
Wolfram Research (1988), Take, Wolfram Language function, https://reference.wolfram.com/language/ref/Take.html (updated 2015).
CMS
Wolfram Language. 1988. "Take." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/Take.html.
APA
Wolfram Language. (1988). Take. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Take.html
BibTeX
@misc{reference.wolfram_2026_take, author="Wolfram Research", title="{Take}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/Take.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_take, organization={Wolfram Research}, title={Take}, year={2015}, url={https://reference.wolfram.com/language/ref/Take.html}, note=[Accessed: 12-June-2026]}