[R] matrix exponential: M^0

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Jan 20 16:58:35 CET 2004

Federico Calboli <f.calboli at ucl.ac.uk> writes:

> 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:

Because arithmetic on a matrix works element-wise. M^2 is not equal to
M %*% M either (but is equal to  M*M).

(R doesn't have the matrix exponential function. Lifting expm() from
Octave has been on my (virtual) TODO list for some time now...)

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list