Re: [R] Coding matrix equation

2011-04-11 Thread Petr Savicky
On Mon, Apr 11, 2011 at 08:43:03AM +0100, matthew.r.robin...@sheffield.ac.uk wrote: > Hi all, > > I have two matrices: > > G<-matrix(c(2.0, 0.5, 0.5, 0.5, 2.0, 0.5, 0.5, 0.5,2.0),3,3) > P<-matrix(c(1.0, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.5,1.0),3,3) > > and I want to run this equation to get a new

Re: [R] Coding matrix equation

2011-04-11 Thread Joshua Wiley
Hi Matt, Petr gave you one possibility. If you are looking for more matrix operations see: ?"%*%" # the inner product of the matrices ?"%o%" # the outer product of the matrices ?"(" # for parentheses to help order things require(MASS) # load the package MASS ?ginv # for the generalized inverse

[R] Coding matrix equation

2011-04-11 Thread matthew.r.robin...@sheffield.ac.uk
Hi all, I have two matrices: G<-matrix(c(2.0, 0.5, 0.5, 0.5, 2.0, 0.5, 0.5, 0.5,2.0),3,3) P<-matrix(c(1.0, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.5,1.0),3,3) and I want to run this equation to get a new matrix F: F = [P+2G]^-1/2 P [P+2G]^-1/2 Could someone please tell me how to code this in R? Many