Elementwise

Elementwise[f][{x1,,xn},{y1,,yn}]

gives {f[x1,y1],,f[xn,yn]}.

Elementwise[f][arg1,]

threads over any lists in arg1,.

Details

  • Elementwise is typically used to make non-listable functions behave as if they were listable.

Examples

open allclose all

Basic Examples  (4)

Replace negative numbers with 0:

Find which elements of a list are less than one:

Use the operator form:

Choose matrix elements that have the largest square:

Add angle brackets to each of a list of strings:

Scope  (5)

Greater does not thread over lists by default:

Use Elementwise[Greater] instead to make it behave as a listable function:

Min returns the minimum value in its arguments:

Use Elementwise[Min] to thread its arguments to the deepest possible level:

Effectively this is the threading operation performed:

Take a TabularColumn object of dates:

Extract efficiently respective columns for their months and days:

Construct a Tabular object with those two columns:

Take a Tabular object with two columns of triples:

Elementwise works with Threaded:

Properties & Relations  (5)

Elementwise threads like Listable functions:

Elementwise[f][] returns f[]:

Elementwise[f][{}] returns {}:

For several lists of the same length, Elementwise[f][list1,list2,] is equivalent to MapThread[f][{list1,list2,}]:

If any of the lists contains sublists, Elementwise will thread as much as possible:

Another difference is that Elementwise can thread with scalars:

Elementwise[f][list,scalar] is equivalent to Thread[f[list,scalar]] if f[list,scalar] does not evaluate:

Some functionality of Elementwise can be obtained with Map:

Or Thread:

Or a combination of Map and Thread:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_elementwise, author="Wolfram Research", title="{Elementwise}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Elementwise.html}", note=[Accessed: 15-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_elementwise, organization={Wolfram Research}, title={Elementwise}, year={2025}, url={https://reference.wolfram.com/language/ref/Elementwise.html}, note=[Accessed: 15-January-2025 ]}