Functions > Vector and Matrix > Creating and Subdividing Arrays > Functions for Creating Arrays
  
Functions for Creating Arrays
matrix(m, n, f)—Returns an m x n matrix in which the (i, j)th element contains f(i, j).
diag(v/M)—Returns a matrix containing on its diagonal the elements of v, or returns a vector containing the diagonal of the matrix M.
identity(n)—Returns an n x n identity matrix (a matrix of 0's with 1's along the diagonal).
Arguments
m, n are the positive integer number of rows and columns in the matrix.
f is a function of two variables that returns a scalar, array, or string.
v is a vector.
M is a square matrix.