Skip to content
Back to formatted view

Raw Message

Message-ID: <43620475.9060208@pdf.com>
Date: 2005-10-28T10:59:01Z
From: Sundar Dorai-Raj
Subject: inverse matrix
In-Reply-To: <20051028052047.6111.qmail@web30608.mail.mud.yahoo.com>

Sam R. Smith wrote:
> if solve(a,b) means to calculate an inverse matrix of
> a with b, and i wonder why solve(a)%%b will get
> different result?
> 

It does? Or perhaps your "%%" is not just a typo. It should be "%*%".

 > a <- matrix(rnorm(16), 4, 4)
 > b <- matrix(rnorm(4), 4, 1)
 > solve(a, b)
            [,1]
[1,] -0.8005768
[2,]  0.5913755
[3,] -1.8256012
[4,]  0.8973716
 > solve(a) %*% b
            [,1]
[1,] -0.8005768
[2,]  0.5913755
[3,] -1.8256012
[4,]  0.8973716

HTH,

--sundar