On 20 Jan 2004 16:40:07 +0000, Federico Calboli <[EMAIL PROTECTED]>
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:

R doesn't have a power operator that knows it's working on a matrix.
M^x raises each entry of M to the power x, it doesn't raise the matrix
to that power.  E.g.

> x
     [,1] [,2]
[1,]    2    2
[2,]    2    2
> x^2
     [,1] [,2]
[1,]    4    4
[2,]    4    4
> x %*% x
     [,1] [,2]
[1,]    8    8
[2,]    8    8

It's a little funny that 0^0 gives 1, but that's a reasonable
convention, often useful in likelihood calculations.

Duncan Murdoch

______________________________________________
[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