This is an excellent example. However, when I tried the linear algebra approach in the mdp post, the while loop cannot stop.