Hi,
On Dec 11, 2009, at 2:01 PM, Moohwan Kim wrote:
> Dear R family
>
> I have a following question.
> Suppose I have a matrix as follows, for instance:
> tau=
> 0 1 0 0 0
> 0 0 1 0 0
> 0 0 0 1 0
> 0 0 0 0 1
> 1 0 0 0 0
>
> I want to calculate (-m) power of tau, for example, m=893.
>
> When I run tau^2, the outcome is just tau.
That's because 1^2 = 1
R> tau[tau == 1] <- 2
R> tau^2
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 4
[2,] 4 0 0 0 0
[3,] 0 4 0 0 0
[4,] 0 0 4 0 0
[5,] 0 0 0 4 0
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
______________________________________________
[email protected] 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.