<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Problems finding the inverse of an algebraic 12x12 matrix</title>
    <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 15:08:47 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 15:08:47 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Problems finding the inverse of an algebraic 12x12 matrix</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Problems finding the inverse of an algebraic 12x12 matrix</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic</link>
    </image>
    <item>
      <title>Simplification with the size option is helpful</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic?ref=Feed:MaplePrimes:Problems finding the inverse of an algebraic 12x12 matrix:Comments#answer123636</link>
      <itunes:summary>&lt;p&gt;Calculating the determinant of C, I obtained&lt;br&gt;&amp;gt; Determinant(C);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Length of output exceeds limit of 1000000]&lt;br&gt;However, the simplify command helps: the output of&lt;br&gt;&amp;gt;simplify(Determinant(C), size);&lt;br&gt;&lt;br&gt;is reviewed (see &lt;a href="/view.aspx?sf=123636/416816/Matrix.mw"&gt;Matrix.mw&lt;/a&gt;)&lt;br&gt;Now try to execute&lt;br&gt;&amp;gt;for i to 12 do&lt;br&gt;&amp;nbsp;for j to 12 do A[i, j] := (-1)^(i+j)*simplify(Minor(C, i, j, output = 'determinant'), size) &lt;br&gt;end do&lt;br&gt;&amp;nbsp;end do&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Calculating the determinant of C, I obtained&lt;br&gt;&amp;gt; Determinant(C);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Length of output exceeds limit of 1000000]&lt;br&gt;However, the simplify command helps: the output of&lt;br&gt;&amp;gt;simplify(Determinant(C), size);&lt;br&gt;&lt;br&gt;is reviewed (see &lt;a href="/view.aspx?sf=123636/416816/Matrix.mw"&gt;Matrix.mw&lt;/a&gt;)&lt;br&gt;Now try to execute&lt;br&gt;&amp;gt;for i to 12 do&lt;br&gt;&amp;nbsp;for j to 12 do A[i, j] := (-1)^(i+j)*simplify(Minor(C, i, j, output = 'determinant'), size) &lt;br&gt;end do&lt;br&gt;&amp;nbsp;end do&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>123636</guid>
      <pubDate>Thu, 07 Jul 2011 12:56:09 Z</pubDate>
      <itunes:author>Markiyan Hirnyk</itunes:author>
      <author>Markiyan Hirnyk</author>
    </item>
    <item>
      <title>Normalizer and Testzero</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic?ref=Feed:MaplePrimes:Problems finding the inverse of an algebraic 12x12 matrix:Comments#answer123640</link>
      <itunes:summary>&lt;p&gt;One way that you can sometimes attack these problems is by reducing the amount of normalization that Maple does. For matrix inversion, for example, every potential pivot has to be checked for being equal to 0, which is by default done by converting to a factored normal form. The method of normalization used in &lt;em&gt;LinearAlgebra&lt;/em&gt; is configurable, however, as is the method of zero testing, and that can sometimes lead to a solution in a case like this. However, the result, since it is not normalized as much as you would like, is generally not very useful.&lt;/p&gt;
