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]=
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[5]:= Tr[{{a, b}, {c, d}}]
Out[5]=
Powers and exponentials of matrices.
Here is a matrix.
In[6]:= m = {{0.4, 0.6}, {0.525, 0.475}}
Out[6]=
This gives the third matrix power of m.
In[7]:= MatrixPower[m, 3]
Out[7]=
It is equivalent to multiplying three copies of the matrix.
In[8]:= m . m . m
Out[8]=
Here is the millionth matrix power.
In[9]:= MatrixPower[m, 10^6]
Out[9]=
This gives the matrix exponential of m.
In[10]:= MatrixExp[m]
Out[10]=
Here is an approximation to the exponential of m, based on a power series approximation.
In[11]:= Sum[MatrixPower[m, i]/i!, {i, 0, 5}]
Out[11]=
