Previous Up Next

5.55.6  Powers of a square matrix: matpow

The matpow command takes two arguments, a square matrix and an integer.
matpow returns the corresponding power of the matrix, computed using the Jordan form.
Input:

matpow([[1,2],[2,1]],n)

Output:

[[(3^n+(-1)^n)/2,(3^n-(-1)^n)/2],[(3^n-(-1)^n)/2,(3^n+(-1)^n)/2]]

Notice that jordan([[1,2],[2,1]]) returns [[1,-1],[1,1]],[[3,0],[0,-1]].


Previous Up Next