Elementwise[f][{x1,…,xn},{y1,…,yn}]
{f[x1,y1],…,f[xn,yn]}を与える.
Elementwise[f][arg1,…]
arg1,…内の任意のリストに縫い込む.
Elementwise
Elementwise[f][{x1,…,xn},{y1,…,yn}]
{f[x1,y1],…,f[xn,yn]}を与える.
Elementwise[f][arg1,…]
arg1,…内の任意のリストに縫い込む.
詳細
- Elementwiseは,通常,リスト化不可能な関数をリスト化可能なものとして動作させるために使われる.
例題
すべて開く すべて閉じる例 (4)
Elementwise[Max][{1, -1, 3, -4, 5}, 0]Elementwise[Less][{1, 0, 2, -1}, 1]Elementwise[LessThan[1]][{1, 0, 2, -1}]Elementwise[If[#1^2 >= #2^2, #1, #2]&][(| | | |
| -- | -- | -- |
| -9 | -5 | -7 |
| -2 | -4 | 1 |
| -3 | -8 | -4 |), (| | | |
| -- | -- | -- |
| -1 | 2 | -5 |
| 5 | -2 | -3 |
| 4 | 6 | 3 |)]Elementwise[StringJoin]["<", RandomWord[5], ">"]スコープ (5)
Greaterは,デフォルトではリストに縫い込まれない:
Greater[{1, -1, 3, -4, 5}, 0]Elementwise[Greater]を使ってリスト化可能な関数として動作するようにする:
Elementwise[Greater][{1, -1, 3, -4, 5}, 0]Minは引数の最小値を返す:
Min[2, {-4, 2}, {{8, 5}, {-1, 6}}]Elementwise[Min]を使って可能な最深レベルまで引数を縫い込む:
Elementwise[Min][2, {-4, 1}, {{8, 5}, {0, 6}}]Block[{min},
SetAttributes[min, Listable];
min[2, {-4, 1}, {{8, 5}, {0, 6}}]
]日付のTabularColumnオブジェクトを取る:
TabularColumn[RandomDate[10 ^ 5]]RepeatedTiming[mds = Elementwise[DateValue[#, {"Month", "Day"}]&][%]]これら2列のTabularオブジェクトを構築する:
ToTabular[{"month" -> mds[[All, 1]], "day" -> mds[[All, 2]]}, "Columns"]3数のリストからなる2列のTabularオブジェクトを取得する:
tab = Tabular[{{{1, 2, 3}, 2}, {{2, -1, 4}, 1}}, {"vector", "scalar"}]TransformColumns[tab, "comp" -> Function[Elementwise[Greater][#vector, #scalar]]]ElementwiseはThreadedに使える:
Elementwise[f][{{1, 2, 3}, {4, 5, 6}}, {a, b}]Elementwise[f][{{1, 2, 3}, {4, 5, 6}}, Threaded[{α, β, γ}]]アプリケーション (2)
firstNames = TabularColumn[{"Pierce", "Sean", "Daniel", "Timothy", "George", "Roger", "David"}];
lastNames = TabularColumn[{"Brosnan", "Connery", "Craig", "Dalton", "Lazenby", "Moore", "Niven"}];Elementwise[StringJoin][firstNames, " ", lastNames]Normal[%]ヘミングウェイの主要作品の中で彼の生前に出版されたものの冊数を求める:
dates = EntityValue[Entity["Person", "ErnestHemingway::8gktg"][EntityProperty["Person", "NotableBooks"]], EntityProperty["Book", "FirstPublished"]]Elementwise[LessEqualThan[Entity["Person", "ErnestHemingway::8gktg"]["DeathDate"]]][dates]//Counts特性と関係 (6)
ElementwiseはListable関数のように縫い込まれる:
Elementwise[f][1, {2, 3}, {{4, 5, 6}, {7, 8, 9}}]Block[{f},
SetAttributes[f, Listable];
f[1, {2, 3}, {{4, 5, 6}, {7, 8, 9}}]
]%% === %Elementwise[f][]は f[]を返す:
Elementwise[f][]Elementwise[f][{}]は{}を返す:
Elementwise[f][{}]Elementwise[f][list1,list2,…]は,同じ長さのいくつかのリストについてはElementwise[f][list1,list2,…]に等しい:
Elementwise[f][{a, b}, {1, 2}, {x, y}]MapThread[f][{{a, b}, {1, 2}, {x, y}}]リストの中にサブリストを含むものがあれば,Elementwiseは可能な限り縫い込まれる:
Elementwise[f][{{a}, {b}}, {1, 2}, {x, y}]MapThread[f][{{{a}, {b}}, {1, 2}, {x, y}}]また別の相違は,Elementwiseがスカラーにも縫い込まれる点である:
Elementwise[f][{a, b}, 0, {x, y}]f[list,scalar]が評価されないのなら,Elementwise[f][list,scalar]はThread[f[list,scalar]]に等しい:
Elementwise[f][{a, b, c}, x]Thread[f[{a, b, c}, x]]Elementwiseの機能の中にはMapで達成できるものもある:
Elementwise[Max][{1, -1, 3, -4, 5}, 0]Map[Max[#, 0]&, {1, -1, 3, -4, 5}]あるいはThreadで:
Elementwise[LessThan[1]][{1, 0, 2, -1}]Thread[LessThan[1][{1, 0, 2, -1}]]Elementwise[f][{{1, 2, 3}, {4, 5, 6}}, {a, b}]MapThread[Thread[f[#1, #2]]&, {{{1, 2, 3}, {4, 5, 6}}, {a, b}}]Elementwiseは,可能なすべてのレベルでAllを使用したMapAtに等しい:
data = {{0.2, 0.8, .9}, {0.12, .74}, {.4}, {.32, .85}};Elementwise[f][data]MapAt[f, data, {All, All}]テキスト
Wolfram Research (2025), Elementwise, Wolfram言語関数, 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_2026_elementwise, author="Wolfram Research", title="{Elementwise}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Elementwise.html}", note=[Accessed: 05-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_elementwise, organization={Wolfram Research}, title={Elementwise}, year={2025}, url={https://reference.wolfram.com/language/ref/Elementwise.html}, note=[Accessed: 05-September-2026]}