Trouble with inverting matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg33745] Trouble with inverting matrices
- From: Wyvern <wyvern5 at mac.com>
- Date: Wed, 10 Apr 2002 00:50:22 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, When I try to invert a matrix (as it happens, a matrix with the elements described in #7 of Nick Trefethen's 10 challenges but of a much smaller size) and store that inverse to a variable, I get this error: (for a 2x2 case) Inverse::"sing": "Matrix \!\({\(\({0, 0}\)\), \(\({0, 0}\)\)}\) is singular." [and then the output of the for loop in which the operation is embedded, and then another error:] Set::"write": "Tag Times in \!\(inv \\\\ Null \\\\ Null \\\\ Null \\\\ \ Null \\\\ Null \\\\ Null\) is Protected." inv is the variable to which I am trying to store the inverse. The bizarre part is that if I try to print the the inverses as they are generated (my For loop increases the size of the mxm matrix by one each time and sets the elements of the matrix and then calculates the inverse) then it works fine, as in Print[MatrixForm[Inverse[theMatrix]]]. If I set inv = Inverse[theMatrix] it gives the errors above. Also, the matrix given in the error for Inverse is NOT the matrix that has been passed to Inverse! In the 2x2 case, the matrix is {2,1}{1,3} which is invertible. So where is Inverse coming up with this {0,0}{0,0} matrix which it (correctly) claims is not invertible? Any help would be much appreciated. Marshall Pierce