I'm familiar with sympy, the matlab symbolic package, reduce, and have tried out a few other computer algebra systems. However, as far as I can tell, none of them seem to be able to do algebra on variable sized matrices - they can only work with fixed sized matrices.

Are there any that can do algebra for variable sized matrices? I understand there would be quite a few gross cases but I feel like there is a significant amount that is doable simply because of the ease of many simplifications/algebra one can do by hand in with matrices in R^nxn.

It is possible to just work with non-communiative algebraic elements in many of these, and so that covers addition and Hadamard product with matrices, which is useful and a start. However it covers a very small portion of what one actually does with matrices (say, transpose, inverses, eigenvalue decomposition, using matrices in R^nxm, etc.). Does any more general software exist?

(this question is reposted from here because mathoverflow seemed like a more appropriate place to ask this question)

  • 3
    $\begingroup$ stackoverflow.com/questions/5708208/… $\endgroup$ – Carlo Beenakker Nov 21 '15 at 18:05
  • $\begingroup$ You might consider adding a top-level tag in order to make more people see this question. $\endgroup$ – Stefan Kohl Nov 21 '15 at 18:17
  • $\begingroup$ What do you want to do with the software? It seems to me any software that can deal with fixed dimension matrices can more or less tautologically deal with arbitrary-sized matrices. In C++ or Python you could easily code-up such routines. But what would you want to do with them? $\endgroup$ – Ryan Budney Nov 21 '15 at 19:44
  • $\begingroup$ Ideally I would like a way to have an input optimization problem (in terms of the minimization function and contraints described by matrices), and be able to transform it to a problem that is already known how to solve, or at least simplify it, and automatically generate the dual problem and perhaps compute the duality gap. Optimization problems typically are n-dimensional and it's usually nice to have a general form that is independent of dimension for a given problem. $\endgroup$ – Phylliida Nov 21 '15 at 19:49
  • $\begingroup$ I understand that some of those steps are non-trivial, so I'm really just wondering what software exists so I don't have to reinvent the wheel as much as possible and instead focus on the more interesting problems here such as reductions. $\endgroup$ – Phylliida Nov 21 '15 at 19:52

SymPy has a matrix expressions module that does this. Example:

>>> from sympy import MatrixSymbol, Matrix, symbols
>>> n, m = symbols('n m', integer=True)
>>> X = MatrixSymbol('X', n, m)
>>> Y = MatrixSymbol('Y', m, n)
>>> (X*Y).T

Matrix expressions can have symbolic sizes (like n and m) or explicit integer sizes, in which case they can be combined with explicit matrices.

It's also worth noting that there are a lot of things that aren't documented in the doc page I linked to, so take a look at https://github.com/sympy/sympy/tree/master/sympy/matrices/expressions for the full functionality.

You can also look at this talk which uses this module, along with some modules that are separate from SymPy.

| cite | improve this answer | |

I am not sure what precisely you are looking for, but the GAP package MatricesForHomalg provides elaborate functionality for dealing with matrices in the context of homological algebra. This package is part of the homalg project which is a larger open source software project for constructive homological algebra.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.