<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gmilburn.ca &#187; wolfram</title>
	<atom:link href="http://www.gmilburn.ca/tag/wolfram/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gmilburn.ca</link>
	<description>Essays, Projects, and Distractions of Geoff Milburn</description>
	<lastBuildDate>Sat, 12 Mar 2011 20:52:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Elementary Cellular Automata</title>
		<link>http://www.gmilburn.ca/2008/12/02/elementary-cellular-automata/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=elementary-cellular-automata</link>
		<comments>http://www.gmilburn.ca/2008/12/02/elementary-cellular-automata/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 23:23:34 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Numbers & Nature]]></category>
		<category><![CDATA[cellular automata]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wolfram]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=422</guid>
		<description><![CDATA[Oddly enough, this is not referring to an indie rock band or a Transformer - but rather to a very simple set of rules that has surprisingly complex results.]]></description>
			<content:encoded><![CDATA[<p>Simple rules can often give rise to very complex behaviour.</p>
<p><a href="http://www.gmilburn.ca/wp-content/posts/ca/index.html" target="_blank"><img src="http://www.gmilburn.ca/wp-content/media/applet.jpg" alt="applet" title="applet" width="300" height="299" class="aligncenter size-full wp-image-1103" /></a></p>
<p><em><small>Applet built using <a href="http://processing.org/">Processing</a>, Wolfram CA code example used as base. Source code available upon request. If this applet fails to load or screws up in any other way, please leave a comment with your browser version and operating system &#8211; thanks!</small></em></p>
<h2>What is this?</h2>
<p>Imagine we have a line running left to right made up of squares, and these squares can be either white or black. We then want to draw another line directly below this &#8211; but how do we do it? What rules should we use?</p>
<p>Well, we could use a very simple rule and just copy it directly.</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-duplicate.jpg" alt="eca-duplicate" title="eca-duplicate" width="486" height="193" class="aligncenter size-full wp-image-428" /></p>
<p>But that gets pretty boring. Maybe we could use a slightly more complicated rule and say if a cell used to be black, it&#8217;s now white, and vice versa.</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-invert.jpg" alt="eca-invert" title="eca-invert" width="485" height="193" class="aligncenter size-full wp-image-429" /></p>
<p>Well, it&#8217;s a bit more interesting, but not by much. What is a simple set of rules we can use that will produce more interesting behaviour? Perhaps instead of having a square rely just on the previous one, let&#8217;s have the rules depend on the previous square and its neighbors.</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-concept.jpg" alt="eca-concept" title="eca-concept" width="485" height="123" class="aligncenter size-full wp-image-432" /></p>
<p>This means we&#8217;re looking at three squares that can either be black or white. There are eight total possible combinations, shown below.</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-generic_rules.jpg" alt="eca-generic_rules" title="eca-generic_rules" width="500" height="206" class="aligncenter size-full wp-image-434" /></p>
<p>And we can decide what we want to happen when any of these situations occur. Lets try this set of rules:</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-example_ruleset.jpg" alt="eca-example_ruleset" title="eca-example_ruleset" width="500" height="206" class="aligncenter size-full wp-image-437" /></p>
<p>And see what happens when we start with a single black cell.</p>
<p><img src="http://www.gmilburn.ca/wp-content/media/eca-example.jpg" alt="eca-example" title="eca-example" width="485" height="619" class="aligncenter size-full wp-image-438" /></p>
<p>Could be interesting! It&#8217;d be a lot easier if we had more lines and squares for us to see a bigger picture of the structure produced by these rules though&#8230;</p>
<p>So that&#8217;s exactly what the application at the top of the post does. You can select whatever rules you want for the eight possible states, and toggle between a single point and random data to start by clicking on the circle in the top right.</p>
<h2>Some Interesting Rule Sets</h2>
<p>Since there are eight possible combinations that we can choose to either result in a black or a white square, there are a total of 2<sup>8</sup> = 256 possible rule combinations. A lot of these rules end up producing patterns that become very similar, and <a href="http://www.wolframscience.com/nksonline/page-57-text">it was found that there are 88 unique rules</a>, depending on your definition of unique. Here are a few interesting ones.</p>
<h3><a href="http://en.wikipedia.org/wiki/Rule_110">Rule 110</a></h3>
<p><em>random initial conditions</em><br />
<img src="http://www.gmilburn.ca/wp-content/media/rule-1.jpg" alt="rule-1" title="rule-1" width="550" height="175" class="aligncenter size-full wp-image-470" /><br />
How complex can the behaviour be from these simple rules? Well, you can use this ruleset to <a href="http://en.wikipedia.org/wiki/Turing_complete">simulate a computer</a>. You&#8217;ve got to set up the initial line of black and white squares very carefully, and it&#8217;s equally hard to read the results, but the logic ends up being exactly the same. <a href="http://xkcd.com/505/">If you had a lot of time, you could do some interesting things&#8230;</a></p>
<h3><a href="http://en.wikipedia.org/wiki/Rule_90">Rule 90</a></h3>
<p><em>single point initial condition</em><br />
<img src="http://www.gmilburn.ca/wp-content/media/rule-2.jpg" alt="rule-2" title="rule-2" width="550" height="175" class="aligncenter size-full wp-image-471" /><br />
This ruleset produces a fractal &#8211; the <a href="http://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle">Sierpinski Triangle</a> &#8211; when a single point is used to start.</p>
<h3><a href="http://en.wikipedia.org/wiki/Rule_30">Rule 30</a></h3>
<p><em>single point initial condition</em><br />
<img src="http://www.gmilburn.ca/wp-content/media/rule-3.jpg" alt="rule-3" title="rule-3" width="550" height="175" class="aligncenter size-full wp-image-472" /><br />
If you&#8217;re wondering if these things have any real world application, this rule set displays chaotic properties and is used as the random number generator for large integers in <a href="http://www.wolfram.com/">Mathematica</a>, used by millions worldwide.</p>
<h3>Rule 169</h3>
<p><em>random initial conditions</em><br />
<img src="http://www.gmilburn.ca/wp-content/media/rule-5.jpg" alt="rule-5" title="rule-5" width="550" height="175" class="aligncenter size-full wp-image-482" /><br />
I couldn&#8217;t find any information online about this, but it certainly stands out visually.</p>
<h3><a href="http://en.wikipedia.org/wiki/Rule_184">Rule 184</a></h3>
<p><em>random initial conditions</em><br />
<img src="http://www.gmilburn.ca/wp-content/media/rule-6.jpg" alt="rule-6" title="rule-6" width="550" height="175" class="aligncenter size-full wp-image-496" /><br />
This rule set can be used to model traffic flow, or deposition of particles onto an irregular surface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2008/12/02/elementary-cellular-automata/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

