Re: Testing for invertible matrix

• To: mathgroup at smc.vnet.net
• Subject: [mg39716] Re: Testing for invertible matrix
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Mon, 3 Mar 2003 23:48:47 -0500 (EST)
• Organization: Universitaet Leipzig
• References: <b3pgti\$7jd\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

looking in a *mathematics book* than into "The Mathematica Book"
is a better idea, or is

Det[A]=!=0

not a fine test for a matrix A to be invertible ?

Regards
Jens

Bob Harris wrote:
>
> Howdy,
>
> If there some means to test whether a square matrix is invertible, rather
> than trying Invert[] and having it fail?
>
> I'm working on a notebook that's searching through randomly generated
> matrices, looking for one for which the inverse has certain properties.
> Thus inside my search function I have a loop something like this:
>
>     While [... some condition ,
>         t = ... create a matrix   ;
>         q = Inverse[t] ;
>
>         ... perform some computation using the entries in q
>             to determine if the exit condition will be met
>         ];
>
> But if t is singular, computing the inverse fails.  Nevertheless my loop
> keeps running for a while, but generates a few more annoying messages
>
> What I would rather do is something like this:
>
>     While [... some condition ,
>         t = ... create a matrix   ;
>         If [ t is singular, Continue[]];
>
>         q = ... inverse of matrix ;
>
>         ... perform some computation using the entries in q
>             to determine if the exit condition will be met
>         ];
>
> But looking through the mathematica book, I haven't come across a way to do
> that.  I also considered that Inverse[] would have some means for me to tell
> it how to handle the failure condition, but I don't see anything in the book