Elementwise
Elementwise[f][{x1,…,xn},{y1,…,yn}]
gives {f[x1,y1],…,f[xn,yn]}.
Elementwise[f][arg1,…]
threads over any lists in arg1,….
范例
打开所有单元关闭所有单元基本范例 (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:
Applications (2)
Properties & Relations (6)
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:
Elementwise is equivalent to MapAt with All at all applicable levels:
文本
Wolfram Research (2025),Elementwise,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Elementwise.html.
CMS
Wolfram 语言. 2025. "Elementwise." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/Elementwise.html.
APA
Wolfram 语言. (2025). Elementwise. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/Elementwise.html 年