MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Trouble with inverting matrices

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
Inverse::"sing": "Matrix \!\({\(\({0, 0}\)\), \(\({0, 0}\)\)}\) is

[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

  • Prev by Date: Could it be....?
  • Next by Date: RE: Different Methods inside one package
  • Previous by thread: Could it be....?
  • Next by thread: Re: Trouble with inverting matrices