This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Programming / Functional Programming /

Further Examples: Map (/@)

This reverses each of the pairs in the list.

In[1]:=

Out[1]=

This maps the function f at the first level and then at the second level.

In[2]:=

Out[2]=

In[3]:=

Out[3]=

This maps the function f on each term of the polynomial.

In[4]:=

Out[4]=

However when the polynomial has only one term you get unexpected results. If the function f is mapped to an atom, the atom is returned.

In[5]:=

Out[5]=

The Head of 2x is Times.

In[6]:=

Out[6]=

The Head of is Power.

In[7]:=

Out[7]=

Here is a function that maps onto individual terms of a polynomial.

In[8]:=

In[9]:=

Now f maps properly onto the three individual terms.

In[10]:=

Out[10]=

In[11]:=

Out[11]=

In[12]:=

Out[12]=

In[13]:=

Out[13]=