User Tools

Site Tools


gibson:teaching:fall-2013:math445:lab10

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

Link to this comparison view

Next revision
Previous revision
gibson:teaching:fall-2013:math445:lab10 [2013/11/13 14:07]
gibson created
gibson:teaching:fall-2013:math445:lab10 [2013/11/13 14:19] (current)
gibson
Line 7: Line 7:
 Do the boundary conditions make the domain effectively infinite? Why or why not?  Do the boundary conditions make the domain effectively infinite? Why or why not? 
  
-**2.** ​We are going to create our own code for the game of life and use +**2.** ​Write your own Game of Life code as Matlab function, following these steps. ​ 
-different approach based that does not allow anything to live on +Open the file ''​mylife.m'' ​and start enter these lines
-borders of the domainWe will let our board be 50x50 grid. Start a +
-new script file, and start it with the lines +
  
 <​code>​ <​code>​
Line 20: Line 18:
 of the code? of the code?
  
-**3.** Next set up the initial layout for the game of life. This initial ​ +**3.** Next set up the initial layout for the game of life on a  
-condition leads to some pretty interesting behavior!+a 50 x 50 grid. This initial condition leads to some pretty interesting behavior!
  
 <​code>​ <​code>​
Line 48: Line 46:
 blue squares ​ blue squares ​
  
-<​code> ​ 
   spy(X,'​bs'​); ​   spy(X,'​bs'​); ​
-</​code>​ 
  
 A more complicated but ultimately more satisfying way to plot the live cells A more complicated but ultimately more satisfying way to plot the live cells
Line 63: Line 59:
 </​code>​ </​code>​
  
-Whatever method ​you use, follow ​it with this code+Use this latter code unless ​you can't get your Game of Life code to run correctly. 
 +In that case, use the simpler ''​spy''​ plotting code to debugand then replace ​it  
 +with ''​find''​ and ''​plot''​ once your code is running correctly.
  
 <​code>​ <​code>​
Line 73: Line 71:
 </​code>​ </​code>​
  
-Please briefly describe what each line of your code does using the help menu. +Please briefly describe what each line of your code does. Use the ''​help''​  
 +function or menu if you're not sure
 You may want to change the value of ''​MarkerSize''​ to make your plots look  You may want to change the value of ''​MarkerSize''​ to make your plots look 
 better, or change the argument of the ''​pause''​ function to make the code  better, or change the argument of the ''​pause''​ function to make the code 
Line 100: Line 99:
 changes between successive time steps. (Hint: you'll need to store the changes between successive time steps. (Hint: you'll need to store the
 live cells an ''​Xprev''​ sparse matrix before you update them. Look up  live cells an ''​Xprev''​ sparse matrix before you update them. Look up 
-the ''​nnz'​ function in help, and use it to compute the number of different ​+the ''​nnz'' function in help, and use it to compute the number of different ​
 elements between ''​X''​ and ''​Xprev''​.) elements between ''​X''​ and ''​Xprev''​.)
  
Line 138: Line 137:
  
  
-Turn in your completed code and the answers to the above questions.+Turn in your completed code ''​mylife.m''​ and ''​mylife2.m''​ codes and the answers to the above questions.
gibson/teaching/fall-2013/math445/lab10.1384380449.txt.gz · Last modified: 2013/11/13 14:07 by gibson