2019-01-23 13:38:36 +00:00
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
P = np.array(
|
|
|
|
[ [1/6, 1/6, 1/6, 1/6, 1/6, 0]
|
|
|
|
, [1/6, 1/6, 1/6, 1/6, 1/6, 0]
|
|
|
|
, [1/6, 1/6, 1/6, 1/6, 1/6, 0]
|
|
|
|
, [1/6, 1/6, 1/6, 1/6, 1/6, 0]
|
|
|
|
, [1/6, 1/6, 1/6, 1/6, 1/6, 1/10]
|
|
|
|
, [1/6, 1/6, 1/6, 1/6, 1/6, 9/10]])
|
|
|
|
print(P.shape)
|
|
|
|
|
|
|
|
v = np.array([0, 1, 0, 0, 0, 0])
|
2019-01-23 15:46:26 +00:00
|
|
|
w = np.dot(np.linalg.matrix_power(P, 4), v)
|
2019-01-23 13:38:36 +00:00
|
|
|
print(w)
|
|
|
|
print(w[-1])
|