|
3.7.7 Basic Matrix Operations

Some basic matrix operations.
Transposing a matrix interchanges the rows and columns in the matrix. If you transpose an matrix, you get an matrix as the result.
Transposing a matrix gives a result.
In[1]:= Transpose[ {{a, b, c}, {ap, bp, cp}} ]
Out[1]= 
Det[m] gives the determinant of a square matrix m. Minors[m] is the matrix whose  element gives the determinant of the submatrix obtained by deleting the  row and the  column of m. The  cofactor of m is times the  element of the matrix of minors.
Minors[m, k] gives the determinants of the submatrices obtained by picking each possible set of rows and columns from m. Note that you can apply Minors to rectangular, as well as square, matrices.
Here is the determinant of a simple matrix.
In[2]:= Det[ {{a, b}, {c, d}} ]
Out[2]= 
This generates a matrix, whose  entry is a[i, j].
In[3]:= m = Array[a, {3, 3}]
Out[3]= 
Here is the determinant of m.
In[4]:= Det[ m ]
Out[4]= 
This gives a matrix of the minors of m.
In[5]:= Minors[m]
Out[5]= 
You can use Det to find the characteristic polynomial for a matrix. Section 3.7.9 discusses ways to find eigenvalues and eigenvectors directly.
Here is a matrix.
In[6]:= m = Table[ 1/(i + j), {i, 3}, {j, 3} ]
Out[6]= 
Following precisely the standard mathematical definition, this gives the characteristic polynomial for m.
In[7]:= Det[ m - x IdentityMatrix[3] ]
Out[7]= 
The trace or spur of a matrix Tr[m] is the sum of the terms on the leading diagonal.
This finds the trace of a simple matrix.
In[8]:= Tr[{{a, b}, {c, d}}]
Out[8]= 

Powers and exponentials of matrices.
Here is a matrix.
In[9]:= m = {{0.4, 0.6}, {0.525, 0.475}}
Out[9]= 
This gives the third matrix power of m.
In[10]:= MatrixPower[m, 3]
Out[10]= 
It is equivalent to multiplying three copies of the matrix.
In[11]:= m . m . m
Out[11]= 
Here is the millionth matrix power.
In[12]:= MatrixPower[m, 10^6]
Out[12]= 
This gives the matrix exponential of m.
In[13]:= MatrixExp[m]
Out[13]= 
Here is an approximation to the exponential of m, based on a power series approximation.
In[14]:= Sum[MatrixPower[m, i]/i!, {i, 0, 5}]
Out[14]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. |