Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > List Manipulation > Applying Functions to Lists >
Mathematica > Data Manipulation > Handling Arrays of Data > Applying Functions to Lists >

MapThread

MapThread[f, {{a1, a2, ...}, {b1, b2, ...}, ...}]
gives {f[a1, b1, ...], f[a2, b2, ...], ...}.
MapThread[f, {expr1, expr2, ...}, n]
applies f to the parts of the expri at level n.
Apply f to corresponding pairs of elements:
Apply f to elements of a matrix:
Apply f to corresponding pairs of elements:
In[1]:=
Click for copyable input
Out[1]=
 
Apply f to elements of a matrix:
In[1]:=
Click for copyable input
Out[1]=
By default, MapThread threads over level 1 of the arguments:
Thread over level 2:
MapThread works with any number of expressions:
Set up an outer totalistic cellular automaton:
Divide eigenvectors by their corresponding eigenvalues:
Apply the functions in a list to corresponding arguments:
Add columns of elements in a matrix:
Get lists of elements in columns of a matrix:
MapThread works like Thread, but takes the function and arguments separately:
Thread evaluates the whole expression before threading:
MapThread takes the function and its arguments separately:
MapThread is a generalization of Map to functions of several variables:
All arguments must be lists of the same length:
Thread repeats nonlist arguments as needed:
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team