Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Lists and Matrices / Element Extraction  /
Take

  • Take[ list , n ] gives the first n elements of list.
  • Take[ list , - n ] gives the last n elements of list.
  • Take[ list , m , n ] gives elements m through n of list.
  • Take uses the standard sequence specification (see Section A.3.5).
  • Example: Take[ a,b,c,d,e , 3].
  • Take[ a,b,c,d,e , -2].
  • Take can be used on an object with any head, not necessarily List.
  • See the Mathematica book: Section 1.8.4.
  • See also: Part, Drop, StringTake, Select, Cases.
  • Related package: LinearAlgebra`MatrixManipulation`.

    Further Examples

    This takes the first three elements from the list.

    In[1]:=

    Out[1]=

    This takes the last two elements from the list.

    In[2]:=

    Out[2]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.