Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Inverse of symbolic matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88351] Re: Inverse of symbolic matrix
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 2 May 2008 06:03:07 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fvegrd$5d4$1@smc.vnet.net>

Hugh Goyder wrote:

> The expressions a and b below seem reasonable. However when I assemble
> them into a matrix and take the inverse I get the message
> Inverse::"sing" :Matrix...is singular. However the determinant seems
> fine. If I rationalize the matrix and then take its inverse then
> everything seems fine and I can almost get the unit matrix by
> multiplying back onto the original matrix. Is there a problem with
> approximate numbers in symbolic matrices? 

The issue is whenever you mix machine-size numbers with symbolic or 
exact arithmetic entries, the machine-size numbers poison the 
symbolic/exact matrix, which is not symbolic anymore. So 1.0 is not the 
same as 1 w.r.t. the accuracy of each entry and the numeric stability 
that result of different algorithms in use with each computational model.

> Is this a bug?

No.

> Is Rationalize the best method for working around this problem?

Rationalize as early as possible (see below). Note the given matrix is 
not invertible for s == -0.0122 - 1.544 I or s == -0.0122 + 1.544 I


> Thanks
> Hugh Goyder
> 
> a = -((4.739*^-6 - 0.0008*I)/((0.0122 + 1.544*I) +
>                s)) - (4.7395*^-6 + 0.00088*I)/
>          ((0.0122 - 1.544*I) + s);
> 
> b = -((0.000015 - 0.00022*I)/((0.0122 + 1.544*I) +
>                s)) - (0.000015 + 0.000226*I)/
>          ((0.0122 - 1.544*I) + s);
> 
> mat = {{a, 0}, {0, b}};
> 
> Inverse[mat]
> 
> Det[mat]
> 
> matr = Rationalize[mat, 0];
> 
> inv = Inverse[matr]
> 
> Rationalize[Factor[Together[mat . inv]], 1.*^-8]


Here is an example of how to deal with your matrix so exact arithmetic 
is use all along the computations.

In[1]:= a = Simplify[
   Map[Rationalize[#,
      0] &, -((4.739*^-6 - 0.0008*I)/((0.0122 + 1.544*I) + s)) - 
(4.7395*^-6 +
        0.00088*I)/((0.0122 - 1.544*I) + s), Infinity]]

b = Simplify[
   Map[Rationalize[#,
      0] &, -((0.000015 - 0.00022*I)/((0.0122 + 1.544*I) + s)) - 
(0.000015 +
        0.000226*I)/((0.0122 - 1.544*I) + s), Infinity]]
mat = {{a, 0}, {0, b}}
inv = Inverse[mat]
Factor[Together[mat.inv]]
Reduce[Denominator[Simplify[Det[mat]]] == 0]
% // N

Out[1]=

   (-25938043623 + 9767720 I) + (94785000 + 800000000 I) s
-(-------------------------------------------------------)
                                                 2
         400000 (59602121 + 610000 s + 25000000 s )

Out[2]=

   (-1720645 + 183 I) + (75000 + 15000 I) s
-(----------------------------------------)
                                        2
   100 (59602121 + 610000 s + 25000000 s )

Out[3]=

     (-25938043623 + 9767720 I) + (94785000 + 800000000 I) s
{{-(-------------------------------------------------------), 0},
                                                   2
           400000 (59602121 + 610000 s + 25000000 s )

         (-1720645 + 183 I) + (75000 + 15000 I) s
   {0, -(----------------------------------------)}}
                                              2
         100 (59602121 + 610000 s + 25000000 s )

Out[4]=

                                                   2
           400000 (59602121 + 610000 s + 25000000 s )
{{-(-------------------------------------------------------), 0},
     (-25938043623 + 9767720 I) + (94785000 + 800000000 I) s

                                              2
         100 (59602121 + 610000 s + 25000000 s )
   {0, -(----------------------------------------)}}
         (-1720645 + 183 I) + (75000 + 15000 I) s

Out[5]= {{1, 0}, {0, 1}}

Out[6]=

         61     193 I            61     193 I
s == -(----) - ----- || s == -(----) + -----
        5000     125            5000     125

Out[7]= s == -0.0122 - 1.544 I || s == -0.0122 + 1.544 I


Best regards,
-- Jean-Marc


  • Prev by Date: Re: list of dates
  • Next by Date: Fit data with range
  • Previous by thread: Inverse of symbolic matrix
  • Next by thread: DSolve Issues