Skip to content

Array

Array[f, n] creates a list of f[i], with i = 1 to n.

Attributes[Array] := {Protected}

Simple examples

In[1]:= Array[f, 3]
Out[1]= {f[1], f[2], f[3]}
In[2]:= mytest[x_] := 5
Out[2]= Null
In[3]:= Array[mytest, 3]
Out[3]= {5, 5, 5}
In[4]:= Array[a + b, 3]
Out[4]= {a + b[1], a + b[2], a + b[3]}
In[5]:= Array[a, a]
Out[5]= Array[a, a]