Cellular Automata Mus270C Cellular Automata Discrete - - PowerPoint PPT Presentation

cellular automata
SMART_READER_LITE
LIVE PREVIEW

Cellular Automata Mus270C Cellular Automata Discrete - - PowerPoint PPT Presentation

Cellular Automata Mus270C Cellular Automata Discrete Dynamical System Space and 9me Dimension 1-D, 2-D, States Neighborhood and


slide-1
SLIDE 1

Cellular ¡Automata ¡

Mus270C ¡

slide-2
SLIDE 2

Cellular ¡Automata ¡

  • Discrete ¡Dynamical ¡System ¡

– Space ¡and ¡9me ¡

  • Dimension ¡

– 1-­‑D, ¡2-­‑D, ¡… ¡

  • States ¡

– Neighborhood ¡and ¡neighbors ¡

  • Rules ¡

2 ¡

slide-3
SLIDE 3

1-­‑D ¡Cellular ¡Automata ¡

  • ¡Neighborhood ¡ ¡

3 ¡

slide-4
SLIDE 4

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡

4 ¡

slide-5
SLIDE 5

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡

5 ¡

slide-6
SLIDE 6

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡
  • Example ¡

t ¡= ¡1 ¡

6 ¡

slide-7
SLIDE 7

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡
  • Example ¡

t ¡= ¡1 ¡ t ¡= ¡2 ¡

7 ¡

slide-8
SLIDE 8

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡
  • Example ¡

t ¡= ¡1 ¡ t ¡= ¡2 ¡

8 ¡

slide-9
SLIDE 9

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡
  • Example ¡

t ¡= ¡1 ¡ t ¡= ¡2 ¡

9 ¡

slide-10
SLIDE 10

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡
  • Example ¡

t ¡= ¡1 ¡ t ¡= ¡2 ¡

10 ¡

slide-11
SLIDE 11

1-­‑D ¡Cellular ¡Automata ¡

  • Black ¡& ¡White ¡neighbors ¡(States) ¡
  • ¡Neighborhood ¡ ¡
  • Rules ¡ ¡
  • Example ¡

t ¡= ¡1 ¡ t ¡= ¡2 ¡

11 ¡

slide-12
SLIDE 12

Wolfram ¡Code ¡

¡Every ¡cell ¡and ¡its ¡two ¡neighbors ¡will ¡be ¡one ¡of ¡the ¡ following ¡types ¡ ¡

¡ ¡ ¡ ¡ ¡Represent ¡a ¡black ¡cell ¡with ¡1 ¡and ¡a ¡white ¡cell ¡with ¡0 ¡ ¡

¡1 ¡1 ¡1 ¡ ¡ ¡ ¡1 ¡1 ¡0 ¡ ¡ ¡ ¡ ¡1 ¡0 ¡1 ¡ ¡ ¡ ¡ ¡1 ¡0 ¡0 ¡ ¡ ¡ ¡ ¡ ¡0 ¡1 ¡1 ¡ ¡ ¡ ¡ ¡0 ¡1 ¡0 ¡ ¡ ¡ ¡ ¡0 ¡0 ¡1 ¡ ¡ ¡ ¡ ¡0 ¡0 ¡0 ¡ ¡ ¡ ¡ ¡

¡ ¡ ¡ ¡ ¡Every ¡ ¡ ¡yellow ¡cell ¡above ¡can ¡be ¡filled ¡out ¡with ¡a ¡0 ¡or ¡a ¡1 ¡giving ¡a ¡ total ¡of ¡2 ¡8=256 ¡possible ¡update ¡rules. ¡

slide-13
SLIDE 13

This ¡ ¡allows ¡any ¡string ¡of ¡eight ¡0s ¡and ¡1’s ¡to ¡represent ¡ a ¡dis9nct ¡ ¡update ¡rule ¡

Example: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stephen ¡Wolfram, ¡New ¡Kind ¡of ¡Science. ¡ Notable ¡rules ¡in ¡this ¡class ¡include ¡rule ¡30, ¡rule ¡110, ¡and ¡rule ¡184. ¡ Rule ¡90 ¡is ¡also ¡interes9ng ¡because ¡it ¡creates ¡Pascal's ¡Triangle ¡ modulo ¡2. ¡ Rule ¡110 ¡is ¡known ¡to ¡be ¡Turing ¡complete. ¡This ¡implies ¡that, ¡in ¡ principle, ¡any ¡calcula9on ¡or ¡computer ¡program ¡can ¡be ¡simulated ¡ using ¡this ¡automaton. ¡ ¡

hap://en.wikipedia.org/wiki/Elementary_cellular_automaton ¡

slide-15
SLIDE 15

Rule ¡30 ¡

slide-16
SLIDE 16

Rule ¡90 ¡

slide-17
SLIDE 17

Classes ¡of ¡cellular ¡automata ¡(Wolfram) ¡

