Legacy Documentation

Mathematica® Teacher's Edition (2002)

This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  The Teacher's Book /  Interlude 1: Lists /

12.1 Collecting Objects Together

You first encountered lists in Section 3.4 as a way of collecting numbers together. In this chapter, you shall see many different ways to use lists. You will find that lists are some of the most flexible and powerful objects in Mathematica TE. You will see that lists in Mathematica TE represent generalizations of several standard concepts in mathematics and computer science.
At a basic level, what a Mathematica TE 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]:= v = {2, 3, 4}

Out[1]=

This doubles each element.

In[2]:= 2 v

Out[2]=

This adds two lists.

In[3]:= v + {0, 3, 5}

Out[3]=

This divides through by 3.

In[4]:= % / 3

Out[4]=

This gives a list of symbolic expressions.

In[5]:= x^v - 1

Out[5]=

You can differentiate these expressions.

In[6]:= D[%, x]

Out[6]=

Or you can find their values when x is replaced with 3.

In[7]:= %% /. x -> 3

Out[7]=

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