ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 Jun 2018 20:42:14 +0200More problems with general power of a matrixhttps://ask.sagemath.org/question/42532/more-problems-with-general-power-of-a-matrix/Even though in version 8.2 the code for the general power of a matrix has been improved (c.f. [question 41622](https://ask.sagemath.org/question/41622/bug-in-general-power-of-a-matrix/)), it still doesn't work in some cases, as i.e. this singular, diagonalizable matrix
A=matrix(QQbar,3,3,[[-2,-8,-12],[1,4,4],[0,0,1]])
k=var('k')
A**k
shows.
Concerning the [remark in trac ticket 25520](https://trac.sagemath.org/ticket/25520): Why not defining $0^x=1$ for $x\in {\bf N}$, which seems reasonable, since the number of functions $\emptyset \to \emptyset$ is 1?Wed, 06 Jun 2018 16:12:15 +0200https://ask.sagemath.org/question/42532/more-problems-with-general-power-of-a-matrix/Answer by tmonteil for <p>Even though in version 8.2 the code for the general power of a matrix has been improved (c.f. <a href="https://ask.sagemath.org/question/41622/bug-in-general-power-of-a-matrix/">question 41622</a>), it still doesn't work in some cases, as i.e. this singular, diagonalizable matrix</p>
<pre><code>A=matrix(QQbar,3,3,[[-2,-8,-12],[1,4,4],[0,0,1]])
k=var('k')
A**k
</code></pre>
<p>shows.</p>
<p>Concerning the <a href="https://trac.sagemath.org/ticket/25520">remark in trac ticket 25520</a>: Why not defining $0^x=1$ for $x\in {\bf N}$, which seems reasonable, since the number of functions $\emptyset \to \emptyset$ is 1?</p>
https://ask.sagemath.org/question/42532/more-problems-with-general-power-of-a-matrix/?answer=42536#post-id-42536You are absolutely right, while being correct on positive integers, the expression is not correct when specialized to `k=0`:
sage: [B.subs(k=i) == A^i for i in range(20)]
[False,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True,
True]
sage: B.subs(k=0)
[ -1 -4 -8]
[1/2 2 2]
[ 0 0 1]
Thanks for reporting, it is now [trac ticket 25520](https://trac.sagemath.org/ticket/25520)
Wed, 06 Jun 2018 20:42:14 +0200https://ask.sagemath.org/question/42532/more-problems-with-general-power-of-a-matrix/?answer=42536#post-id-42536