Class ¡1: ¡ader ¡a ¡finite ¡number ¡of ¡9me ¡steps, ¡the ¡CA ¡tends ¡to ¡achieve ¡a ¡ unique ¡state ¡from ¡nearly ¡all ¡possible ¡star9ng ¡condi9ons ¡(limit ¡points) ¡ Class ¡2: ¡the ¡CA ¡creates ¡paaerns ¡that ¡repeat ¡periodically ¡or ¡are ¡stable ¡ (limit ¡cycles) ¡– ¡probably ¡equivalent ¡to ¡a ¡regular ¡grammar/finite ¡state ¡ automaton ¡ Class ¡3: ¡from ¡nearly ¡all ¡star9ng ¡condi9ons, ¡the ¡CA ¡leads ¡to ¡aperiodic-­‑ chao9c ¡paaerns, ¡where ¡the ¡sta9s9cal ¡proper9es ¡of ¡these ¡paaerns ¡ are ¡almost ¡iden9cal ¡(ader ¡a ¡sufficient ¡period ¡of ¡9me) ¡to ¡the ¡star9ng ¡ paaerns ¡(self-­‑similar ¡fractal ¡curves) ¡– ¡computes ¡‘irregular ¡problems’ ¡ Class ¡4: ¡ader ¡a ¡finite ¡number ¡of ¡steps, ¡the ¡CA ¡usually ¡dies, ¡but ¡there ¡ are ¡a ¡few ¡stable ¡(periodic) ¡paaerns ¡possible ¡(e.g. ¡Game ¡of ¡Life) ¡-­‑ ¡Class ¡ 4 ¡CA ¡are ¡believed ¡to ¡be ¡capable ¡of ¡universal ¡computa9on ¡

slide-18
SLIDE 18

Conway’s ¡Game ¡of ¡Life ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡live ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡dead ¡ ¡

18 ¡

slide-19
SLIDE 19

Conway’s ¡Game ¡of ¡Life ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡live ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡dead ¡ ¡

  • 1. ¡Any ¡dead ¡cell ¡with ¡exactly ¡three ¡live ¡neighbors ¡comes ¡to ¡life. ¡

19 ¡

slide-20
SLIDE 20

Conway’s ¡Game ¡of ¡Life ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡live ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡dead ¡ ¡

  • 1. ¡Any ¡dead ¡cell ¡with ¡exactly ¡three ¡live ¡neighbors ¡comes ¡to ¡life. ¡

20 ¡

slide-21
SLIDE 21

Conway’s ¡Game ¡of ¡Life ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡live ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡dead ¡ ¡

  • 1. ¡Any ¡dead ¡cell ¡with ¡exactly ¡three ¡live ¡neighbors ¡comes ¡to ¡life. ¡

21 ¡

slide-22
SLIDE 22

22 ¡

slide-23
SLIDE 23

23 ¡

slide-24
SLIDE 24

CA ¡in ¡AthenaCL ¡

  • Standard: ¡f{s} ¡Discrete ¡cell ¡values, ¡rules ¡match ¡cell ¡

forma9ons ¡(neighborhoods) ¡ ¡

  • Totalis9c: ¡f{t} ¡Discrete ¡cell ¡values, ¡rules ¡match ¡the ¡sum ¡
  • f ¡the ¡neighborhood ¡ ¡
  • Con9nuous: ¡f{c} ¡Real-­‑number ¡cell ¡values ¡within ¡unit ¡

interval, ¡rules ¡specify ¡values ¡added ¡to ¡the ¡average ¡of ¡ previous ¡cell ¡forma9on ¡ ¡

  • Float: ¡f{f} ¡Like ¡con9nuous, ¡but ¡implemented ¡with ¡floats ¡

(it ¡makes ¡a ¡difference) ¡ ¡

slide-25
SLIDE 25

CA ¡in ¡AthenaCL ¡

  • For ¡f{s,t}: ¡the ¡k ¡value ¡provides ¡the ¡number ¡of ¡

possible ¡values ¡ ¡

  • For ¡f{c,f}: ¡the ¡k ¡value ¡is ¡zero ¡ ¡
  • r: ¡ ¡number ¡of ¡neighbor ¡cells ¡taken ¡into ¡account ¡

(neighborhood ¡= ¡2r+1) ¡

  • x: ¡size ¡of ¡CA ¡space ¡
  • y: ¡number ¡of ¡genera9ons ¡
  • sub-­‑table ¡is ¡defined ¡with ¡width ¡(w), ¡center ¡(c), ¡

and ¡skip ¡(s) ¡

  • ¡i: ¡ini9aliza9on ¡as ¡center ¡or ¡random ¡
slide-26
SLIDE 26

Examples ¡

  • auca ¡f{s} ¡380 ¡0 ¡
  • auca ¡f{s} ¡379 ¡0 ¡
  • auca ¡f{t} ¡37 ¡0 ¡
  • auca ¡f{t} ¡39 ¡0 ¡
  • auca ¡f{c} ¡.8523 ¡0 ¡
  • auca ¡f{f} ¡.254 ¡0 ¡
  • tpmap ¡100 ¡cl,f{s},12,0,fria ¡
  • auca ¡f{s} ¡12 ¡0 ¡

