Is this a bug on the zero power of matrix?
1 view (last 30 days)
Show older comments
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?
0 Comments
Answers (2)
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:
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!