Elementwise

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

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

Elementwise[f][arg1,]

threads over any lists in arg1,.

更多信息

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

范例

打开所有单元关闭所有单元

基本范例  (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:

Applications  (2)

Get full names by combining first and last names:

Find how many notable books written by Ernest Hemingway were first published before his death:

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.

文本

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 年

BibTeX

@misc{reference.wolfram_2025_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_2025_elementwise, organization={Wolfram Research}, title={Elementwise}, year={2025}, url={https://reference.wolfram.com/language/ref/Elementwise.html}, note=[Accessed: 15-January-2025 ]}