Governor’s School for the Sciences

24
Governor’s School for the Sciences Mathematics Mathematics Day 13

description

Governor’s School for the Sciences. Mathematics. Day 13. MOTD: John von Neumann. 1903 to 1957 Built mathematical framework for quantum mechanics Worked in game theory Developed first modern day computer Developed cellular automata Pioneer of computer science. How GSS is like college. - PowerPoint PPT Presentation

Transcript of Governor’s School for the Sciences

Page 1: Governor’s School for the Sciences

Governor’s School for the Sciences

MathematicsMathematicsDay 13

Page 2: Governor’s School for the Sciences

MOTD: John von Neumann

• 1903 to 1957• Built mathematical

framework for quantum mechanics

• Worked in game theory• Developed first modern

day computer• Developed cellular

automata• Pioneer of computer

science

Page 3: Governor’s School for the Sciences

How GSS is like college

• More freedom and responsibility• Some classes of interest; some

required• Classes tough; pace is fast• Work is done outside of class• Students better than average HS

students

Page 4: Governor’s School for the Sciences

How college is not like GSS

• Freedom to get in big trouble and be completely irresponsible

• Instructor not always good or caring• Classes not designed to be fun or

neccesarily interesting• Workload can be overwhelming• Being smart does still not make you

popular

Page 5: Governor’s School for the Sciences

Cellular Automata

• Cells – d-dim’l set of squares (cells):

• Each cell is in one of k states (or colors) and is a simple computer

• Each cell runs the same simple ‘program’ called a transition or update rule

• Rule gives next state depending on state of neighbors

Page 6: Governor’s School for the Sciences

Executing a CA

• Assign initial states to the cell array• For each time cycle, execute the rule

at each cell (all updates occur at the same time)

• The results can model physical patterns, generate random numbers and have other applications

Group ExerciseGroup Exercise

Page 7: Governor’s School for the Sciences

Examples (d=1)

Page 8: Governor’s School for the Sciences

Details for 1D

• Associate the cells with the integers: …,-4,-3,-2,-1,0,1,2,3,4,… (infinite)

• State is designated: x(i) or xi

• Rule based on states of cells in neighborhood: Ni = {j : |i-j| }, is range

• Example , Ni = {i-1, i, i+1}• k states means k different possible

neighborhood state combinations• Rule specifies future state for each possible

combination

Page 9: Governor’s School for the Sciences

Simplest Case: d=1, =1, k=1

• Neighborhood of i has states x(i-1), x(i), x(i+1)

• Call them p, q, r• Rules are arithmetic/logical combinations of

p, q and r, like (p+r) mod 2 1 – (1-p)(1-q)(1-r) r and q p

• Or just an explicit set of outputs for each of the 8 possible neighbor state combos

Page 10: Governor’s School for the Sciences

Worksheet

• Start with the pattern and apply these rules 5 timesEx: p + r (mod 2) You Try A: r B: (p or q) or r C: 1-p*q

Page 11: Governor’s School for the Sciences

Results

Page 12: Governor’s School for the Sciences

(aside) Binary Arithmetic

• 2 states: denote them 0 and 1• The states of a collection of cells is just

a list of 0s and 1s• A list of 0s and 1s can be interpreted as

the base-2 representation of a positive integer (and vice-versa!) 101101002 = 27 + 25 + 24 + 22 = 18010

• Use for numbering neighborhoods and rules

Page 13: Governor’s School for the Sciences

… and Boolean Algebra

• 1=on and 0=off or 1=true and 0=false• If p and q are two values then

not p = 1-p p and q = pq p or q = 1 – (1-p)(1-q) p xor q = p+q (mod 2)

• Any logical rule using two states can be written as an binary arithmetic expression

Page 14: Governor’s School for the Sciences

Naming Rules

8 possible nbhd patterns

2 possible outputs for each pattern

28 = 256 possible rules

Page 15: Governor’s School for the Sciences

Naming Rules (2)

• Given any rule, it produces 8 output values, one for each neighborhood

• Write outputs in order from 7 to 0 and interpret as a binary number

• Decimal value is the Rule Number• Ex: Rule 30: 30 = 000111102

Rule 110: 110 = 011110002

• Remember to read from right to left for states 0-7

Page 16: Governor’s School for the Sciences

Classification

• 4 basic cases for CAs

Class 1: tends toward a limit point (like all 0s)Class 2: tends toward a cycle Class 3: chaotic behaviorClass 4: more complex; capable of universal computation

Page 17: Governor’s School for the Sciences

Other Classification

• Totalistic: rule only depends on sum of neighboring values (24 = 16)

• Legal: totalistic, plus if sum=0, state must be 0 (23 = 8)

• Reversible: can go forward or back in time (without losing information)

Page 18: Governor’s School for the Sciences

#254 (C1)

#170 (C2)

#30 (C3)

#110 (C4)

Page 19: Governor’s School for the Sciences

Finite State Machine

• S = finite set of states• I = finite set of inputs• O = finite set of outputs• f s = a function that takes a state and an

input and produces a state• f o = a function that takes a state and

produces an output• Given a starting state and a string of

inputs, apply f o and f s repeatedly to produce a string of outputs

Page 20: Governor’s School for the Sciences
Page 21: Governor’s School for the Sciences

Turing Machines

• A Turing machine is like a finite state machine, except: It can erase/write on the input It can read input forward or backward

• A Turing machine is an abstract algorithm and its existence and properties are used to say clever things about the algorithm, e.g. decidability and complexity

Page 22: Governor’s School for the Sciences

Universal Turing Machines

• There is a Turing machine which can simulate the action of any other Turing machine on any input

• It is called the Universal Turing Machine• Basic idea: write a ‘program’ for a

Turing machine and encode it on the input tape, the UTM reads the ‘program’ and executes it on the rest of the input; complicated due to lack of memory

Page 23: Governor’s School for the Sciences

CA and Turing Machines

• Rule 110 is a Universal Turing Machine

• There are CAs which are Universal CAs! (much more complicated than a UTM; serial versus infinitely parallel)

Page 24: Governor’s School for the Sciences

Lab Time

• Classification of all 256 rules for the simple case

• Each person will do 16 different rules; assignment in Lab

• Everyone must do their part!

• When done: work on your project