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.

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 0 instead of 1:

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

Start with indices 0 and 4 instead of 1:

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

Sample between 0 and 1:

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

Use ranges {-1/2,1/2} and {0,1}:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 1988
(1.0)
| Updated in 2012
(9.0)
Translate this page: