**This is an old revision of the document!** ----
====== Math 445 lab 6: Google Page Rank ====== ----- **Problem 1: Hamster dynamics.** Suppose you have 100 hamsters living in the following set of eight hamster houses connected by one-way tunnels. {{:gibson:teaching:fall-2012:math445:network1.png?direct&400|}} Suppose that every minute at sound of a bell, each hamster runs down one of the tunnels in its present hamster house and appears in the house it connects to. **(a)** Let $p_i^n$ represent the fraction of hamsters in the $i$th house in the $n$th minute. Write down a set of eight equations for $p^{n+1}_1$ through $p^{n+1}_8$ in terms of $p^{n}_1$ through $p^{n}_8$. **(b)** Let $p^n$ be the vector whose elements are $p^n_1, p^n_2, \ldots, p^n_8$. Write the set of equations from (a) in terms of a matrix-vector multiplication, $p^{n+1} = A p^n$. **%%(c)%%** Write Matlab code to compute the steady-state distribution of hamsters by computing $p^n$ for some large value of $n$, say $n=100$. For $p^0$, start with either the same fraction of hamsters in each house or a random set of fractions that totals to 1. **(d)** Use Matlab's **sort** function to produce a list of the houses ranked in order of their steady-state populations. **Challenge:** Revise your code show that uses Matlab's **bar** function to show a bar chart of the hamster distribution at each time step through the loop. Use Matlab's **pause** function to pause a short while on each step, so that you have time to see each bar chart. ...to be continued...