cl: ¡ ¡use ¡ac9ve ¡cell ¡index ¡posi9ons ¡to ¡indicate ¡ac9ve ¡posi9ons ¡of ¡a ¡scale ¡ C.1.17. ¡caList ¡(cl) ¡ ¡ fria: ¡flatRowIndexAc9ve ¡ ¡ sra: ¡sumRowAc9ve ¡

slide-27
SLIDE 27

Example ¡(cont.) ¡

emo ¡m ¡ pin ¡a ¡5@0|7@2,c2,c7 ¡ tmo ¡ha ¡ 9n ¡a ¡27 ¡ 9e ¡d0 ¡c,0 ¡ 9e ¡d1 ¡cl,f{s},30,0,fria,oc ¡ 9e ¡d2 ¡c,1 ¡ 9e ¡d3 ¡c,1 ¡ 9e ¡r ¡pt,(c,1),(c,1),(c,1),(c,1) ¡

slide-28
SLIDE 28

Crea9ng ¡a ¡direct ¡mapping ¡

  • A ¡common ¡technique ¡extracts ¡two ¡dimensional ¡data ¡from ¡

ac9ve ¡(non-­‑zero) ¡cells: ¡table ¡columns ¡are ¡treated ¡as ¡ discrete ¡pitch ¡values, ¡or ¡a ¡scale, ¡and ¡table ¡rows ¡are ¡treated ¡ as ¡discrete ¡9me ¡steps. ¡An ¡ac9ve ¡cell ¡is ¡interpreted ¡as ¡an ¡ event ¡with ¡a ¡pitch ¡specified ¡by ¡the ¡cell’s ¡column; ¡this ¡pitch ¡ is ¡sustained ¡for ¡as ¡many ¡rows ¡as ¡the ¡specific ¡column ¡is ¡

  • ac9ve. ¡

9e ¡d1 ¡cl,f{s},30,0,fria,oc ¡ 9e ¡d2 ¡cl,f{s},30,0,sra,oc ¡ 9e ¡d3 ¡cl,f{s},30,0,sra,oc ¡ tpmap ¡100 ¡cl,f{s},30,0,fria,oc ¡ tpmap ¡100 ¡cl,f{s},30,0,sra,oc ¡

slide-29
SLIDE 29

See ¡also ¡

  • F.1.20. ¡script07a.py: ¡The ¡CA ¡as ¡a ¡Generator ¡of ¡

Melodies ¡

  • F.1.21. ¡script07b.py: ¡The ¡CA ¡as ¡a ¡Generator ¡of ¡

Rhythms ¡

slide-30
SLIDE 30

Addendum: ¡Sieve ¡

  • ¡Residual ¡class ¡consists ¡of ¡two ¡integer ¡values, ¡a ¡

modulus ¡(M) ¡and ¡a ¡shid ¡(I): ¡M@I ¡

  • ¡Logic ¡operators ¡are ¡used ¡to ¡combine ¡residual ¡

classes ¡ ¡“|” ¡OR, ¡“&” ¡AND, ¡“^” ¡XOR, ¡“-­‑” ¡NOT ¡ ¡ ¡3@0 ¡= ¡ ¡[ ¡. ¡. ¡. ¡, ¡–6, ¡–3, ¡0, ¡3, ¡6, ¡. ¡. ¡. ¡] ¡ ¡3@0 ¡| ¡4@0 ¡= ¡ ¡[ ¡. ¡. ¡. ¡, ¡0, ¡3, ¡4, ¡6, ¡8, ¡9, ¡12, ¡. ¡. ¡. ¡] ¡ ¡3@0 ¡& ¡4@0 ¡= ¡ ¡[ ¡. ¡. ¡. ¡, ¡0, ¡12, ¡24, ¡. ¡. ¡. ¡] ¡ ¡3@0 ¡^ ¡4@0 ¡= ¡ ¡[ ¡. ¡. ¡. ¡, ¡–3, ¡3, ¡4, ¡6, ¡8, ¡9, ¡15, ¡. ¡. ¡. ¡] ¡

slide-31
SLIDE 31

Logic ¡vs. ¡Sets ¡

  • XOR: ¡(¬P∧Q)∨(P∧¬Q) ¡
  • Symmetric ¡Difference: ¡(A∩BC)∪(B∩AC) ¡
  • Let ¡A△B ¡denote ¡the ¡symmetric ¡difference ¡of ¡the ¡sets ¡A ¡

and ¡B. ¡Given ¡an ¡object ¡x, ¡ ¡ ¡x∈A△B⟺(x∈A) ¡XOR ¡(x∈B). ¡

  • In ¡general, ¡one ¡has ¡a ¡correspondence ¡between ¡

statements ¡in ¡set ¡theory ¡and ¡statements ¡in ¡logic, ¡e.g. ¡ ¡

  • x∈A∪B⟺(x∈A) ¡OR ¡(x∈B) ¡
  • x∈A∩B⟺(x∈A) ¡AND ¡(x∈B) ¡
  • x∈Ac⟺NOT ¡(x∈A) ¡