I have spent a lot of this summer writing STACK questions. STACK uses Maxima as its back end, so I ended up writing a lot of Maxima code. Some of this is now publicly available on github, as the maxima-linalg repo.

Maxima’s age and structure (it’s Lisp-based) make it rather quirky and difficult to get used to. For that reason I hope this repo will be useful to other STACK users. No effort has been made to make the code efficient - it’s designed for use on the kind of small problem that could be calculated by hand.

Contents of maxima-linalg

Most of the details are in the README file, but here’s an overview.

Matrices

Functions for random invertible matrices from \(\mathsf{SL}_n(\mathbb{Z})\) so that you can write “nice” find-the-inverse questions and so on. Random “nice” matrices with given rank. Functions for showing how to calculate a certain entry of a product in LaTeX, and for describing why a matrix isn’t in RREF in html/LaTeX.

Vector spaces

Functions for working with subspaces of \(\mathbb{Q}^n\) including kernels, images, sums, intersections, subspace membership testing.

Permutations

Conversion between two row and cycle representations, composition, inversion, sign, display using LaTeX, expresion as products of transpositions. Most of these are available in the Maxima combinatorics package but this isn’t enabled in STACK by default. I think the latest STACK version has some of these functions, so check before you use them.

Functions

Random functions \(\{1,2,\ldots, m\} \to \{1, 2, \ldots, n\}\) with specified injectivity/surjectivity.

Logic

There is a function for logical equivalence of propositional WFFs. You don’t need these if you have the lasest version of STACK, but we don’t. It gives a list of counterexamples when two formulas are not equivalent, so that these can be used for feedback.

Testing

I wrote is a simple unit testing function which you can use to produce tests for maxima functions.