###### tags: `other` ![](https://i.imgur.com/ejydktE.png =60%x60%) ```python import numpy as np mat = np.array([[0,0.5,0.5,0],[0.6,0,0.4,0],[0.7,0.3,0,0],[0,0,0,1]]) print('Initial steps: \n', mat, '\n') print('After 3 steps: \n', np.linalg.matrix_power(mat,3), '\n') print('After 10 steps: \n', np.linalg.matrix_power(mat,10), '\n') print('After 30 steps: \n', np.linalg.matrix_power(mat,30), '\n') print('After 100 steps: \n', np.linalg.matrix_power(mat,100), '\n') print('After 300 steps: \n', np.linalg.matrix_power(mat,300), '\n') ``` ``` Initial steps: [[0. 0.5 0.5 0. ] [0.6 0. 0.4 0. ] [0.7 0.3 0. 0. ] [0. 0. 0. 1. ]] After 3 steps: [[0.23 0.385 0.385 0. ] [0.462 0.23 0.308 0. ] [0.539 0.231 0.23 0. ] [0. 0. 0. 1. ]] After 10 steps: [[0.40201735 0.28714809 0.31083456 0. ] [0.39195065 0.29305958 0.31498977 0. ] [0.38779545 0.2954585 0.31674605 0. ] [0. 0. 0. 1. ]] After 30 steps: [[0.39461986 0.29147922 0.31390092 0. ] [0.39461846 0.29148004 0.3139015 0. ] [0.39461789 0.29148038 0.31390174 0. ] [0. 0. 0. 1. ]] After 100 steps: [[0.39461883 0.29147982 0.31390135 0. ] [0.39461883 0.29147982 0.31390135 0. ] [0.39461883 0.29147982 0.31390135 0. ] [0. 0. 0. 1. ]] After 300 steps: [[0.39461883 0.29147982 0.31390135 0. ] [0.39461883 0.29147982 0.31390135 0. ] [0.39461883 0.29147982 0.31390135 0. ] [0. 0. 0. 1. ]] ```