Outer
詳細
- Outer[Times,list1,list2]は,外積を与える.
- テンソル Ti1i2...irと Uj1j2...jsにOuterを適用した結果は,要素 f[Ti1i2...ir,Uj1j2...js]を持ったテンソルVi1i2...irj1j2...jsである.
- f がスカラー値関数の場合,階数 r と s の2つのテンソルにOuterを適用すると,階数 r+s のテンソルが返される..
- listiの頭部はすべて同じでなければならないが,Listである必要はない. »
- Outer[f]は f[]を返す.
- listiが,立方配列である必要はない.
- レベルの指示 niは正の整数またはInfinityでなければならない.
- 単一レベルの指示のみが与えられる場合は,すべての listiに適用することが仮定される.niが複数あるが listiの数よりも少ない場合は,listiに残る最低レベルの要素が使用される.
- OuterをSparseArrayオブジェクトに使うと,可能な場合はSparseArrayオブジェクトを返す. »
例題
すべて開く すべて閉じる例 (2)
スコープ (4)
Outer[f, {a, b}, {x, y, z}, {u, v}]Outer[f, {{1, 2}, {3, 4}}, {{a, b}, {c, d}}, 1]Outer[Times, {{1, 2}, {3, 4}}, {{a, b, c}, {d, e}}]SparseArrayオブジェクトの外積:
s1 = SparseArray[Table[2 ^ i -> i, {i, 3}]];
s2 = SparseArray[{1} -> 1, {4}];Outer[Times, s1, s2]一般化と拡張 (1)
頭部はListではなくてもよい:
Outer[g, f[a, b], f[x, y, z]]アプリケーション (6)
Outer[StringJoin, {"", "re", "un"}, {"cover", "draw", "wind"}, {"", "ing", "s"}]fm = Outer[Composition, {Sin, Cos, Exp}, {ArcSin, ArcCos, Log}]GraphicsGrid@Map[Function[f, Plot3D[Re[f[x + I y]], {x, -2, 2}, {y, -2, 2}, Mesh -> None]], fm, {2}]Graphics[Outer[Line[ {##}]&, Table[{x, 1}, {x, 4}], Table[{x, 2}, {x, 4}], 1]]Boole[Outer[Greater, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}]]//MatrixFormfからのノードとeからの深さnの葉を持った可能なすべての二分木を生成する:
trees[f_, e_, 1] = e;
trees[f_, e_, n_] := Flatten[Table[Outer[#, trees[f, e, r], trees[f, e, n - r]], {r, n - 1}]& /@ f]trees[{f}, {a, b}, 3]x = {0., .1, .25, .5, 1.};
y = {-1., -.5, 0., 1 / 3., 2 / 3., 1.};fxy = Outer[Sin[Pi #1 ^ 2#2]&, x, y]grid = {Map[Line, Outer[List, x, y]], Map[Line, Outer[Reverse[List[##]]&, y, x]]};Show[ListContourPlot[Transpose[fxy], DataRange -> {{0, 1}, {-1, 1}}], Graphics[{Red, grid}]]fxyc = Outer[{{##}, Sin[Pi #1 ^ 2#2]}&, x, y];
Short[fxyc, 3]fun = Interpolation[Flatten[fxyc, 1]]Show[ContourPlot[fun[s, t], {s, 0, 1}, {t, -1, 1}], Graphics[{Red, grid}]]特性と関係 (7)
Outer[f, {x, x, x}, {x, x, x, x}]Dimensions[%]Dimensions[Outer[f, {x, x, x}, {x, x, x, x}, {x, x}, {x, x, x, x, x}]]Dimensions[Outer[f, {{x, x}, {x, x}}, {x, x, x}, {{x}}]]Outer[f]は f[]を返す:
Outer[f]Outer[List,list1,list2,…]は,listiからのタプルの配列Length[list1]×Length[list2]×…を作成する:
Outer[List, {1}, {x, y}, {a, b, c, d}]Dimensions[%]Tuples[{list1,list2,…}]は,同じタプルを平なリストとして返す:
Tuples[{{1}, {x, y}, {a, b, c, d}}]Dimensions[%]Distributeはすべての要素を平坦な構造で同じように結合する:
Distribute[{{a, b, c}, {x, y}}, List]Outer[List, {a, b, c}, {x, y}]KroneckerProductは,行列の平坦化された外積である:
m1 = {{a, b}, {c, d}};
m2 = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};(kp = KroneckerProduct[m1, m2]) //MatrixForm(op = Outer[Times, m1, m2]) //MatrixFormArrayFlatten[op] === kpPartは複数のレベルの部分のリストを与えられると実質的に外積を使う:
m = Partition[Range[36], 6];
{p1, p2} = RandomInteger[{1, 6}, {2, 3}]m[[p1, p2]]Outer[Part[m, ##]&, p1, p2]Tableはまたリストから一般化された外積を作る:
l1 = {1, 2, 3, 4};
l2 = {a, b, c};Table[f[x1, x2], {x1, l1}, {x2, l2}]Outer[f, l1, l2]考えられる問題 (1)
背景に一貫性がないと一般化された外積が疎ではなくなることがある:
s1 = SparseArray[Table[2 ^ i -> i, {i, 2}]];
s2 = SparseArray[{1} -> 1, {3}];Outer[f, s1, s2]背景を選んでこれをSparseArrayに変換することができる:
SparseArray[%, Automatic, f[0, 0]]テクニカルノート
-
▪
- 構造操作 ▪
- ネストしたリスト ▪
- ベクトルおよび行列の積 ▪
- テンソル
関連するガイド
-
▪
- 関数のリストへの適用 ▪
- テンソル ▪
- リストの構築 ▪
- リスト操作 ▪
- 式への構造操作
履歴
1988 で導入 (1.0) | 1996 で更新 (3.0) ▪ 2003 (5.0) ▪ 2020 (12.1)
テキスト
Wolfram Research (1988), Outer, Wolfram言語関数, https://reference.wolfram.com/language/ref/Outer.html (2020年に更新).
CMS
Wolfram Language. 1988. "Outer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Outer.html.
APA
Wolfram Language. (1988). Outer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Outer.html
BibTeX
@misc{reference.wolfram_2026_outer, author="Wolfram Research", title="{Outer}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Outer.html}", note=[Accessed: 13-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_outer, organization={Wolfram Research}, title={Outer}, year={2020}, url={https://reference.wolfram.com/language/ref/Outer.html}, note=[Accessed: 13-October-2026]}