Sage and Linear Algebra Worksheet: FCLA Section SD
Section 1 Similarity
We manufacture two matrices that are similar, and use Sage to check. A “unimodular” matrix is one with determinant 1. A unimodular matrix with integer entries will have an inverse with integer entries (that is a theorem, and Exercise PDM.M20).
This next command might be broken, and might even just hang. My fault. It will be fixed, using rational canonical form, for Sage 7.6. See Trac ticket #18505 for the details.
Section 2 Diagonalization
These two matrices are from the earlier demo for Section EE. First is diagonalizable, second is not. The easiest way to see the difference is with the eigenmatrix
commands.
Demonstration 1.
Diagonalize the matrix \(A\text{.}\)
S
, the matrix whose columns are eigenvectors, will “diagonalize” A
.
Here is an equivalent formulation.
Demonstration 2.
Now, in contrast, a matrix that is not diagonalizable. Try to diagonalize the matrix \(C\text{.}\)
The zero columns in S
tell us that at least one eigenvalue has a geometric multiplicity strictly less than the algebraic multiplicity of the eigenvalue. So by Theorem DMFE the matrix C
is not diagonalizable.
A second consequence of the zero columns of S
is that it will not be an invertible matrix. But the output from Sage still obeys a fundamental relationship.
Perhaps simpler is the built-in function .is_diagonalizable()
.
Section 3 Nearly Diagonalizable
A matrix that is not diagonalizable will always be similar to a matrix that is almost diagonalizable. The “nearly diagonal” matrix is called the Jordan canonical form of the matrix.
Demonstration 3.
While beyond the scope of this course, use Sage to compute the Jordan canonical form for the matrix C
. Notice the eigenvalues of C
on the diagonal and the 1's on the super-diagonal.
Peculiarly, the similarity matrix need not be computed to get the form, and it is a significant computational expense. So we ask for it explicitly.
The transformation matrix, T
, is invertible and will “almost diagonalize” C
.
Demonstration 4.
Rational canonical form is another interesting version of this idea, try .rational_form()
on C
. And if you do, then execute the following two cells and see if the coefficients look familiar. Learn more about companion matrices if this makes you curious.
This work is Copyright 2016–2019 by Robert A. Beezer. It is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.