Re: Why does Inverse[M] hesitate?
- To: mathgroup at smc.vnet.net
- Subject: [mg54431] Re: Why does Inverse[M] hesitate?
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Sun, 20 Feb 2005 00:09:53 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 2/19/05 at 2:32 AM, skirmantas.janusonis at yale.edu (Skirmantas) wrote: >The Inverse function sometimes calculates the inverse of a matrix >immediately, sometimes it does not. Try this example in Mathematica >5.1: >A={{(1-g)-1,1},{-w P(1-g)/C,-1}}//MatrixForm >B={{0},{-P(w+1)}}//MatrixForm >I get Out: Inverse[(expanded A)].(expanded B) >If I do just >A={{a,b},{c,d}} >B={{e},{f}} >Inverse[A].B >I get the final correct result. Right. This is becuase you used MatrixForm which puts a wrapper around the expression. If you do A={{(1-g)-1,1},{-w P(1-g)/C,-1}}//MatrixForm MatrixQ[A] you will get False indicating A is not a matrix. The same is true of B. Consequently, neither Inverse nor . can work There are a couple of ways around this issue. First, you could do (A={{(1-g)-1,1},{-w P(1-g)/C,-1}})//MatrixForm (B={{0},{-P(w+1)}})//MatrixForm This forces assignment to A and B before MatrixForm does its thing. As a consequence, MatrixQ[A] will evaluate as True and Inverse[A].B will do what you expect. But I think the more elegant way around this issue is to set the default output display to TraditionalForm and simply not use MatrixForm -- To reply via email subtract one hundred and four
- Follow-Ups:
- Re: Re: Why does Inverse[M] hesitate?
- From: DrBob <drbob@bigfoot.com>
- Re: Re: Why does Inverse[M] hesitate?