WOLFRAM

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.

Details

  • 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.
  • Most builtin mathematical functions are Listable. »
  • 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.

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

A Listable function threads over its list argument:

Out[1]=1

Log is listable:

Out[1]=1
Out[2]=2

Listable functions combine corresponding elements:

Out[1]=1

Arguments that are not lists are replicated as needed:

Out[1]=1
Out[2]=2

Scope  (4)Survey of the scope of standard use cases

Define a function to be listable:

Out[2]=2

Most built-in mathematical functions are listable:

Out[1]=1
Out[2]=2
Out[3]=3

Listability works for any nesting depth of lists:

Out[1]=1

The nesting level of the different arguments need not be the same:

Out[2]=2

Listability works on other list-like constructs such as SparseArray:

Out[2]=2

Association:

Out[3]=3

Applications  (2)Sample problems that can be solved with this function

To apply a function to a vector, take advantage of Listable functions when possible:

Use the listability of Plus, Power, Sin, and Times:

Out[2]=2

Use Map:

Out[3]=3

Use Table:

Out[4]=4

Use Table and Part to access elements of v as might be done in a lower-level language:

Out[5]=5

The results are the same up to numerical roundoff:

Out[6]=6

Use efficient sparse arithmetic to numerically solve the heat equation :

Matrix for a second-order approximation to the second derivative on the grid :

Out[2]=2

Incorporate Dirichlet boundary conditions to form the Jacobian J:

Out[3]=3

The sparse identity matrix:

Out[4]=4

Form sparse matrix for using the listability of arithmetic:

Out[5]=5

LU decomposition of in a functional form:

Out[6]=6

Step initial condition on spatial grid x using the listability of UnitStep:

Out[7]=7

Get the solution at , using the backward Euler method:

Out[9]=9

Properties & Relations  (7)Properties of the function, and connections to other functions

Listable, in general, functions effectively apply Thread many times:

Out[2]=2
Out[3]=3
Out[4]=4

Applying listable functions to several arrays of equal dimension is equivalent to using MapThread:

Out[3]=3

Listable functions applied to several arrays require overlapping dimensions to be equal:

Arguments with equal dimensions:

Out[2]=2

Arguments with equal overlapping dimensions, i.e. {2} has the same leading dimensions as {2,3}:

Out[3]=3

Arguments with unequal overlapping dimensions, i.e. {2} does not have the same leading dimensions as {3,2}:

Listable functions applied to arrays can be written as a Table:

Let :

In general, :

Out[3]=3

A function implemented in terms of a listable operation may not need the Listable attribute:

Out[2]=2
Out[3]=3

The system symbols with the Listable attribute:

More than half these are arithmetic functions possessing the NumericFunction attribute as well:

Out[2]=2

The products given by Dot, Times, and KroneckerProduct are inner, element-wise, and outer:

The inner product of two vectors:

Out[2]=2

The vector resulting from the product of corresponding elements:

Out[3]=3

The matrix resulting from the outer product of the vectors:

Possible Issues  (1)Common pitfalls and unexpected behavior

All list arguments must have the same length:

Out[1]=1
Wolfram Research (1988), Listable, Wolfram Language function, https://reference.wolfram.com/language/ref/Listable.html.
Wolfram Research (1988), Listable, Wolfram Language function, https://reference.wolfram.com/language/ref/Listable.html.

Text

Wolfram Research (1988), Listable, Wolfram Language function, https://reference.wolfram.com/language/ref/Listable.html.

Wolfram Research (1988), Listable, Wolfram Language function, https://reference.wolfram.com/language/ref/Listable.html.

CMS

Wolfram Language. 1988. "Listable." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Listable.html.

Wolfram Language. 1988. "Listable." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Listable.html.

APA

Wolfram Language. (1988). Listable. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Listable.html

Wolfram Language. (1988). Listable. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Listable.html

BibTeX

@misc{reference.wolfram_2025_listable, author="Wolfram Research", title="{Listable}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Listable.html}", note=[Accessed: 13-April-2025 ]}

@misc{reference.wolfram_2025_listable, author="Wolfram Research", title="{Listable}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Listable.html}", note=[Accessed: 13-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_listable, organization={Wolfram Research}, title={Listable}, year={1988}, url={https://reference.wolfram.com/language/ref/Listable.html}, note=[Accessed: 13-April-2025 ]}

@online{reference.wolfram_2025_listable, organization={Wolfram Research}, title={Listable}, year={1988}, url={https://reference.wolfram.com/language/ref/Listable.html}, note=[Accessed: 13-April-2025 ]}