[R] Odp: Coding matrix equation

Petr PIKAL petr.pikal at precheza.cz
Mon Apr 11 10:05:33 CEST 2011


Hi

r-help-bounces at r-project.org napsal dne 11.04.2011 09:43:03:

> 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

Is this what you want?

(P+2*G)^-1/2 * P * (P+2*G)^-1/2

Regards
Petr

> 
> Could someone please tell me how to code this in R?
> 
> Many thanks in advance for your time.
> 
> Best wishes,
> Matt
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list