ConstantArray[c,n]
要素 c を n 個複製したリストを生成する.
ConstantArray[c,{n1,n2,…}]
要素 c の複製を含むネストされたリストの
配列を生成する.
ConstantArray
ConstantArray[c,n]
要素 c を n 個複製したリストを生成する.
ConstantArray[c,{n1,n2,…}]
要素 c の複製を含むネストされたリストの
配列を生成する.
詳細
- ConstantArray[c,n,SparseArray]は定数配列をSparseArrayオブジェクトとして返す.
例題
すべて開く すべて閉じる例 (3)
スコープ (4)
ConstantArray[0., 10]ConstantArray[0, 10]zm = ConstantArray[0., {3, 3}]ConstantArray[0, {3, 3}]ConstantArray[1, 10]ConstantArray[1., 10]ConstantArray[x, {2, 1, 2, 1, 2}]アプリケーション (3)
esteps[f_, x0_, h_, n_] := Module[{res = ConstantArray[x0, {n + 1}], x = x0},
Do[x += h f[i h, x];res[[i + 1]] = x, {i, n}];res]オイラー(Euler)法を使って x'[t]==1/(t+x[t]^2)を数値的に解く:
sol = esteps[Function[{t, x}, 1 / (t + x ^ 2)], 1, .01, 100];ListPlot[sol, DataRange -> {0, 1}]list = RandomInteger[9, 20]list.ConstantArray[1, Length[list]]これはTotalを使っても求められる:
Total[list]ones = ConstantArray[1, 10]m = HilbertMatrix[10];
b = m.ones;x = LinearSolve[N[m], b]
Norm[x - ones]x30 = LinearSolve[N[m, 30], b];
Norm[Block[{$MaxPrecision = 30, $MinPrecision = 30}, x30 - ones]]特性と関係 (3)
ConstantArray[c,dims]はDimensions[dims]を持つ:
dims = RandomInteger[{1, 4}, 5]Dimensions[ConstantArray[c, dims]]ConstantArray[c,dims]はSparseArray[{},dims,c]に等しい:
dims = RandomInteger[{1, 4}, 5];s = SparseArray[{}, dims, c]ConstantArray[c, dims] == sNormal[s]はConstantArray[c,dims]に等しい:
ConstantArray[c, dims] === Normal[s]ConstantArray[c,dims]はApply[Table[c,##]&,Map[List,dims]]と等しい:
dims = RandomInteger[{1, 4}, 5];ConstantArray[c, dims] === Apply[Table[c, ##]&, Map[List, dims]]関連するガイド
-
▪
- 行列の構成 ▪
- リストの構築 ▪
- ベクトル操作 ▪
- 構造化行列とたたみ込みカーネル ▪
- 信号の作成とインポート
テキスト
Wolfram Research (2007), ConstantArray, Wolfram言語関数, https://reference.wolfram.com/language/ref/ConstantArray.html (2008年に更新).
CMS
Wolfram Language. 2007. "ConstantArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/ConstantArray.html.
APA
Wolfram Language. (2007). ConstantArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConstantArray.html
BibTeX
@misc{reference.wolfram_2026_constantarray, author="Wolfram Research", title="{ConstantArray}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/ConstantArray.html}", note=[Accessed: 10-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_constantarray, organization={Wolfram Research}, title={ConstantArray}, year={2008}, url={https://reference.wolfram.com/language/ref/ConstantArray.html}, note=[Accessed: 10-September-2026]}