1-D Random Walk

drunk={{1,1/2,0,0,0},{0,0,1/2,0,0},{0,1/2,0,1/2,0},{0,0,1/2,0,0},{0,0,0,1/2,1}};




MatrixForm[drunk]

MatrixForm[Eigenvectors[drunk,2],TableHeadings->{None,{"Door","-1","0","1","Door"}}]

Gambler’s Ruin

The exact value

N[((((19/37)/(18/37))^500)-1)/((((19/37)/(18/37))^600)-1),6]

The over-approximation

N[(18/19)^100,6]

Scratch

items=Tuples[{"R","B","G"},3]

names=Map[StringJoin,%]

(*The probability that (a,b,c) appears given that it starts as (d,e,f) *)
Prob[{a_,b_,c_},{d_,e_,f_}]:=
If[{a,b,c}=={d,d,f},1/6,0]+If[{a,b,c}=={e,e,f},1/6,0]+If[{a,b,c}=={d,e,d},1/6,0]+If[{a,b,c}=={f,e,f},1/6,0]+If[{a,b,c}=={d,e,e},1/6,0]+If[{a,b,c}=={d,f,f},1/6,0]

matrix=Table[Prob[items[[i]],items[[j]]],{i,27},{j,27}]

MatrixForm[matrix,TableHeadings->{names,names}]

Color game

Grid[Prepend[Transpose[Prepend[Transpose[matrix],names]],Prepend[names," "]],Background->{{,,,,,,,,,,,,Pink},{,,,Yellow}}]

Grid[Prepend[Transpose[Prepend[Transpose[Round[N[MatrixPower[matrix,5]],.001]],names]],Prepend[names," "]],Background->{{,,,,,,,,,,,,Pink},{,,,Yellow}},ItemSize->{3}]

Grid[Prepend[Transpose[Prepend[Transpose[Round[N[MatrixPower[matrix,50]],.001]],names]],Prepend[names," "]],Background->{{,,,,,,,,,,,,Pink},{,,,Yellow}},ItemSize->{3}]

Eigenvectors

TableForm[Transpose[Prepend[Take[Eigenvectors[matrix],3],names]]]

Eigenvalues[%180]