Array[f,n]
generates a list of length n, with elements f[i].
Array[f,n,r]
generates a list using the index origin r.
Array[f,n,{a,b}]
generates a list using n values from a to b.
Array[f,{n1,n2,…}]
generates an n1×n2×… array of nested lists, with elements f[i1,i2,…].
Array[f,{n1,n2,…},{r1,r2,…}]
generates a list using the index origins ri (default 1).
Array[f,{n1,n2,…},{{a1,b1},{a2,b2},…}]
generates a list using ni values from ai to bi.
Array
Array[f,n]
generates a list of length n, with elements f[i].
Array[f,n,r]
generates a list using the index origin r.
Array[f,n,{a,b}]
generates a list using n values from a to b.
Array[f,{n1,n2,…}]
generates an n1×n2×… array of nested lists, with elements f[i1,i2,…].
Array[f,{n1,n2,…},{r1,r2,…}]
generates a list using the index origins ri (default 1).
Array[f,{n1,n2,…},{{a1,b1},{a2,b2},…}]
generates a list using ni values from ai to bi.
Details
- Parallelize[Array[f,n]] computes Array[f,n] in parallel on all subkernels. »
Examples
open all close allBasic Examples (5)
Array[f, 10]Array[1 + # ^ 2&, 10]Array[f, {3, 2}]Array[10#1 + #2&, {3, 4}]Use index origin 0 instead of 1:
Array[f, 10, 0]Start with indices 0 and 4 instead of 1:
Array[f, {2, 3}, {0, 4}]Array[f, 10, {0, 1}]Use ranges {-1/2,1/2} and {0,1}:
Array[f, {2, 3}, {{-1 / 2, 1 / 2}, {0, 1}}]Scope (11)
Array Element Specification (5)
Create a 3×2 array using an indexed symbol:
Array[a, {3, 2}]Create a 4×4 array using a subscript:
Array[Subscript[a, ##]&, {4, 4}]Array[(1/# + #2 - 1)&, {3, 3}]Array[Function[{i, j}, (1/i + j - 1)], {3, 3}]Compare with the built-in function:
% == %% == HilbertMatrix[3]Array[x&, {5, 5}]Use ## to pick up a sequence of indices:
Array[FromDigits[{##}]&, {2, 3, 4}]Index Specification (4)
Head Specification (2)
Use a non-default head for each level of the array:
Array[f, {3, 3}, 1, g]Use Plus instead of List to combine elements:
Array[a, {2, 3}, 1, Plus]Any symbol with attribute Flat would produce the same shape:
SetAttributes[f, Flat];
Array[a, {2, 3}, 1, f]Applications (4)
Array[Signature[{##}]&, {3, 3, 3}]Compare with the built-in LeviCivitaTensor:
% == LeviCivitaTensor[3]Boole[Array[Greater, {5, 5}]]//MatrixFormMatrix with generic symbolic entries:
m = Array[Subscript[a, ##]&, {3, 4}]MatrixForm[m]Use it to see the effects of some linear algebra functions:
RowReduce[m]//MatrixFormDet[Take[m, All, 3]]Sample a function uniformly on an interval:
ListPlot[Array[Sin[2 #] - Cos[3 #]&, 50, {0, 2π}], Filling -> Axis, DataRange -> {0, 2π}]Properties & Relations (4)
ConstantArray[c,dims] and Array[c&,dims] are equivalent:
dims = RandomInteger[{1, 4}, {5}];ConstantArray[c, dims] === Array[c&, dims]When c is a machine number, ConstantArray is much faster for large arrays:
{First[Timing[ca = ConstantArray[0., {2000, 2000}]]],
First[Timing[a = Array[0.&, {2000, 2000}]]],
ca === a}Array[f,dims] can be generated using Table:
dims = RandomInteger[{1, 5}, {RandomInteger[{2, 5}]}];
f[args___] := Total[{args}]a = Array[f, dims];Set up the Table limit specifications:
v = Array[x, Length[dims]];
tl = Transpose[{v, dims}]Use Apply to splice them into a Table command:
t = Table[f@@v, ##]&@@ tl;The result is identical to the array generated using Array:
a === tSparseArray[{i_,j_}->f[i,j],dims] gives a sparse representation of Array[f,dims]:
dims = RandomInteger[{1, 10}, {2}];
f[i_, j_] := i - 2 js = SparseArray[{i_, j_} -> f[i, j], dims]a = Array[f, dims]The results are Equal:
s == aThe objects are not identical, but the represented arrays are:
{SameQ[s, a], SameQ[Normal[s], a]}Compute Array in parallel:
Parallelize[Array[Prime, 20]]See Also
Table ConstantArray SparseArray Grid ArrayPlot Tuples ArrayFlatten
Tech Notes
Related Guides
Related Workflows
- Create a Matrix ▪
- Make a Grid of Output Data
History
Introduced in 1988 (1.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2012 (9.0)
Text
Wolfram Research (1988), Array, Wolfram Language function, https://reference.wolfram.com/language/ref/Array.html (updated 2012).
CMS
Wolfram Language. 1988. "Array." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/Array.html.
APA
Wolfram Language. (1988). Array. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Array.html
BibTeX
@misc{reference.wolfram_2026_array, author="Wolfram Research", title="{Array}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/Array.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_array, organization={Wolfram Research}, title={Array}, year={2012}, url={https://reference.wolfram.com/language/ref/Array.html}, note=[Accessed: 12-June-2026]}