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 allBasic Examples (4)
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:
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