Skip to content

Setting linear algebra questions in STACK

Linear algebra, next to calculus, is one of the pillars of modern mathematics and an important application in STACK is supporting questions which test understanding of linear algebra.

Core functionality.

  1. General matrix manipulations in Maxima.
  2. Core vector/matrix functions defined by STACK in the core code.
  3. Using vectors.
  4. Assessment of matrices with answer tests.

Reference documentation for contributed libraries.

  1. Creating random matrices in contributed rand_matrix.mac.
  2. Matrix functions in contributed matrix.mac.
  3. Vector and vector space functions in contributed vectorspaces.mac.
  4. Vector geometry functions in contributed vectorgeometry.mac.
  5. Eigenvalue/vector functions in contributed eigenlib.mac.
  6. Matrix factorisations in contributed matrixfactorizations.mac

If using an earlier version of STACK than 4.9.0, 2. through 6. above require an extra inclusion (see here).

Solving systems of linear equations

Using solve can throw errors, so use linsolve instead. For example.

/* Decide if a vector is in W */
point_in_space(W, wx):= linsolve(flatten(args(W))-first(args(transpose(wx))), listofvars(W));

If the above is the empty list, there is no solution. Otherwise a solution is returned.

/* Calculate the canonical form of a column space of a system. */
cspace(ex):= block([M],
  M: coefmatrix(flatten(args(ex)), listofvars(ex)),
  ev(transpose(rref(transpose(M))), simp)
);