User Tools

Site Tools


gibson:teaching:spring-2016:math445:lab6

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:spring-2016:math445:lab6 [2016/02/24 20:43]
gibson
gibson:teaching:spring-2016:math445:lab6 [2018/03/06 06:58] (current)
gibson
Line 26: Line 26:
 Compute the Google Page Rank for a network of 100 pages within ''​www.unh.edu''​. ​ Compute the Google Page Rank for a network of 100 pages within ''​www.unh.edu''​. ​
  
-**(a)**  ​Go to the website ​[[http://​www.mathworks.com/​moler/​chapters.html|Numerical Computing with Matlab]] by Clive Moler and download the “surfer.m” program. Set ''​M=100''​ and run the command ​ +**(a)**  ​Download ​the [[https://​www.mathworks.com/​matlabcentral/​mlc-downloads/​downloads/​submissions/​37976/​versions/​7/​previews/​surfer.m/​index.html?​access_key=|surfer.m]] Matlab script from [[http://​www.mathworks.com/​moler/​chapters.html|Numerical Computing with Matlab]] by Clive Moler. Set ''​M=100''​ and run the command ''​[w,​L] = surfer('​http://​www.unh.edu',​M);''​. This might take a few minutes. ​
-''​[w,​L] = surfer('​http://​www.unh.edu',​M);''​. This might take a few minutes. ​+
  
 **(b)** ​ After some time this will generate a vector $w$ of websites and a matrix $L$ of links between them. All the entries of $L$ should be either 0 or 1. But $L$ will have 100^2 == 10,000 entries, so you can't check this by eye. Write a short piece of Matlab code that double-checks that all entries of $L$ are either 0 or 1.  **(b)** ​ After some time this will generate a vector $w$ of websites and a matrix $L$ of links between them. All the entries of $L$ should be either 0 or 1. But $L$ will have 100^2 == 10,000 entries, so you can't check this by eye. Write a short piece of Matlab code that double-checks that all entries of $L$ are either 0 or 1. 
Line 37: Line 36:
  
 \begin{equation*} \begin{equation*}
-B = (1-\alpha) A + \alpha [1/M]+B = (1-\alpha) A + \alpha [1]/M
 \end{equation*} \end{equation*}
  
-where $[1/M]$ is an $M \times M$ matrix of ones. Rumor has it that Google uses $\alpha = 0.15$, so use that value and calculate $B$. +where $[1]$ is an $M \times M$ matrix of ones. Rumor has it that Google uses $\alpha = 0.15$, so use that value and calculate $B$. 
  
 **(e)** Double-check that the sum of each column of $B$ is 1. Again, be clever and get Matlab to do the work, rather than listing out the sums of all the columns and verifying manually that each of the 100 numbers is 1!  **(e)** Double-check that the sum of each column of $B$ is 1. Again, be clever and get Matlab to do the work, rather than listing out the sums of all the columns and verifying manually that each of the 100 numbers is 1! 
Line 48: Line 47:
 <​code>​ <​code>​
 N=40; N=40;
-for m=1:N;+for n=1:N;
   p=B*p;   p=B*p;
 end end
gibson/teaching/spring-2016/math445/lab6.1456375395.txt.gz · Last modified: 2016/02/24 20:43 by gibson