This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / The Mathematica Book / Practical Introduction / Lists  /

1.8.1 Collecting Objects Together

We first encountered lists in Section 1.2.3 as a way of collecting numbers together. In this section, we shall see many different ways to use lists. You will find that lists are some of the most flexible and powerful objects in Mathematica. You will see that lists in Mathematica represent generalizations of several standard concepts in mathematics and computer science.
At a basic level, what a Mathematica list essentially does is to provide a way for you to collect together several expressions of any kind.

  • Here is a list of numbers.
  • In[1]:= {2, 3, 4}

    Out[1]=

  • This gives a list of symbolic expressions.
  • In[2]:= x^% - 1

    Out[2]=

  • You can differentiate these expressions.
  • In[3]:= D[%, x]

    Out[3]=

  • And then you can find values when x is replaced with 3.
  • In[4]:= % /. x -> 3

    Out[4]=

    The mathematical functions that are built into Mathematica are mostly set up to be "listable" so that they act separately on each element of a list. This is, however, not true of all functions in Mathematica. Unless you set it up specially, a new function f that you introduce will treat lists just as single objects. Sections 2.2.4 and 2.2.10 will describe how you can use Map and Thread to apply a function like this separately to each element in a list.