Sage and Linear Algebra Worksheet: FCLA Section B
Section 1 Bases
Five “random” vectors, each with 4 entries, collected into a set S
.
Consider the subspace spanned by these five vectors. We will make these vectors the rows of a matrix and row-reduce to see a basis for the space (subspace, or row space, take your pick). This is an application of Theorem BRS.
Sage does this semi-automatically, tossing zero rows for us.
Demonstration 1.
Construct a random vector, w
, in this subspace by choosing scalars for a linear combination of the vectors we used to build W
as a span originally.
Then use the three basis vectors in B
to recreate the vector w
. Question: how many ways can you do this? By Theorem VRRB there should always be exactly one way to create w
using a linear combination of a basis of W
.
Section 2 Nonsingular Matrices
We will obtain a basis of \(\mathbb{C}^{10}\) from the columns of a \(10\times 10\) nonsingular matrix.
A totally random vector with 10 entries:
Demonstration 2.
By Theorem CNMB, the columns of the matrix are a basis of \(\mathbb{C}^{10}\text{.}\) So the vector v
should be a linear combination of the columns of the matrix. Verify this fact in three ways.
- First, the old-fashioned way, thus exposing Theorem NMUS.
- Then, the modern way, with an inverse, since a nonsingular matrix is invertible, thus exposing Theorem SNCM.
- Finally, the Sage way, as described below.
The Sage way: first create a space with a user basis.
Sage still carries an echelonized basis, in addition to the user-installed basis.
Now ask for a coordinatization, relative to the basis in X
, thus exposing Theorem VRRB.
Section 3 Orthonormal Bases
A particularly simple orthonormal basis of \(\mathbb{C}^3\text{,}\) collected into the set S
.
Demonstration 3.
If these vectors are an orthonormal basis, then as the columns of a matrix they should create an orthonormal basis.
Demonstration 4.
Build a random vector of size \(3\) and find our ways to express the vector as a (unique) linear combination of the basis vectors. Which method is most efficient?
A totally random vector with 3 entries.
First, the old-fashioned way, thus exposing Theorem NMUS.
Now, the modern way, with an inverse, since a nonsingular matrix is invertible, thus exposing Theorem SNCM.
The Sage way. Create a space with a “user basis” and ask for a coordinatization, thus exposing Theorem VRRB.
Finally, exploiting the orthonormal basis, and computing scalars for the linear combination with an inner product, thus exposing Theorem COB. (Sage's .inner_product()
does not conjugate the entries of either vector, so we use the more careful .hermitian_inner_product()
vector method instead.)
This work is Copyright 2016–2019 by Robert A. Beezer. It is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.