Hello,
be careful D^0 is not the zeroeth power of a matrix. It is a term power :D[i,j]^0=1


To obtain the power of a matrix, you can use a decomposition such as svd:

X = U D V'
the n-th power of X is X = U D^n V'


svd1=svd(D) Apower0=svd1$u%*%diag(svd1$d^0)%*%t(svd1$v)


At 11:40 20/01/2004, Federico Calboli wrote:
Dear All,

I would like to ask why the zeroeth power of a matrix gives me a matrix
of ones rather than the identity matrix:

> D<-rbind(c(0,0,0),c(0,0,0),c(0,0,0))
> D<-as.matrix(D)
> D
     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    0    0
[3,]    0    0    0

> D^0
     [,1] [,2] [,3]
[1,]    1    1    1
[2,]    1    1    1
[3,]    1    1    1

I would have expected the identity matrix here.

I find the same result with every other square matrix I used.
BTW, I am using R 1.8.1 on Linux Mandrake 9.1

Cheers,

Federico Calboli
--



=================================

Federico C. F. Calboli

PLEASE NOTE NEW ADDRESS

Dipartimento di Biologia
Via Selmi 3
40126 Bologna
Italy

tel (+39) 051 209 4187
fax (+39) 051 251 208

f.calboli at ucl.ac.uk

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

St�phane DRAY
--------------------------------------------------------------------------------------------------


D�partement des Sciences Biologiques
Universit� de Montr�al, C.P. 6128, succursale centre-ville
Montr�al, Qu�bec H3C 3J7, Canada

Tel : 514 343 6111 poste 1233
E-mail : [EMAIL PROTECTED]
--------------------------------------------------------------------------------------------------


Web http://www.steph280.freesurf.fr/

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to