&lt;p&gt;In this case, we define C as above and then do:&lt;/p&gt;
&lt;pre&gt;Normalizer := x -&amp;gt; x; # No normalization at all.&lt;br&gt;Testzero := testeq; # Fast heuristic zero testing - still extremely reliable.&lt;br&gt;inv := LinearAlgebra:-MatrixInverse(C):&lt;/pre&gt;
&lt;p&gt;The computation is now actually pretty fast. But note that I put a colon after that last statement, not a semicolon. That's very much intentional, since Maple can't possibly &lt;em&gt;print&lt;/em&gt; any of the&lt;em&gt;&lt;/em&gt; entries of the matrix - they are much too big!&amp;nbsp; For example,&lt;/p&gt;
&lt;pre&gt;length(inv[1, 1]);&lt;/pre&gt;
&lt;p&gt;returns 1611432722. That is, writing out the [1, 1] entry would require around 10^10 words of memory! The reason Maple can deal with such expressions at all is that it uses a &lt;a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph"&gt;DAG&lt;/a&gt; structure for representing expressions, in which repeating subexpressions use memory only once.&lt;/p&gt;
&lt;p&gt;So can you use &lt;em&gt;inv&lt;/em&gt; at all? Yes, you can. You can, for example, evaluate &lt;em&gt;inv&lt;/em&gt; at a point in (&lt;em&gt;x1&lt;/em&gt;, ..., &lt;em&gt;y4&lt;/em&gt;)-space by substituting numbers in. However, it's not certain that this is actually faster than substituting the values into &lt;em&gt;C&lt;/em&gt; and then inverting the matrix numerically. I only did a preliminary test, as follows:&lt;/p&gt;
&lt;pre&gt;variables := convert(indets(C), list):&lt;br&gt;mypoint := map(v -&amp;gt; v = RandomTools:-Generate(float(range=0..1, method=uniform)), variables);&lt;br&gt;CodeTools:-Usage(eval(inv, mypoint), iterations=1000):&lt;br&gt;# memory used=0.54MiB, alloc change=0 bytes, cpu time=3.88ms, real time=3.89ms&lt;br&gt;CodeTools:-Usage(eval(C, mypoint)^(-1), iterations=1000):&lt;br&gt;# memory used=63.66KiB, alloc change=0 bytes, cpu time=890.00us, real time=892.00us&lt;/pre&gt;
&lt;p&gt;This test is unfair, since the matrix inversion happens in a BLAS (in optimized external code) whereas evaluating &lt;em&gt;inv&lt;/em&gt; happens in interpreted Maple code. So maybe the evaluation of &lt;em&gt;inv&lt;/em&gt; could be improved by setting things up so that you can use &lt;em&gt;evalhf&lt;/em&gt; or even &lt;em&gt;Compiler:-Compile&lt;/em&gt;, but that would take some work.&lt;/p&gt;
&lt;p&gt;All in all, I think in this case you're better off substituting the values first.&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Erik Postma&lt;br&gt;Maplesoft.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;One way that you can sometimes attack these problems is by reducing the amount of normalization that Maple does. For matrix inversion, for example, every potential pivot has to be checked for being equal to 0, which is by default done by converting to a factored normal form. The method of normalization used in &lt;em&gt;LinearAlgebra&lt;/em&gt; is configurable, however, as is the method of zero testing, and that can sometimes lead to a solution in a case like this. However, the result, since it is not normalized as much as you would like, is generally not very useful.&lt;/p&gt;
&lt;p&gt;In this case, we define C as above and then do:&lt;/p&gt;
&lt;pre&gt;Normalizer := x -&amp;gt; x; # No normalization at all.&lt;br&gt;Testzero := testeq; # Fast heuristic zero testing - still extremely reliable.&lt;br&gt;inv := LinearAlgebra:-MatrixInverse(C):&lt;/pre&gt;
&lt;p&gt;The computation is now actually pretty fast. But note that I put a colon after that last statement, not a semicolon. That's very much intentional, since Maple can't possibly &lt;em&gt;print&lt;/em&gt; any of the&lt;em&gt;&lt;/em&gt; entries of the matrix - they are much too big!&amp;nbsp; For example,&lt;/p&gt;
&lt;pre&gt;length(inv[1, 1]);&lt;/pre&gt;
&lt;p&gt;returns 1611432722. That is, writing out the [1, 1] entry would require around 10^10 words of memory! The reason Maple can deal with such expressions at all is that it uses a &lt;a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph"&gt;DAG&lt;/a&gt; structure for representing expressions, in which repeating subexpressions use memory only once.&lt;/p&gt;
&lt;p&gt;So can you use &lt;em&gt;inv&lt;/em&gt; at all? Yes, you can. You can, for example, evaluate &lt;em&gt;inv&lt;/em&gt; at a point in (&lt;em&gt;x1&lt;/em&gt;, ..., &lt;em&gt;y4&lt;/em&gt;)-space by substituting numbers in. However, it's not certain that this is actually faster than substituting the values into &lt;em&gt;C&lt;/em&gt; and then inverting the matrix numerically. I only did a preliminary test, as follows:&lt;/p&gt;
&lt;pre&gt;variables := convert(indets(C), list):&lt;br&gt;mypoint := map(v -&amp;gt; v = RandomTools:-Generate(float(range=0..1, method=uniform)), variables);&lt;br&gt;CodeTools:-Usage(eval(inv, mypoint), iterations=1000):&lt;br&gt;# memory used=0.54MiB, alloc change=0 bytes, cpu time=3.88ms, real time=3.89ms&lt;br&gt;CodeTools:-Usage(eval(C, mypoint)^(-1), iterations=1000):&lt;br&gt;# memory used=63.66KiB, alloc change=0 bytes, cpu time=890.00us, real time=892.00us&lt;/pre&gt;
&lt;p&gt;This test is unfair, since the matrix inversion happens in a BLAS (in optimized external code) whereas evaluating &lt;em&gt;inv&lt;/em&gt; happens in interpreted Maple code. So maybe the evaluation of &lt;em&gt;inv&lt;/em&gt; could be improved by setting things up so that you can use &lt;em&gt;evalhf&lt;/em&gt; or even &lt;em&gt;Compiler:-Compile&lt;/em&gt;, but that would take some work.&lt;/p&gt;
&lt;p&gt;All in all, I think in this case you're better off substituting the values first.&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Erik Postma&lt;br&gt;Maplesoft.&lt;/p&gt;</description>
      <guid>123640</guid>
      <pubDate>Thu, 07 Jul 2011 18:39:20 Z</pubDate>
      <itunes:author>epostma</itunes:author>
      <author>epostma</author>
    </item>
    <item>
      <title>M[1,1] and timing</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic?ref=Feed:MaplePrimes:Problems finding the inverse of an algebraic 12x12 matrix:Comments#comment123642</link>
      <itunes:summary>&lt;p&gt;Take look at the calculation of M[1,1] and its timing &lt;strong&gt;Edit&lt;/strong&gt;.=46.516 in &lt;a href="/view.aspx?sf=123642/416827/Minor.mw"&gt;Minor.mw&lt;/a&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Take look at the calculation of M[1,1] and its timing &lt;strong&gt;Edit&lt;/strong&gt;.=46.516 in &lt;a href="/view.aspx?sf=123642/416827/Minor.mw"&gt;Minor.mw&lt;/a&gt;&lt;/p&gt;</description>
      <guid>123642</guid>
      <pubDate>Thu, 07 Jul 2011 19:15:18 Z</pubDate>
      <itunes:author>Markiyan Hirnyk</itunes:author>
      <author>Markiyan Hirnyk</author>
    </item>
    <item>
      <title>comments</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic?ref=Feed:MaplePrimes:Problems finding the inverse of an algebraic 12x12 matrix:Comments#comment123647</link>
      <itunes:summary>&lt;p&gt;A few more comments might be added, if I may. The next two paragraphs are other suggestions to support the idea that symbolic inversion is not a good idea here.&lt;/p&gt;
