Is this a bug on the zero power of matrix?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Ingrid
el 6 de Mayo de 2015
Editada: Ingrid
el 6 de Mayo de 2015
I think this answer is correct since If exponentiation means repeated multiplication, then A^0=I is the base case for all A.
if this is not the result that you want maybe you were thinking of elementwise power (.^)
1 comentario
Mohammad Abouali
el 6 de Mayo de 2015
James Tursa
el 6 de Mayo de 2015
Editada: James Tursa
el 6 de Mayo de 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 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!