MATLAB: How to invert a symbolic matrix bigger than 6-by-6

=a/bcomplexmatrixsymbolicSymbolic Math Toolboxx

How can I invert a symbolic matrix? How can I solve x = A\b where A is a symbolic matrix? Is it always possible?
For instance if I try to invert a matrix created as follows:
>> A = sym('a',6) MATLAB will find a solution.
However if A is defined as follows: >> A = sym('a',7)
MATLAB will not converge to a solution and keeps computing.

Best Answer

When it comes to solving symbolic matrices there are several methods that can be used such as:
  • Inverting matrix 'inv( )'
  • 'linsolve( )'
  • 'A\b'--> best solution for non-symbolic systems
There is a limitation in maths were you can not calculate matrices bigger than 6x6.
In fact, the symbolic linear solver can sometimes encounter a phenomenon known as "expression swell" where the size of numbers and expressions involved in the calculation grow dramatically as the calculation progresses.
You can find an example of this issue in the attached plot which shows the computational time needed to invert several symbolic square matrices of increasing order.
Please note that this issue is a symbolic maths limitation, which affects all the mathematical programs, it is not only a MATLAB issue.