&lt;p&gt;The purely numerical floating-point computation (of the inverse, or of solving a linear system) whether done in Maple or Matlab will be careful about selection of pivots. That is, the floating-point implementation use the specific numeric values during pivot selection. Symbolically inverting the Matrix will remove this carefulness, regardless of whether the symbolic pivots are chosen according to symbolic length, or by no scheme. Only a scheme of symbolic pivot selection that could qualify the relative magnitude of the pivot choices under assumptions on the unknowns would have a hope of regaining this care. But it could be difficult and might require a case-split solution, and it would add to the symbolic processing overhead. And the symbolic LU (or inversion) doesn't allow for a custom pivot selection strategy in the symbolic case.&lt;/p&gt;
&lt;p&gt;Even if you keep some form of Testzero, it's still only checking whether the pivots are symbolically identical to zero or not. It doesn't provide for any safety that, given particular numeric values for the unknowns, some pivot might not attain a zero value. If that happens then the whole approach breaks with division by zero.&lt;/p&gt;
&lt;p&gt;Perhaps there is some other way to improve the performance of the Matlab code. Do you compute the inverse in order to solve linear equations like A.x=b? It wasn't clear from your post whether you might be solving at different instances for various different RHSs `b`, for the same numeric instance of Matrix `A`. If you will have to solve for different RHSs `b`, for the very same numeric values of the unknowns, then you could consider doing the numeric LU factorization of `A` just once for the given numeric values of the variables, and then using just forward- and backward-substitution for each distinct RHS instance. This isn't going to help, if you solve for just one single RHS instance for any particular set of values of the variables.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;A few more comments might be added, if I may. The next two paragraphs are other suggestions to support the idea that symbolic inversion is not a good idea here.&lt;/p&gt;
&lt;p&gt;The purely numerical floating-point computation (of the inverse, or of solving a linear system) whether done in Maple or Matlab will be careful about selection of pivots. That is, the floating-point implementation use the specific numeric values during pivot selection. Symbolically inverting the Matrix will remove this carefulness, regardless of whether the symbolic pivots are chosen according to symbolic length, or by no scheme. Only a scheme of symbolic pivot selection that could qualify the relative magnitude of the pivot choices under assumptions on the unknowns would have a hope of regaining this care. But it could be difficult and might require a case-split solution, and it would add to the symbolic processing overhead. And the symbolic LU (or inversion) doesn't allow for a custom pivot selection strategy in the symbolic case.&lt;/p&gt;
&lt;p&gt;Even if you keep some form of Testzero, it's still only checking whether the pivots are symbolically identical to zero or not. It doesn't provide for any safety that, given particular numeric values for the unknowns, some pivot might not attain a zero value. If that happens then the whole approach breaks with division by zero.&lt;/p&gt;
&lt;p&gt;Perhaps there is some other way to improve the performance of the Matlab code. Do you compute the inverse in order to solve linear equations like A.x=b? It wasn't clear from your post whether you might be solving at different instances for various different RHSs `b`, for the same numeric instance of Matrix `A`. If you will have to solve for different RHSs `b`, for the very same numeric values of the unknowns, then you could consider doing the numeric LU factorization of `A` just once for the given numeric values of the variables, and then using just forward- and backward-substitution for each distinct RHS instance. This isn't going to help, if you solve for just one single RHS instance for any particular set of values of the variables.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>123647</guid>
      <pubDate>Thu, 07 Jul 2011 21:03:06 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Auch!</title>
      <link>http://www.mapleprimes.com/questions/123635-Problems-Finding-The-Inverse-Of-An-Algebraic?ref=Feed:MaplePrimes:Problems finding the inverse of an algebraic 12x12 matrix:Comments#comment123663</link>
      <itunes:summary>&lt;p&gt;Hi Erik,&lt;/p&gt;
&lt;p&gt;Thank you very much for your help, that makes sense! It's breathtaking though, that the inversion of the matrix is getting HUGE like that!&lt;/p&gt;
&lt;p&gt;Your argument is very clear, and given this argument I think you're right, that I have to substitute the values first.&lt;/p&gt;
&lt;p&gt;You have been very helpful :)&lt;/p&gt;
&lt;p&gt;Have a nice weekend, and once again, thanks for your time!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Dennis&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Hi Erik,&lt;/p&gt;
&lt;p&gt;Thank you very much for your help, that makes sense! It's breathtaking though, that the inversion of the matrix is getting HUGE like that!&lt;/p&gt;
&lt;p&gt;Your argument is very clear, and given this argument I think you're right, that I have to substitute the values first.&lt;/p&gt;
&lt;p&gt;You have been very helpful :)&lt;/p&gt;
&lt;p&gt;Have a nice weekend, and once again, thanks for your time!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Dennis&lt;/p&gt;</description>
      <guid>123663</guid>
      <pubDate>Fri, 08 Jul 2011 11:16:34 Z</pubDate>
      <itunes:author>KajkagenDK</itunes:author>
      <author>KajkagenDK</author>
    </item>
  </channel>
</rss>