[Math] Fast Symbolic Linear Algebra CAS

linear algebrasymbolic computation

I am a regular user of Mathematica, Julia, and MATLAB but I am looking for something different. The problem I am trying to solve in Mathematica only requires (dense) linear algebra to specify but is of a size such that Mathematica takes too long (and seems to automatically halt the computation after like 18 hours, when it should finish in a week or so). I am looking for a symbolic solution and not a numeric solution (to then use a machine learning approach on the resulting equations). I was wondering if anyone knew if there are more efficient and parallel symbolic packages. Checking around it looks like Singularity or Machaly2 may be what's right for this problem?

Edit: As requested here is more detail. It's as straight-forward as it sounds. I need to solve for the symbolic solution of a system of 4×4 matrices and 1×4 vectors. I am able to succinctly write down the exact solution (attached as a photo, hard to format it right in the editor…),

Exact Solution

but as you can see it's a little unwieldy (then it gets squared and simplified). I want to use the resulting polynomial (in terms of the matrix coefficients) in numerical computations, but I don't want to have to solve this system of equations each time the matrices change since this would increase the computational cost immensely.

So at a higher level it's really simple, and coding Mathematica to get it to try this computation is simple, but it is taking a lot of computing time (largely because Mathematica's engine is single threaded). In the simple case when the $A$ and $B$ matrices are lower triangular, I Mathematica was able to solve it after about 10 minutes. But getting rid of this assumption on even one matrix increases the complexity by a lot.

Let me lastly note that I have computing power at my disposal. I do high-performance computing, and so I have a few nodes available for a few hundred CPU cores and about a terabyte of RAM to let it churn for a month (I was hoping to change each matrix from lower triangular to full one by one to see how far I can get). However, I don't know what program/language will do this kind of "HPC Symbolic Computing". I was hoping there was some computational algebra package that has the tools to do this.

Best Answer

I found out that the best solution is actually SymEngine.jl in Julia. Using Julia as the driver ends up increasing the speed and reducing the memory requirement, making it more efficient than using SymEngine in Python (or using SymPy). This ended up being much more efficient than Mathematica, and the few things I experimented with in Sage. Also, Julia's operator overloading lets you write a "generic" matrix function and then it will automatically compile a function which gets very good performance on symbolic expressions, and this makes it easy to extend the symbolic libraries as necessary without losing performance. This ended up being a very good solution to brute force some symbolic math to setup further analysis.