Is this a bug on the zero power of matrix?
9 views (last 30 days)
If I set A=[0,0;0,0], and I type A^0, the result would be eye(2), which is wrong. The same fault happens when A=[1,1;1,1]. The result is [0.5,0.5;0.5,0.5], if you approximate A^0 by iterately computing A=A^0.5. But matlab gives result A^0=eye(2) again. I'm quite confused now, is this a bug, or am I making a mistake somewhere?
James Tursa on 6 May 2015
Edited: James Tursa on 6 May 2015
There are multiple ways of evaluating the limit of x^y when x and y both go to 0. One of them, the way you used, is to start with 0^y for positive y and then shrink y to 0. The limit in this case is 0, of course. Another way is to start with x^0 for positive x and then shrink x to 0. The limit in this case is 1. Extend these concepts to an NxN matrix and you get zeros(N) and eye(N) as the possible choices. There are arguments on both sides as to which is the "correct" or "more useful" value for computing purposes, and the advantages and disadvantages of each choice. MATLAB has chosen the latter probably for consistency with IEEE lower level functions.
E.g., one consequence of this is that (sparse matrix)^0 is no longer sparse since all of those 0 elements become 1.
Two of the gazillion links on this: