Monthly Archives: February 2020

Random matrices for practice

The topic in class this week is abstract vector spaces. Sage does understand abstract vector spaces (and many other abstract algebraic structures) to some extent, but not in a way that is useful at the level of this class. So, here’s a brief discussion of creating matrices for computational practice. First, for row reduction practice, […]

Posted in Uncategorized | Comments closed

Determinants

Determinants in Sage work exactly how you would expect: M = matrix([[1,2,3],[4,5,6],[3,2,1]]) M.determinant() (If you’re surprised you got 0, check the RREF: M is, indeed, singular.) There are two shortcuts for the determinant, giving exactly the same thing: M.det() det(M) Go wild.

Posted in Uncategorized | Comments closed

Subspaces and Dimension

Amazingly, Sage knows what a linear subspace is, and can do basic computations with them. (Why is this amazing? This is a fairly abstract concept to implement on a computer. You can reduce most computations involving subspaces to computations about matrices. Usually, I would expect a human would do that reduction, and then ask a […]

Posted in Uncategorized | Comments closed

Matrix algebra 2

Inverting matrices   The first topic we discussed this week is inverting matrices. This works exactly as you would expect: M = matrix([[1,2,3],[1,1,1],[3,1,4]]) M.inverse() As a sanity check: M * M.inverse() (Note that the .inverse() comes first in the order of operations, as it should. If we didn’t know Python would do this way, we […]

Posted in Uncategorized | Comments closed
Skip to toolbar