Python3 numpy.linalg.matrix_power import numpy as np from numpy.linalg import matrix_power a = np.array([[0,1,0],[0,0,1],[0,0,0]]) ae10 = matrix_power(a,10) print(ae10) [[0 0 0] [0 0 0] [0 0 0]] 注意:如果幂次很大,为了减少在求幂过程中的误差,矩阵中的数字建议用浮点数