October 1, 2019
For today
Turn in your project proposal
Read Chapter 6 of Think Complexity and do the reading quiz
Today
Cellular automata
Analysis of graph algorithms
Project work/discussions
For next time:
Work on your project (fail fast)
Prepare for a quiz on Chapters 5 and 6 (here's last year's quiz for practice)
Let's review the Chapter 5 notebook.
1) correlate_same
2) Rule 110 space ships
Some background on the proof that Rule 110 is universal, at least according to one observer.
And preview the Chapter 6 notebook
1) GoL with random initial condition
2) HighLife
3) Langton's Ant
Suggestions for Langton's Ant
1) Write a new class that extends Cell2D
2) Add attributes to record the location of the Ant and the state (direction)
3) Override __init__, step, and draw
4) Do we know about super?
def draw(self):
"""Updates the display with the state of the grid."""
super().draw()
# draw the ant
5) To draw the ant, consider
from matplotlib.patches import RegularPolygon
Some CAs might be models of some physical systems:
But that is not the primary purpose, at least not in Wolfram's experiment.
Rather, he uses them to explore the minimal requirements for generating phenomena like recursive structure, randomness, and computation.
At the end of Chapter 5, I presented this framework for physical modeling:
At the end of Chapter 6, I suggested that explanatory models might fit into a different framework:
1) In the first framework, which might be used for prediction and design, what is the structure of the argument? Why should we expect the predictions to be good? Can you think of an example?
2) In the second framework, which might be used for explanation, what is the structure of the argument? Can you think of an example?
A word from our friends at Accidentally Quadratic
def reachable_nodes(G, start):
seen = set()
stack = [start]
while stack:
node = stack.pop()
if node not in seen:
seen.add(node)
stack.extend(G.neighbors(node))
return seen
def is_connected(G):
start = list(G)[0]
reachable = reachable_nodes(G, start)
return len(reachable) == len(G)
def reachable_nodes_precheck(G, start):
seen = set()
stack = [start]
while stack:
node = stack.pop()
if node not in seen:
seen.add(node)
neighbors = set(G[node]) - seen
stack.extend(neighbors)
return seen