Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def Markov(p, s, steps):
- for i in range(steps):
- s = s * p
- return s
- p = np.matrix('.5, .5, 0, 0, 0, 0;\
- .4, .1, .5, 0, 0, 0;\
- 0, .3, .2, .5, 0, 0;\
- 0, 0, .2, .3, .5, 0;\
- 0, 0, 0, .1, .4, .5;\
- 0, 0, 0, 0, 0, 1')
- s = np.matrix('1, 0, 0, 0, 0, 0')
- steps = 10
- print(Markov(p, s, steps))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement