Skip to content

Instantly share code, notes, and snippets.

@rabuf
Created November 18, 2013 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabuf/7523021 to your computer and use it in GitHub Desktop.
Save rabuf/7523021 to your computer and use it in GitHub Desktop.
# 1 2 3 5 8 10 11
Q = [0, 1/3, 1/3, 1/3, 0, 0, 0; #1
0, 0, 1/3, 2/3, 0, 0, 0; #2
0, 0, 0, 2/3, 0, 0, 1/3; #3
0, 1/3, 0, 0, 1/3, 0, 1/3; #5
0, 0, 0, 0, 1/3, 1/3, 1/3; #8
0, 0, 0, 0, 0, 0, 1/3; #10
0, 0, 0, 0, 0, 0, 0] #11
N = (eye(7) - Q) ^ - 1
t = N * ones(7,1)
## Q =
## 0.00000 0.33333 0.33333 0.33333 0.00000 0.00000 0.00000
## 0.00000 0.00000 0.33333 0.66667 0.00000 0.00000 0.00000
## 0.00000 0.00000 0.00000 0.66667 0.00000 0.00000 0.33333
## 0.00000 0.33333 0.00000 0.00000 0.33333 0.00000 0.33333
## 0.00000 0.00000 0.00000 0.00000 0.33333 0.33333 0.33333
## 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.33333
## 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
## N =
## 1.00000 0.73684 0.57895 1.21053 0.60526 0.20175 0.86550
## 0.00000 1.42105 0.47368 1.26316 0.63158 0.21053 0.85965
## 0.00000 0.31579 1.10526 0.94737 0.47368 0.15789 0.89474
## 0.00000 0.47368 0.15789 1.42105 0.71053 0.23684 0.84211
## 0.00000 0.00000 0.00000 0.00000 1.50000 0.50000 0.66667
## 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000 0.33333
## 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000
## t =
## 5.1988 # Expected number of moves from space 1
## 4.8596 # Expected number of moves from space 2
## 3.8947 # Expected number of moves from space 3
## 3.8421 # Expected number of moves from space 5
## 2.6667 # Expected number of moves from space 8
## 1.3333 # Expected number of moves from space 10
## 1.0000 # Expected number of moves from space 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment