You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/posts/elementary-cellular-automata/index.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -7,21 +7,21 @@ categories: ["tutorials"]
7
7
displayInList: true
8
8
author: Eitan Lees
9
9
resources:
10
-
- name: CAthumb
10
+
- name: featuredImage
11
11
src: "ca-thumb.png"
12
12
params:
13
13
description: "Rule 110"
14
-
showOnTop: true
14
+
showOnTop: false
15
15
---
16
16
17
-
[Cellular automata](https://en.wikipedia.org/wiki/Cellular_automaton) are discrete models, typically on a grid, which evolve in time. Each grid cell has a finite state, such as 0 or 1, which is updated based on a certain set of rules. A specific cell uses information of the surrounding cells, called it's _neighborhood_, to determine what changes should be made. In general cellular automata can be defined in any number of dimensions. A famous two dimensional example is [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) in which cells "live" and "die", sometimes producing beautiful patterns.
17
+
[Cellular automata](https://en.wikipedia.org/wiki/Cellular_automaton) are discrete models, typically on a grid, which evolve in time. Each grid cell has a finite state, such as 0 or 1, which is updated based on a certain set of rules. A specific cell uses information of the surrounding cells, called it's _neighborhood_, to determine what changes should be made. In general cellular automata can be defined in any number of dimensions. A famous two dimensional example is [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) in which cells "live" and "die", sometimes producing beautiful patterns.
18
18
19
19
20
20
In this post we will be looking at a one dimensional example known as [elementary cellular automaton](https://en.wikipedia.org/wiki/Elementary_cellular_automaton), popularized by [Stephen Wolfram](https://en.wikipedia.org/wiki/Stephen_Wolfram) in the 1980s.
21
21
22
22

23
23
24
-
Imagine a row of cells, arranged side by side, each of which is colored black or white. We label black cells 1 and white cells 0, resulting in an array of bits. As an example lets consider a random array of 20 bits.
24
+
Imagine a row of cells, arranged side by side, each of which is colored black or white. We label black cells 1 and white cells 0, resulting in an array of bits. As an example lets consider a random array of 20 bits.
25
25
26
26
27
27
```python
@@ -36,10 +36,10 @@ print(data)
36
36
[0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0]
37
37
38
38
39
-
To update the state of our cellular automaton we will need to define a set of rules.
39
+
To update the state of our cellular automaton we will need to define a set of rules.
40
40
A given cell \\(C\\) only knows about the state of it's left and right neighbors, labeled \\(L\\) and \\(R\\) respectively. We can define a function or rule, \\(f(L, C, R)\\), which maps the cell state to either 0 or 1.
41
41
42
-
Since our input cells are binary values there are \\(2^3=8\\) possible inputs into the function.
42
+
Since our input cells are binary values there are \\(2^3=8\\) possible inputs into the function.
43
43
44
44
45
45
```python
@@ -57,7 +57,7 @@ for i in range(8):
57
57
111
58
58
59
59
60
-
For each input triplet, we can assign 0 or 1 to the output. The output of \\(f\\) is the value which will replace the current cell \\(C\\) in the next time step. In total there are \\(2^{2^3} = 2^8 = 256\\) possible rules for updating a cell. Stephen Wolfram introduced a naming convention, now known as the [Wolfram Code](https://en.wikipedia.org/wiki/Wolfram_code), for the update rules in which each rule is represented by an 8 bit binary number.
60
+
For each input triplet, we can assign 0 or 1 to the output. The output of \\(f\\) is the value which will replace the current cell \\(C\\) in the next time step. In total there are \\(2^{2^3} = 2^8 = 256\\) possible rules for updating a cell. Stephen Wolfram introduced a naming convention, now known as the [Wolfram Code](https://en.wikipedia.org/wiki/Wolfram_code), for the update rules in which each rule is represented by an 8 bit binary number.
61
61
62
62
For example "Rule 30" could be constructed by first converting to binary and then building an array for each bit
63
63
@@ -91,7 +91,7 @@ for i in range(8):
91
91
input:111, index:0, output 0
92
92
93
93
94
-
We can define a function which maps the input cell information with the associated rule index. Essentially we are converting the binary input to decimal and adjusting the index range.
94
+
We can define a function which maps the input cell information with the associated rule index. Essentially we are converting the binary input to decimal and adjusting the index range.
95
95
96
96
97
97
```python
@@ -120,8 +120,8 @@ Finally, we can use Numpy to create a data structure containing all the triplets
Amazingly, the interacting structures which emerge from rule 110 has been shown to be capable of [universal computation](https://en.wikipedia.org/wiki/Turing_machine).
274
274
275
-
In all the examples above a random initial state was used, but another interesting case is when a single 1 is initialized with all other values set to zero.
275
+
In all the examples above a random initial state was used, but another interesting case is when a single 1 is initialized with all other values set to zero.
276
276
277
277
278
278
```python
@@ -289,6 +289,6 @@ ax.axis(False);
289
289

290
290
291
291
292
-
For certain rules, the emergent structures interact in chaotic and interesting ways.
292
+
For certain rules, the emergent structures interact in chaotic and interesting ways.
293
293
294
294
I hope you enjoyed this brief look into the world of elementary cellular automata, and are inspired to make some pretty pictures of your own.
0 commit comments