Linear Algebra Reference Sheet Page 2

ADVERTISEMENT

Eigenvalues and Eigenvectors
Solutions to Systems
Dense versus Sparse
Note: Contrast behavior for exact rings (QQ) vs. RDF, CDF
_left too
Note:
Algorithms may depend on representation
A.solve_right(B)
no variable specified defaults to x
is solution to A*X = B, where X is a vector or matrix
Vectors and matrices have two representations
A.charpoly(’t’)
Dense: lists, and lists of lists
A.characteristic_polynomial() == A.charpoly()
A = matrix(QQ, [[1,2],[3,4]])
factored characteristic polynomial
[3,4]), then
is solution
Sparse: Python dictionaries
A.fcp(’t’)
b = vector(QQ,
A\b
(-2, 5/2)
the minimum polynomial
to check
A.minpoly()
.is_dense(),
.is_sparse()
returns sparse version of A
A.minimal_polynomial() == A.minpoly()
A.sparse_matrix()
Vector Spaces
unsorted list, with mutiplicities
returns dense row vectors of A
A.eigenvalues()
A.dense_rows()
dimension 4, rationals as field
VectorSpace(QQ, 4)
vectors on left, _right too
Some commands have boolean sparse keyword
A.eigenvectors_left()
“field” is 53-bit precision reals
VectorSpace(RR, 4)
Returns, per eigenvalue, a triple: e: eigenvalue;
VectorSpace(RealField(200), 4)
V: list of eigenspace basis vectors; n: multiplicity
Rings
“field” has 200 bit precision
vectors on right, _left too
A.eigenmatrix_right()
4-dimensional, 53-bit precision complexes
Note:
Many algorithms depend on the base ring
CC^4
Returns pair: D: diagonal matrix with eigenvalues
finite
for vectors, matrices,. . .
Y = VectorSpace(GF(7), 4)
<object>.base_ring(R)
P: eigenvectors as columns (rows for left version)
4
has 7
= 2401 vectors
to determine the ring in use
Y.list()
with zero columns if matrix not diagonalizable
for vectors, matrices,. . .
<object>.change_ring(R)
Eigenspaces: see “Constructing Subspaces”
to change to the ring (or field), R
Vector Space Properties
R.is_ring(), R.is_field(),
R.is_exact()
V.dimension()
Decompositions
Some common Sage rings and fields
V.basis()
Note: availability depends on base ring of matrix,
integers, ring
ZZ
V.echelonized_basis()
try RDF or CDF for numerical work, QQ for exact
rationals, field
QQ
with non-canonical basis?
V.has_user_basis()
“unitary” is “orthogonal” in real case
algebraic number fields, exact
AA, QQbar
True if W is a subspace of V
V.is_subspace(W)
A.jordan_form(transformation=True)
real double field, inexact
RDF
rank equals degree (as module)?
V.is_full()
returns a pair of matrices with: A == P^(-1)*J*P
complex double field, inexact
CDF
Y =
GF(7)^4,
T = Y.subspaces(2)
J: matrix of Jordan blocks for eigenvalues
53-bit reals, inexact, not same as
RR
RDF
T is a generator object for 2-D subspaces of Y
P: nonsingular matrix
400-bit reals, inexact
RealField(400)
[U for U in T] is list of 2850 2-D subspaces of Y,
triple with: D == U*A*V
A.smith_form()
complexes, too
CC, ComplexField(400)
or use T.next() to step through subspaces
D: elementary divisors on diagonal
real interval field
RIF
U, V: with unit determinant
mod 2, field, specialized implementations
GF(2)
Constructing Subspaces
triple with: P*A == L*U
A.LU()
p prime, field
GF(p) == FiniteField(p)
P: a permutation matrix
span of list of vectors over ring
span([v1,v2,v3], QQ)
integers mod 6, ring only
Integers(6)
L: lower triangular matrix, U: upper triangular matrix
th
rationals with 7
root of unity
CyclotomicField(7)
For a matrix A, objects returned are
pair with: A == Q*R
A.QR()
rationals with x=
5
QuadraticField(-5, ’x’)
vector spaces when base ring is a field
Q: a unitary matrix, R: upper triangular matrix
ring of symbolic expressions
SR
modules when base ring is just a ring
triple with: A == U*S*(V-conj-transpose)
A.SVD()
right_ too
A.left_kernel() == A.kernel()
U: a unitary matrix
Vector Spaces versus Modules
A.row_space() == A.row_module()
S: zero off the diagonal, dimensions same as A
A.column_space() == A.column_module()
Module “is” a vector space over a ring, rather than a field
V: a unitary matrix
vectors on right, _left too
A.eigenspaces_right()
Many commands above apply to modules
pair with: A == Q*T*(Q-conj-transpose)
A.schur()
Pairs: eigenvalues with their right eigenspaces
Some “vectors” are really module elements
Q: a unitary matrix
A.eigenspaces_right(format=’galois’)
T: upper-triangular matrix, maybe 2 2 diagonal blocks
One eigenspace per irreducible factor of char poly
A.rational_form(), aka Frobenius form
More Help
If V and W are subspaces
A.symplectic_form()
“tab-completion” on partial commands
quotient of V by subspace W
A.hessenberg_form()
V.quotient(W)
“tab-completion” on <object.> for all relevant methods
(needs work)
intersection of V and W
A.cholesky()
V.intersection(W)
<command>? for summary and examples
direct sum of V and W
V.direct_sum(W)
<command>?? for complete source code
specify basis vectors in a list
V.subspace([v1,v2,v3])

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2