Layout 1 has two balloons.
In[]:=
layout1=
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 1 | 0 |
Out[]=
{{0,0,0,0,0,1},{0,0,1,0,0,0},{1,0,0,1,0,0},{0,0,0,0,0,1},{0,0,1,0,0,0},{0,1,0,0,1,0}}
In[]:=
MatrixPower[layout1,20]//MatrixForm
Out[]//MatrixForm=
512 | 0 | 0 | 512 | 0 | 0 |
0 | 512 | 0 | 0 | 512 | 0 |
0 | 0 | 1024 | 0 | 0 | 0 |
512 | 0 | 0 | 512 | 0 | 0 |
0 | 512 | 0 | 0 | 512 | 0 |
0 | 0 | 0 | 0 | 0 | 1024 |
Layout 2 has two ears and a rainbow.
In[]:=
layout2=
1 | 0 | 1 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 1 | 1 |
0 | 0 | 0 | 1 | 0 | 0 |
Out[]=
{{1,0,1,0,0,0},{0,1,0,0,0,0},{0,1,0,0,0,0},{0,0,0,1,0,0},{0,0,0,0,1,1},{0,0,0,1,0,0}}
In[]:=
MatrixPower[layout2,20]//MatrixForm
Out[]//MatrixForm=
1 | 19 | 1 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 19 | 1 | 1 |
0 | 0 | 0 | 1 | 0 | 0 |
Layout 3 has two rainbows.
In[]:=
layout3=
0 | 0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 0 |
1 | 1 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 | 0 |
Out[]=
{{0,0,1,0,0,0},{0,0,1,0,0,0},{1,1,0,0,0,0},{0,0,0,0,0,1},{0,0,0,0,0,1},{0,0,0,1,1,0}}
In[]:=
MatrixPower[layout3,20]//MatrixForm
Out[]//MatrixForm=
512 | 512 | 0 | 0 | 0 | 0 |
512 | 512 | 0 | 0 | 0 | 0 |
0 | 0 | 1024 | 0 | 0 | 0 |
0 | 0 | 0 | 512 | 512 | 0 |
0 | 0 | 0 | 512 | 512 | 0 |
0 | 0 | 0 | 0 | 0 | 1024 |
Layout 4 has one snake, one ear, and one balloon.
In[]:=
layout4=
1 | 0 | 1 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 1 | 0 | 0 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 0 | 0 |
Out[]=
{{1,0,1,0,0,0},{0,0,0,0,0,1},{0,1,0,0,1,0},{0,0,0,1,0,0},{0,0,0,0,0,1},{0,0,0,1,0,0}}
In[]:=
MatrixPower[layout4,20]//MatrixForm
Out[]//MatrixForm=
1 | 1 | 1 | 34 | 1 | 2 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 2 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
Layout 5 has one rainbow and two snakes.
In[]:=
layout5=
0 | 1 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
Out[]=
{{0,1,0,0,0,0},{1,0,0,0,0,0},{1,0,0,0,0,0},{0,0,0,0,1,1},{0,0,1,1,0,0},{0,1,0,0,0,0}}
In[]:=
MatrixPower[layout5,20]//MatrixForm
Out[]//MatrixForm=
1 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 19 | 1 | 1 | 0 | 0 |
19 | 0 | 0 | 0 | 1 | 1 |
1 | 0 | 0 | 0 | 0 | 0 |
Now make Markov chains!
Layout 1 has two balloons.
In[]:=
layout1m=
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 |
1/2 | 0 | 0 | 1/2 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 | 0 | 0 |
0 | 1/2 | 0 | 0 | 1/2 | 0 |
Out[]=
{0,0,0,0,0,1},{0,0,1,0,0,0},,0,0,,0,0,{0,0,0,0,0,1},{0,0,1,0,0,0},0,,0,0,,0
1
2
1
2
1
2
1
2
In[]:=
MatrixPower[layout1m,100]//MatrixForm
Out[]//MatrixForm=
1 2 | 0 | 0 | 1 2 | 0 | 0 |
0 | 1 2 | 0 | 0 | 1 2 | 0 |
0 | 0 | 1 | 0 | 0 | 0 |
1 2 | 0 | 0 | 1 2 | 0 | 0 |
0 | 1 2 | 0 | 0 | 1 2 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
Layout 2 has two ears and a rainbow.
In[]:=
layout2m=
1/2 | 0 | 1/2 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 1/2 | 1/2 |
0 | 0 | 0 | 1 | 0 | 0 |
Out[]=
,0,,0,0,0,{0,1,0,0,0,0},{0,1,0,0,0,0},{0,0,0,1,0,0},0,0,0,0,,,{0,0,0,1,0,0}
1
2
1
2
1
2
1
2
In[]:=
MatrixPower[1.layout2m,1]//MatrixForm
Out[]//MatrixForm=
0.5 | 0. | 0.5 | 0. | 0. | 0. |
0. | 1. | 0. | 0. | 0. | 0. |
0. | 1. | 0. | 0. | 0. | 0. |
0. | 0. | 0. | 1. | 0. | 0. |
0. | 0. | 0. | 0. | 0.5 | 0.5 |
0. | 0. | 0. | 1. | 0. | 0. |
Layout 3 has two rainbows.
In[]:=
layout3m=
0 | 0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 0 |
1/2 | 1/2 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1/2 | 1/2 | 0 |
Out[]=
{0,0,1,0,0,0},{0,0,1,0,0,0},,,0,0,0,0,{0,0,0,0,0,1},{0,0,0,0,0,1},0,0,0,,,0
1
2
1
2
1
2
1
2
In[]:=
MatrixPower[layout3m,1]//MatrixForm
Out[]//MatrixForm=
0 | 0 | 1 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 0 |
1 2 | 1 2 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 2 | 1 2 | 0 |
Layout 4 has one snake, one ear, and one balloon.
In[]:=
layout4m=
1/2 | 0 | 1/2 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 1/2 | 0 | 0 | 1/2 | 0 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 0 | 0 |
Out[]=
,0,,0,0,0,{0,0,0,0,0,1},0,,0,0,,0,{0,0,0,1,0,0},{0,0,0,0,0,1},{0,0,0,1,0,0}
1
2
1
2
1
2
1
2
In[]:=
MatrixPower[1.layout4m,1]//MatrixForm
Out[]//MatrixForm=
0.5 | 0. | 0.5 | 0. | 0. | 0. |
0. | 0. | 0. | 0. | 0. | 1. |
0. | 0.5 | 0. | 0. | 0.5 | 0. |
0. | 0. | 0. | 1. | 0. | 0. |
0. | 0. | 0. | 0. | 0. | 1. |
0. | 0. | 0. | 1. | 0. | 0. |
Layout 5 has one rainbow and two snakes.
Absorbing states
Out[]//TeXForm=
\left(
\begin{array}{ccccccc}
0 &
rac{2}{5} & 0 & 0 & 0 &
rac{3}{5} & 0 \
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 & 0 & 0 \
0 &
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 & 0 \
0 & 0 &
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 \
0 & 0 & 0 &
rac{3}{5} & 0 & 0 &
rac{2}{5} \
0 & 0 & 0 & 0 & 0 & 1 & 0 \
0 & 0 & 0 & 0 & 0 & 0 & 1 \
\end{array}
ight)
\begin{array}{ccccccc}
0 &
rac{2}{5} & 0 & 0 & 0 &
rac{3}{5} & 0 \
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 & 0 & 0 \
0 &
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 & 0 \
0 & 0 &
rac{3}{5} & 0 &
rac{2}{5} & 0 & 0 \
0 & 0 & 0 &
rac{3}{5} & 0 & 0 &
rac{2}{5} \
0 & 0 & 0 & 0 & 0 & 1 & 0 \
0 & 0 & 0 & 0 & 0 & 0 & 1 \
\end{array}
ight)
Out[]//TeXForm=
\{3.55639,6.39098,8.14286,8.27068,5.96241\}
Out[]//TeXForm=
\left(
\begin{array}{cccccccccc}
rac{1}{3} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 & 0 & 0 &
rac{1}{2} &
rac{1}{3} \
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
\end{array}
ight)
\begin{array}{cccccccccc}
rac{1}{3} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} & 0 \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 & 0 &
rac{1}{6} &
rac{1}{3} &
rac{1}{3} \
rac{1}{6} & 0 & 0 & 0 & 0 & 0 & 0 & 0 &
rac{1}{2} &
rac{1}{3} \
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
\end{array}
ight)
Out[]//TeXForm=
rac{543669}{26576}
rac{543669}{26576}
Matrix Manipulation Commands
Matrix Manipulation Commands
This command makes the matrix Q by eliminating the last k rows and k columns from the matrix given as input, where k is the number of absorbing states.
The next two functions combine to switch rows i and j in a matrix, usually a transition matrix. The first generates the appropriate matrix, and the second applies it.
This function switches rows i and j in a matrix, but does it by moving row i into row j by sliding all intermediate rows up one position. It assumes that i<j.
Given a matrix assumed to be Q, this function produces N. The next produces N in decimal form - often much more useful.
This command finds the minimum length of a game. The flag indicates whether the probability of having a game of minimum length is printed.
This function produces values for the cumulative distribution function for the value "upper". Do not set the flag to True to compute exact values unless you know that you want them!
This function finds the probability of a game of a specific length.
The next two compute the expected length of a game, either in decimals or exact. Again, don't use the exact unless you know you want it!
This command computes the expected length vector and the variance vector for a game. You give the command the moves matrix in canonical form and the number of absorbing states.