Re: [R] inverse matrix

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Fri 28 Oct 2005 - 20:59:01 EST

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 28 21:10:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:52 EST