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

Listable

Listable
is an attribute that can be assigned to a symbol to indicate that the function should automatically be threaded over lists that appear as its arguments.
  • Listable functions are effectively applied separately to each element in a list, or to corresponding elements in each list if there is more than one list.
  • All the arguments which are lists in a Listable function must be of the same length. »
  • Arguments that are not lists are copied as many times as there are elements in the lists.
Log is listable:
Listable functions combine corresponding elements:
Arguments that are not lists are replicated as needed:
Log is listable:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Listable functions combine corresponding elements:
In[1]:=
Click for copyable input
Out[1]=
 
Arguments that are not lists are replicated as needed:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Define a function to be listable:
Most built-in mathematical functions are listable:
Listability works for any nesting depth of lists:
The nesting level of the different arguments need not be the same:
Listability works also with sparse arrays:
To apply a function to a vector, take advantage of Listable functions when possible:
Use the listability of Plus, Power, Sin, and Times:
Use Map:
Use Table:
Use Table and Part to access elements of v as might be done in a lower-level language:
The results are the same up to numerical roundoff:
Use efficient sparse arithmetic to numerically solve the heat equation :
Matrix for a second-order approximation to the second derivative on the grid :
Incorporate Dirichlet boundary conditions to form the Jacobian J:
The sparse identity matrix:
Form sparse matrix for using the listability of arithmetic:
LU decomposition of in a functional form:
Step initial condition on spatial grid x using the listability of UnitStep:
Get the solution at , using the backward Euler method:
Listability is the same as automatic threading:
A function implemented in terms of a listable operation may not need the Listable attribute:
The system symbols with the Listable attribute:
Many of these are arithmetic or numerical functions:
The products given by Dot, Times, and KroneckerProduct are inner, element-wise, and outer:
The inner product of two vectors:
The vector resulting from the product of corresponding elements:
The matrix resulting from the outer product of the vectors:
All list arguments must have the same length:
New in 1