# Revision history [back]

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code does not give the expected answer.

Btw: One of the M-programs gives the correct answer

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following following

live code does not give the expected answer.

Btw: One of the M-programs gives the correct answer

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following

live code following \href{live code}{http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage} does not give the expected answer.

Btw: One of the M-programs gives the correct answer

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following \href{live code}{http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage} \href{lhttp://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage}{live code} does not give the expected answer.

Btw: One of the M-programs gives the correct answer

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following \href{lhttp://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage}{live code} live code

sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not {\bf not} give the expected answer.

Btw: One of the M-programs gives {\bf gives}

http://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does {\bf not} give the expected answer.

Btw: One of the M-programs {\bf gives}

http://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sagehttp://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does {\bf not} not give the expected answer.

Btw: One of the M-programs {\bf gives}gives

http://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

http://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5Dhttps://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@crisman @krisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@krisman @kcrisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman The power of a matrix $A$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman The For $k\in {\bf N}$ the $k$-th power of a matrix $A$ $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D 14 None

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D 15 retagged

### General power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### General Bug in general power of a matrix

The code to question 35658 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs gives

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs givesM-programs

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code

live code

http://sagecell.sagemath.org/?z=eJzLVrBVKEss0lDPVtfk5XK0zU0sKcqs0IiONtEx1DGK1Yk20DHS0TUBMwx1zGJjgaoK8ktsHeOyebmKM_LLNYA8oBiCo1dcmlSskW1roKmJKWioqQkA_MQgTQ==&lang=sage

does not give the expected answer.

Btw: One of the M-programs

M-programs

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code does not give the expected answer.

Btw: One of the M-programs

M-programs

https://www.wolframalpha.com/input/?i=MatrixPower%5B%7B%7B4,1,2%7D,%7B0,2,-4%7D,%7B0,1,6%7D%7D,k%5D

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

@kcrisman For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code does not give the expected answer.

Btw: One of the M-programs gives the correct answer.

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

Where can I find an improvement?

For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code does (currently) not give the expected answer.

Btw: One of the M-programs gives the correct answer.

### Bug in general power of a matrix

The code to question 35658 gives a wrong answer i.e. for the matrix

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])

A=matrix([[4,1,2],[0,2,-4],[0,1,6]])


Where can I find an improvement?

For $k\in {\bf N}$ the $k$-th power of a matrix $A\in {\bf R}^{n\times n}$ satisfies by definition the recursion $A^{k+1}=A*A^k$ and the initial condition $A^0=I$. Substitution of $k=0$ and $k=1$ should therefore give the identity matrix $I$ resp. the matrix $A$. The following live code does (currently) not give the expected answer.

Btw: One of the M-programs gives the correct answer.