Array

Array[f, n]
generates a list of length n, with elements .

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 ××... array of nested lists, with elements .

Array[f, {n1, n2, ...}, {r1, r2, ...}]
generates a list using the index origins (default ).

Array[f, {n1, n2, ...}, {{a1, b1}, {a2, b2}, ...}]
generates a list using values from to .

Array[f, dims, origin, h]
uses head h, rather than List, for each level of the array.

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Generate a 3×2 array:

In[1]:=
Click for copyable input
Out[1]=

Generate a 3×4 array:

In[2]:=
Click for copyable input
Out[2]=

Use index origin instead of :

In[1]:=
Click for copyable input
Out[1]=

Start with indices and instead of :

In[2]:=
Click for copyable input
Out[2]=

Sample between and :

In[1]:=
Click for copyable input
Out[1]=

Use ranges and :

In[2]:=
Click for copyable input
Out[2]=
New in 1 | Last modified in 4
New to Mathematica? Find your learning path »
Have a question? Ask support »