MathGroup Archive 2005

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

Search the Archive

Re: Why does Inverse[M] hesitate?


On 18 Feb 05 17:39:03 -0500 (EST), 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. 

ah, there's the problem. Well, it's all because of the
MatrixForm wrapper, which is designed for output and printing, not
evaluation. The postfix operator // has a higher precedence than
assignment and therefore you got the head MatrixForm[...] for A.
Of course, when you copied the input, it was translated to InputForm -
without wrappers.

To make it work, use std infix, or include an extra parentheses:

MatrixForm[A={{(1-g)-1,1},{-w P(1-g)/C,-1}}]

or 

   (      A={{(1-g)-1,1},{-w P(1-g)/C,-1}}    ) //MatrixForm

regards,
Jaroslav


  • Prev by Date: Re: Elegant syntax for multiple conditional assignment?
  • Next by Date: Re: How do I get a DSolve'd function
  • Previous by thread: Re: Why does Inverse[M] hesitate?
  • Next by thread: Re: Why does Inverse[M] hesitate?