Vectors and Matrices You can use lists to generate matrices and vectors. We can think of list as a vector or a row of a matrix. A list of lists is then a two dimension array of objects, like a m x n matrix. In order to represent a two component vector you type in, In[1]:= {x,y} Out[1]= {x, y} To represent a 2 x 2 matrix, In[2]:= {{1,2},{3,4}} //MatrixForm 1 2 Out[2]//MatrixForm= 3 4 The //MatrixForm displays the list in a matrix form. You can also perform vector and matrix operations. For example, a scalar or dot product of vectors or multiplication of two matrices. In[3]:= v = {x,y} Out[3]= {x, y} In[4]:= v . v 2 2 Out[4]= x + y In[5]:= A = {{1,2},{3,4}} Out[5]= {x, y} In[7]:= A . A Out[7]= {{7, 10}, {15, 22}} The following are some standard functions used for vectors in Mathematica. Table[f,{i,n}] builds a vector of length 'n' by evaluating 'f' with i=1, i=2,..., i=n. Array[a,n] builds a vector of length 'n' of the form {a[1],a[2],....} Range[n] create a list {1,2,3,...,n} list[[i]] gives the ith element in list Length[list] gives the length of the list //Columnform displays the list in column form Similar commands which are applicable to matrices are given below. Table[f,{i,m},{j,n}] builds a m x n matrix, evaluating 'f' with 'i' and 'j' ranging from 1 to m and 1 to n respectively. Array[a,{m,n}] builds an m x n matrix with elements a[i,j] with 'i' ranging from 1 to m and 'j' ranging from 1 to n. IdentityMatrix[n] generates a n x n identity matrix. DiagonalMatrix[list] creates a diagonal matrix with elements of the list along its diagonal. list[[i]] gives the ith row of the matrix. list[[i,j]] gives the i,jth element of the matrix. Dimensions[list] gives the dimension of a matrix represented by the list. MatrixForm[list] displays the list in a matrix form.