This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.

 3.7.1 Constructing Matrices Functions for constructing matrices. This generates a matrix whose entry is a[i, j]. In[1]:= Table[a[i, j], {i, 2}, {j, 2}] Out[1]= Here is another way to produce the same matrix. In[2]:= Array[a, {2, 2}] Out[2]= DiagonalMatrix makes a matrix with zeros everywhere except on the leading diagonal. In[3]:= DiagonalMatrix[{a, b, c}] Out[3]= IdentityMatrix[n] produces an identity matrix. In[4]:= IdentityMatrix[3] Out[4]= This makes a matrix with two non-zero values filled in. In[5]:= Normal[SparseArray[{{2, 3}->a, {3, 2}->b}, {3, 4}]] Out[5]= MatrixForm prints the matrix in a two-dimensional form. In[6]:= MatrixForm[%] Out[6]//MatrixForm= Constructing special types of matrices with Table. Table evaluates Random[ ] separately for each element, to give a different pseudorandom number in each case. In[7]:= Table[Random[ ], {2}, {2}] Out[7]= Constructing special types of matrices with SparseArray. This sets up a general lower-triangular matrix. In[8]:= SparseArray[{i_, j_}/;i>=j -> f[i, j], {3, 3}] // MatrixForm Out[8]//MatrixForm=