<?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; mathematics</title>
	<atom:link href="http://www.gmilburn.ca/tag/mathematics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gmilburn.ca</link>
	<description>Essays, Projects, and Distractions of Geoff Milburn</description>
	<lastBuildDate>Sun, 18 Jul 2010 01:52:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Quaternion Travels</title>
		<link>http://www.gmilburn.ca/2010/05/10/quaternion-travels/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=quaternion-travels</link>
		<comments>http://www.gmilburn.ca/2010/05/10/quaternion-travels/#comments</comments>
		<pubDate>Mon, 10 May 2010 17:27:47 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[Julia]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[quaternion]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=2414</guid>
		<description><![CDATA[Relax to a slow flythrough of an interesting subset of the quaternion Julia fractals.]]></description>
			<content:encoded><![CDATA[<p>Relax to a slow flythrough of an interesting neighborhood of the quaternion Julia sets.</p>
<p><object width="571" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=11622880&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=11622880&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="571" height="321"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2010/05/10/quaternion-travels/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>In This Virtual Fish Tank, You Make the Rules</title>
		<link>http://www.gmilburn.ca/2010/03/23/in-this-virtual-fish-tank-you-make-the-rules/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=in-this-virtual-fish-tank-you-make-the-rules</link>
		<comments>http://www.gmilburn.ca/2010/03/23/in-this-virtual-fish-tank-you-make-the-rules/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 17:12:27 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Numbers & Nature]]></category>
		<category><![CDATA[boid]]></category>
		<category><![CDATA[cooperation]]></category>
		<category><![CDATA[emergence]]></category>
		<category><![CDATA[flock]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=2283</guid>
		<description><![CDATA[This simulation of a school of fish allows you to play with the weightings of three rules that cause coordinated group behavior.]]></description>
			<content:encoded><![CDATA[<p>In my last post, I discussed how <a href="http://www.gmilburn.ca/2010/03/18/herds-of-android-birds-mimic-ad-hoc-flocks/">individuals following simple rules cause cause coordinated group behavior to arise</a>. The boid model created by Craig Reynolds used three rules &#8211; alignment, separation, and coherence. But how much attention does each individual pay to each rule? In situations like migration, alignment might be the most important rule. If you&#8217;re being attacked by predators, sticking together and paying attention to the coherence rule might keep you from being eaten.</p>
<p>Clearly different situations might have different approaches. I was very interested in how different weightings of these rules might behave, so I decided to create a program that would allow you to change the relative importance of each rule at will. You can see a video of it in action below (the three sliders on the bottom left control the influence of the various rules).</p>
<p><object width="571" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=10383384&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=10383384&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="571" height="321"></embed></object></p>
<table>
<tr bgcolor="#e9e8e3">
<td align="center" width="50%">Smaller screen, older computer, or just want something more simple? <br /><big><a href="http://www.gmilburn.ca/boids/sd/" target="_blank">Load the standard definition fish school simulation.</a></big></td>
<td align="center" width="50%">Big screen, fast computer, and want to give the fish some more room to swim? <br /><big><a href="http://www.gmilburn.ca/boids/hd/" target="_blank">Load the high definition fish school simulation.</a></big></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<table>
<tr>
<td align="center"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/alignment.jpg" alt="" title="alignment" width="48" height="51" class="alignnone size-full wp-image-2296" /></td>
<td><strong>Alignment:</strong> This slider adjusts how much each fish wants to head in the same direction as other fish around it.</td>
</tr>
<tr>
<td align="center"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/cohesion.jpg" alt="" title="cohesion" width="47" height="51" class="alignnone size-full wp-image-2297" /></td>
<td><strong>Cohesion: </strong>This slider adjusts how close each fish wants to be to its neighbors.</td>
</tr>
<tr>
<td align="center"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/separation.jpg" alt="" title="separation" width="47" height="51" class="alignnone size-full wp-image-2299" /></td>
<td><strong>Separation:</strong> This slider adjust how much each fish wants to space itself out from the others.</td>
</tr>
<tr>
<td align="center"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/fish1.jpg" alt="" title="fish" width="50" height="50" class="alignnone size-full wp-image-2304" /></td>
<td>Click anywhere in the water to add a new fish.</td>
</tr>
<tr>
<td align="center"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/reset.jpg" alt="" title="reset" width="45" height="45" class="alignnone size-full wp-image-2298" /></td>
<td>Press this button to reset the simulation.</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>I hope you enjoy it &#8211; please leave me a comment if you have any questions, comments, or find any bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2010/03/23/in-this-virtual-fish-tank-you-make-the-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Golden Rule in the Wild</title>
		<link>http://www.gmilburn.ca/2010/03/05/the-golden-rule-in-the-wild/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-golden-rule-in-the-wild</link>
		<comments>http://www.gmilburn.ca/2010/03/05/the-golden-rule-in-the-wild/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:00:14 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Numbers & Nature]]></category>
		<category><![CDATA[cooperation]]></category>
		<category><![CDATA[evolution]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[puppy]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=2141</guid>
		<description><![CDATA[In the previous post, we discussed the Prisoner&#8217;s Dilemma and saw how a simple strategy called Tit-for-Tat enforced the Golden Rule and won a very interesting contest. But does Tit-for-Tat always come out on top? The most confounding thing about the strategy is that it can never win &#8211; at best, it can only tie [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/shark-300x286.jpg" alt="" title="shark" width="300" height="286" class="alignright size-medium wp-image-2144" /></p>
<p>In the previous post, we discussed the <a href="http://plato.stanford.edu/entries/prisoner-dilemma/">Prisoner&#8217;s Dilemma</a> and <a href="http://www.gmilburn.ca/2010/02/24/triumph-of-the-golden-rule/">saw how a simple strategy called Tit-for-Tat enforced the Golden Rule and won a very interesting contest</a>. But does Tit-for-Tat always come out on top? The most confounding thing about the strategy is that it can never win &#8211; at best, it can only tie other strategies. Its success came from avoiding the bloody battles that other more deceptive strategies suffered.</p>
<p>The major criticism of Axelrod&#8217;s contest is its artificiality. In real life, some may say, you don&#8217;t get to encounter everyone, interact with them, and then have a tally run at the end to determine just how you did. Perhaps more deceptive strategies would do better in a more &#8220;natural&#8221; environment where losing doesn&#8217;t mean you get another chance at another opponent, but that your failures cause you to simply die off.</p>
<h2>Artificial Nature</h2>
<p>So now let&#8217;s look at the same game, with the same scoring system, only this time there&#8217;s a twist. Assume that this contest takes place in some sort of ecosystem that can only support a certain number of organisms, and they must fight among each other for the right to reproduce. There will be many different organisms, and they will all be members of a certain species, or specific strategy. We can then construct an artificial world where these strategies can battle it out in a manner that seems to reflect the real world a bit better.</p>
<p>In order to determine supremacy, we&#8217;ll play a certain number of rounds of the game, called a generation. At the end of the generation, the scores are tallied for each strategy, and a new generation of strategies is produced &#8211; with a twist. Higher scoring strategies will produce more organisms representing them in the next generation, while lower scoring strategies will produce less. Repeat this for many generations, observe the trends, and we can see how these strategies do as part of a population that can grow and shrink, rather than a single strategy that lives forever.</p>
<p>So let&#8217;s look at an example. Suppose we have a population that consists of the following simple strategies:</p>
<table width="100%">
<tr bgcolor="#D7D6CD">
<td align="center"><strong>Initial <br />Population</strong></td>
<td><strong>Strategy</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr  bgcolor="#FBFAF9">
<td align="center">60%</td>
<td>ALL-C</td>
<td>Honest to a fault, this strategy always cooperates.</td>
</tr>
<tr  bgcolor="#e9e8e3">
<td align="center">20%</td>
<td>RAND</td>
<td>The lucky dunce, this strategy defects or cooperates at random.</td>
</tr>
<tr bgcolor="#FBFAF9">
<td align="center">10%</td>
<td>Tit-for-Tat</td>
<td>This strategy mimics the previous move of the other player, every time.</td>
</tr>
<tr bgcolor="#e9e8e3">
<td align="center">10%</td>
<td>ALL-D</td>
<td>The bad boy of the bunch, this strategy always defects.</td>
</tr>
</table>
<p>&nbsp;</p>
<p>So what will happen? Was Tit-for-Tat&#8217;s dominance a result of the structure of the contest, or is it hardier than some might think? A graph of the changing populations over 50 generations may be seen below.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/pd-graph1-560x218.jpg" alt="" title="pd-graph1" width="560" height="218" class="aligncenter size-large wp-image-2146" /></p>
<p>It&#8217;s a hard world to start. ALL-C immediately starts being decimated by the deception of ALL-D and RAND who start surging ahead, while Tit-for-Tat barely hangs on. ALL-D&#8217;s relentless deception allows it to quickly take the lead, and it starts knocking off its former partner in crime, RAND. Tit-for-Tat remains on the ropes, barely keeping its population around 10% as ALL-C and RAND are quickly eliminated around it.</p>
<p>And then something very interesting happens. ALL-D runs out of easy targets, and turns to the only opponents left &#8211; Tit-for-Tat and itself. Tit-for-Tat begins a slow climb as ALL-D begins to eat itself fighting over scraps. Slowly, steadily, Tit-for-Tat maintains its numbers by simply getting along with itself while allowing ALL-D to destroy each other. By 25 generations it&#8217;s all over &#8211; the easy resources exhausted, ALL-D was unable to adapt to the new environment and Tit-for-Tat takes over.</p>
<p>This illustrates a very important concept &#8211; that of an <a href="http://en.wikipedia.org/wiki/Evolutionarily_stable_strategy">evolutionarily stable strategy</a>. ALL-D was well on its way to winning, but left itself open to invasion by constant infighting. ALL-C initially had the highest population but was quickly eaten away by more deceptive strategies. Tit-for-Tat on the other hand was able to get along with itself, and defended itself against outside invaders that did not cooperate in turn. An evolutionarily stable strategy is something that can persist in this manner &#8211; once a critical mass of players start following it, it cannot be easily invaded or exploited by other strategies, including itself.</p>
<h2>I Can&#8217;t Hear You</h2>
<p>But there&#8217;s one critical weakness to Tit-for-Tat. We&#8217;re all aware of feuds that have gone on for ages, both sides viciously attacking the other in retaliation for the last affront, neither one precisely able to tell outsiders when it all started. And if we look at the strategies each use in a simplistic sense, it seems that they&#8217;re using Tit-for-Tat precisely. So how did it go so horribly wrong?</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/plant-park.jpg" alt="" title="plant-park" width="200" height="200" class="alignright size-full wp-image-2164" /></p>
<p>It went wrong because Tit-for-Tat has a horrible weakness &#8211; its memory is only one move long. If two Tit-for-Tat strategies somehow get stuck in a death spiral of defecting against each other, there&#8217;s no allowance in the strategy to realize this foolishness, and be the first to forgive. But how could this happen? Tit-for-Tat is never the first to defect after all, so why are both Tit-for-Tat strategies continually defecting?</p>
<p>The answer is that great force of nature, noise. A message read the wrong way, a shout misheard over the wind, an error in interpretation &#8211; all can be the impetus for this first initial defection. No matter that it was pointless and incorrect, the strategy has changed. While Tit-for-Tat&#8217;s greatest strength is that it never defects first, its greatest weakness is that it never forgives first either.</p>
<p>All of these simulations we&#8217;ve seen so far do not include noise, and it can have a catastrophic effect on the effectiveness of Tit-for-Tat. Its success was built on the strategy of never fighting among itself and allowing other deceptive strategies to destroy themselves by doing the same &#8211; but with noise, this advantage becomes a fatal weakness as Tit-for-Tat&#8217;s inability to be taken advantage of is turned against itself.</p>
<p>So what does a simulation including noise look like? You can see one below, and it contains an additional mystery strategy, Pavlov. Pavlov is very similar to Tit-for-Tat but slightly different &#8211; it forgives far more easily.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/pd-graph2-560x224.jpg" alt="" title="pd-graph2" width="560" height="224" class="aligncenter size-large wp-image-2148" /></p>
<p>We see a similar pattern to our previous simulation. ALL-D has an initial population spike as it knocks off the easy targets, but Tit-for-Tat and Pavlov slowly climb to supremacy with ALL-D eventually eating scraps. But the influence of noise causes Tit-for-Tat to fight among itself, and Pavlov begins what previously seemed impossible &#8211; to begin to win against Tit-for-Tat.</p>
<h2>Puppy Love</h2>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/03/luna-aussidoodle-puppy-300x280.jpg" alt="" title="luna-aussidoodle-puppy" width="300" height="280" class="alignright size-medium wp-image-2160" /></p>
<p>So what is Pavlov and why does it work better in a noisy environment like the real world? Well, <a href="http://en.wikipedia.org/wiki/Ivan_Pavlov">Ivan Pavlov</a> was the man who discovered <a href="http://en.wikipedia.org/wiki/Classical_conditioning">classical conditioning</a>. You probably remember him as the guy who fed dogs while ringing a bell, and who then just rang the bell &#8211; and discovered that the dogs salivated expecting food.</p>
<p>The strategy is simple &#8211; if you win, keep doing it. If you lose, change your approach. Pavlov will always cooperate with ALL-C and Tit-for-Tat. If it plays ALL-D however, it will hopefully cooperate, lose, get angry about it and defect, lose again, switch back to cooperation, and so on. Like a tiny puppy or the suitor of a crazy girlfriend, it can&#8217;t really decide what it wants to do, but it&#8217;s going to do it&#8217;s damndest to try to succeed anyways. It manages to prevent the death spiral of two Tit-for-Tat strategies continually misunderstanding each other by obeying a very simple rule &#8211; if it hurts, stop doing it. While it may be slightly more vulnerable to deceptive strategies, it never gets stuck in these self-destructive loops of behavior.</p>
<p>So there&#8217;s a lesson here &#8211; life is noisy, and people will never get everything correct all the time. Tit-for-Tat works very well for a wide variety of situations, but has a critical weakness where neither player in a conflict is willing or able to forgive. So the next time you&#8217;re in a situation like that, step back, use your head, and switch strategies &#8211; it&#8217;s what this little puppy would want you to do, anyways.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2010/03/05/the-golden-rule-in-the-wild/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Triumph of the Golden Rule</title>
		<link>http://www.gmilburn.ca/2010/02/24/triumph-of-the-golden-rule/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=triumph-of-the-golden-rule</link>
		<comments>http://www.gmilburn.ca/2010/02/24/triumph-of-the-golden-rule/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 03:35:10 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Numbers & Nature]]></category>
		<category><![CDATA[cooperation]]></category>
		<category><![CDATA[evolution]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=1846</guid>
		<description><![CDATA[Almost every decision we make involves someone else in one way or another, and we face a constant choice. Should we take advantage of them, go for the quick score and hope we never see them again - or should we settle for a more reasonable reward, co-operating in the hope that this peaceful relationship will continue long into the future?]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/02/crowd.jpg" alt="" title="crowd" width="200" height="199" class="alignright size-full wp-image-2123" /></p>
<p>We live in a world with other people. Almost every decision we make involves someone else in one way or another, and we face a constant choice regarding just how much we&#8217;re going to trust the person on the other side of this decision. Should we take advantage of them, go for the quick score and hope we never see them again &#8211; or should we settle for a more reasonable reward, co-operating in the hope that this peaceful relationship will continue long into the future?</p>
<p>We see decisions of this type everywhere, but what is less obvious is the best strategy for us to use to determine how we should act. The <a href="http://en.wikipedia.org/wiki/Ethic_of_reciprocity">Golden Rule</a> states that one should &#8220;do unto others as you would have them do unto you&#8221;. While it seems rather naive at first glance, if we run the numbers, we find something quite amazing.</p>
<h2>A Dilemma</h2>
<p>In order to study these types of decisions, we have to define what exactly we&#8217;re talking about. Let&#8217;s define just what a &#8220;dilemma&#8221; is. Let&#8217;s say it has two people &#8211; and they can individually decide to work together for a shared reward, or screw the other one over and take it all for themselves. If you both decide to work together, you both get a medium-sized reward. If you decide to take advantage of someone but they trust you, you&#8217;ll get a big reward (and the other person gets nothing). If you&#8217;re both jerks and decide to try to take advantage of each other, you both get a tiny fraction of what you could have. Let&#8217;s call these two people Alice and Bob &#8211; here&#8217;s a table to make things a bit more clear.</p>
<table>
<tr>
<td></td>
<td bgcolor="#e9e8e3"><strong><center>Alice cooperates</center></strong></td>
<td bgcolor="#FBFAF9"><strong><center>Alice defects</center></strong></td>
</tr>
<tr>
<td bgcolor="#e9e8e3"><strong>Bob cooperates</strong></td>
<td bgcolor="#D7D6CD">Everyone wins! A medium-sized reward to both for mutual co-operation</td>
<td bgcolor="#e9e8e3">Poor Bob. He decided to trust Alice, who screwed him and got a big reward. Bob gets nothing.</td>
</tr>
<tr>
<td bgcolor="#FBFAF9"><strong>Bob defects</strong></td>
<td bgcolor="#e9e8e3">Poor Alice. She decided to trust Bob, who took advantage of her and got a big reward. Alice gets nothing.</td>
<td bgcolor="#FBFAF9">No honour among thieves&#8230; both Bob and Alice take the low road, and fight over the scraps of a small reward.</p>
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF"></td>
<td bgcolor="#FFFFFF"></td>
</tr>
</td>
</tr>
</table>
<p>This specific order of rewards is referred to as the <a href="http://plato.stanford.edu/entries/prisoner-dilemma/">Prisoner&#8217;s Dilemma</a>, and was formalized and studied by Melvin Dresher and Merrill Flood in 1950 while working for the <a href="http://en.wikipedia.org/wiki/RAND">RAND Corporation</a>.</p>
<h2>Sale, One Day Only!</h2>
<p>Now of course the question is &#8211; if you&#8217;re in this situation, what is the best thing to do? First suppose that we&#8217;re never, ever going to see this other person again. This is a one time deal. Absent any moral consideration, your best option for the most profit is to attempt to take advantage of the other person and hope that they are clueless enough to let you, capitalism at its finest. You could attempt to cooperate, but that leaves you open to the other party screwing you. If each person acts in their own interest and is rational, they will attempt to one-up the other.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/02/goodevil-284x300.jpg" alt="" title="goodevil" width="284" height="300" class="alignright size-medium wp-image-2056" /></p>
<p>But there&#8217;s just one problem &#8211; if both people act in this way, they both get much less than they would if they simply cooperated. This seems very strange, as the economic models banks and other institutions use to model human behavior assume this type of logic &#8211; the model of the rational consumer. But this leads to nearly the worst possible option if both parties take this approach. </p>
<p>It seems that there is no clear ideal strategy for a one time deal. Each choice leaves you open to possible losses in different ways. At this point it&#8217;s easy to toss up your hands, leave logic behind, and take a moral stance. You&#8217;ll cooperate because you&#8217;re a good person &#8211; or you&#8217;ll take advantage of the suckers because life just isn&#8217;t fair.</p>
<p>And this appears to leave us where we are today &#8211; some good people, some bad people, and the mythical invisible hand of the market to sort them all out. But there&#8217;s just one little issue. We live in a world with reputations, with friends, and with foes &#8211; there are no true &#8220;one time&#8221; deals. The world is small, and people remember.</p>
<h2>In it for the Long Run</h2>
<p>So instead of thinking of a single dilemma, let&#8217;s think about what we should do if we get to play this game more than once. If someone screws you in the first round, you&#8217;ll remember &#8211; and probably won&#8217;t cooperate the next time. If you find someone who always cooperates, you can join them and work together for your mutual benefit &#8211; or decide that they&#8217;re an easy mark and take them for everything they&#8217;ve got.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/02/raxelrod-150x150.jpg" alt="" title="raxelrod" width="150" height="150" class="alignright size-thumbnail wp-image-2076" /></p>
<p>But what is the best strategy? In an attempt to figure this out, in 1980 <a href="http://en.wikipedia.org/wiki/Robert_Axelrod">Robert Axelrod</a> decided to have a contest. He sent the word out, and game theorists, scientists, and mathematicians all submitted entries for a battle royale to determine which strategy was the best. </p>
<p>Each entry was a computer program designed with a specific strategy for playing this dilemma multiple times against other clever entries. The programs would play this simple dilemma, deciding whether to cooperate or defect against each other, for 200 rounds. Five points for a successful deception (you defect, they cooperate), three points each for mutual cooperation, one point each if you both tried to screw each other (mutual defection), and no points if you were taken advantage of (you cooperate, they defect). Each program would play every other program as well as a copy of itself, and the program with the largest total score over all the rounds would win.</p>
<p>So what would some very simple programs be?</p>
<p><strong>ALL-C</strong> (always cooperate) is just like it sounds. Cooperation is the only way, and this program never gets tired of being an upstanding guy.</p>
<p><strong>ALL-D</strong> (always defect) is the counterpoint to this, and has one singular goal. No matter what happens, always, always, always try to screw the other person over.</p>
<p><strong>RAND</strong> is the lucky dunce &#8211; don&#8217;t worry too much, just decide to cooperate or defect at random.</p>
<p>You can predict how these strategies might do if they played against each other. Two ALL-C strategies would endlessly cooperate in a wonderful dance of mutual benefit. Two ALL-D strategies would continually fight, endlessly grinding against each other and gaining little. ALL-C pitted against ALL-D would fare about as well as a fluffy bunny in a den of wolves &#8211; eternally cooperating and hoping for reciprocation, but always getting the shaft with ALL-D profiting.</p>
<p>So an environment of ALL-C would be a cooperative utopia &#8211; unless a single ALL-D strategy came in, and started bleeding them dry. But an environment entirely made of ALL-D would be a wasteland &#8211; no one would have any success due to constant fighting. And the RAND strategy is literally no better than a coin flip.</p>
<h2>Time to Think</h2>
<p>So what should we do? Those simple strategies don&#8217;t seem to be very good at all. If we think about it however, there&#8217;s a reason they do so poorly &#8211; they don&#8217;t remember. No matter what the other side does, they&#8217;ve already made up their minds. Intelligent strategies remember previous actions of their opponents, and act accordingly. The majority of programs submitted to Axelrod&#8217;s competition incorporated some sort of memory. For instance, if you can figure out you&#8217;re playing against ALL-C, it&#8217;s time to defect. Just like in the real world, these programs tried to figure out some concept of &#8220;reputation&#8221; that would allow them to act in the most productive manner.</p>
<p>And so Axelrod&#8217;s competition was on. Programs from all over the world competed against each other, each trying to maximize their personal benefit. A wide variety of strategies were implemented from some of the top minds in this new field. Disk drives chattered, monitors flickered, and eventually a champion was crowned.</p>
<h2>And the Winner Is&#8230;</h2>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2010/02/reflection.jpg" alt="" title="reflection" width="250" height="307" class="alignright size-full wp-image-2074" /></p>
<p>When the dust settled, the winner was clear &#8211; and the victory was both surprising and inspiring. The eventual champion seemed to be a 90 lb weakling at first glance, a mere four lines of code submitted by <a href="http://en.wikipedia.org/wiki/Anatol_Rapoport">Anatol Rapoport</a>, a mathematical psychologist from the University of Toronto. It was called &#8220;Tit-for-Tat&#8221;, and it did exactly that. It started every game by cooperating &#8211; and then doing exactly what the other player did in their last turn. It cooperated with the &#8220;nice&#8221; strategies, butted heads with the &#8220;mean&#8221; strategies, and managed to come out on top ahead of far more complex approaches. </p>
<p>The simplest and shortest strategy won, a program that precisely enforced the Golden Rule. But what precisely made Tit-for-Tat so successful? Axelrod analyzed the results of the tournament and came up with a few principles of success.</p>
<ul>
<li><strong>Don&#8217;t get greedy.</strong> Tit-for-Tat can never beat another strategy. But it never allows itself to take a beating, ensuring it skips the brutal losses of two &#8220;evil&#8221; strategies fighting against each other. It actively seeks out win-win situations instead of gambling for the higher payoff.</li>
<li>&nbsp;</li>
<li><strong>Be nice.</strong> The single best predictor of whether a strategy would do well was if they were never the first to defect. Some tried to emulate Tit-for-Tat but with a twist &#8211; throwing in the occasional defection to up the score. It didn&#8217;t work.</li>
<li>&nbsp;</li>
<li><strong>Reciprocate, and forgive.</strong> Other programs tended to cooperate with Tit-for-Tat since it consistently rewarded cooperation and punished defection. And Tit-for-Tat easily forgives &#8211; no matter how many defections it has seen, if a program decides to cooperate, it will join them and reap the rewards.</li>
<li>&nbsp;</li>
<li><strong>Don&#8217;t get too clever.</strong> Tit-for-Tat is perfectly transparent, and it becomes obvious that it is very, very difficult to beat. There are no secrets, and no hypocrisy &#8211; Tit-for-Tat gets along very well with itself, unlike strategies biased toward deception.</li>
</ul>
<p>The contest attracted so much attention that a second one was organized, and this time every single entry was aware of the strategy and success of Tit-for-Tat. Sixty-three new entries arrived, all gunning for the top spot. And once again, Tit-for-Tat rose to the top. Axelrod used the results of these tournaments to develop ideas about how cooperative behaviour could evolve naturally, and eventually wrote a bestselling book called <a href="http://www.amazon.com/gp/product/0465005640?ie=UTF8&#038;tag=gmilburnca-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0465005640">The Evolution of Cooperation.</a><img src="http://www.assoc-amazon.com/e/ir?t=gmilburnca-20&#038;l=as2&#038;o=1&#038;a=0465005640" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> But his biggest accomplishment may be showing us that being nice does pay off &#8211; and giving us the numbers to prove it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2010/02/24/triumph-of-the-golden-rule/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Sierpin-Skiing</title>
		<link>http://www.gmilburn.ca/2010/02/18/sierpin-skiing/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=sierpin-skiing</link>
		<comments>http://www.gmilburn.ca/2010/02/18/sierpin-skiing/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 16:23:05 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[ski]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=2064</guid>
		<description><![CDATA[Ski lift operators have proved that it's not only conidae snails who can produce the Sierpinski triangle in their natural environment.]]></description>
			<content:encoded><![CDATA[<p>Ski lift operators have proved that it&#8217;s not only <a href="http://www.gmilburn.ca/2009/07/16/i-see-sierpinski-shapes-by-the-sea-shore/">Conidae snails</a> who can produce the <a href="http://en.wikipedia.org/wiki/Sierpinski_triangle">Sierpinski triangle</a> in their natural environment.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2010/02/sierpenskiing.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2010/02/sierpenskiing-560x345.jpg" alt="" title="sierpenskiing" width="560" height="345" class="aligncenter size-large wp-image-2065" /></a></p>
<p>While the process of creation may not be quite as elegant as the <a href="http://www.gmilburn.ca/2008/12/02/elementary-cellular-automata/">cellular automata</a> of the Conidae snail, it certainly is not lacking in effort. If you have any information on where this photo is from please leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2010/02/18/sierpin-skiing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Quaternion Bulb</title>
		<link>http://www.gmilburn.ca/2009/11/18/the-quaternion-bulb/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-quaternion-bulb</link>
		<comments>http://www.gmilburn.ca/2009/11/18/the-quaternion-bulb/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 17:35:56 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[hdtv]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=1858</guid>
		<description><![CDATA[My three dimensional unfolding of the quaternion Julia sets finally finished rendering. ]]></description>
			<content:encoded><![CDATA[<p>My three dimensional unfolding of the quaternion Julia sets finally finished rendering. There are a fair bit of compression artifacts in the embedded version, click on the Vimeo button on the bottom right side of the video to watch it in full quality HD.</p>
<p><object width="571" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7685459&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7685459&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="571" height="321"></embed></object></p>
<p>Since each quaternion can be described using four numbers, I unfolded these four dimensional quaternion Julia sets into three dimensional space, and animated the final coefficient.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/xyzft.png" alt="xyzft" title="xyzft" width="86" height="16" class="aligncenter size-full wp-image-1881" /></p>
<p>But once I did that I noticed some radial symmetry along the y-z plane &#8211; it looks like something that&#8217;s been made on a lathe. This means that we can &#8220;index&#8221; all these shapes in a more sensible manner by collapsing things along this axis of symmetry. While previously we could index all of our shapes with four coefficients a, b, c, and d.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/abcd.png" alt="abcd" title="abcd" width="63" height="16" class="aligncenter size-full wp-image-1882" /></p>
<p>We can now index them with four coefficients a, r, theta, and d after this transformation. But there&#8217;s a nice side effect now that our coordinate system reflects our symmetry &#8211; if we vary theta, the appearance of the Julia set doesn&#8217;t change, the object just appears to rotate about the a axis.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/ard.png" alt="ard" title="ard" width="151" height="16" class="aligncenter size-full wp-image-1888" /></p>
<p>So really we can index all possible shapes using only three coefficients &#8211; a, r, and d. This is awesome &#8211; it means we can use this symmetry to collapse a dimension and completely illustrate a discrete approximation of this four dimensional set in three dimensional space. The following images (click for 1080p full resolution images) illustrate the full set of these possible shapes &#8211; a is the horizontal axis, r is the vertical axis, and values iterate by 0.25. The grey sphere in the first image is the origin, and the images start at a d value of 0 and iterate upward by 0.25. We find that there exists additional symmetry with our d parameter &#8211; namely that d = -d, so we only need to illustrate the absolute value to see all shapes.</p>
<p><strong>d = 0.00</strong><br />
<a href="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.00.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.00-550x309.jpg" alt="juliacube-0.00" title="juliacube-0.00" width="550" height="309" class="aligncenter size-large wp-image-1892" /></a></p>
<p><strong>d = 0.25</strong><br />
<a href="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.25.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.25-550x309.jpg" alt="juliacube-0.25" title="juliacube-0.25" width="550" height="309" class="aligncenter size-large wp-image-1893" /></a></p>
<p><strong>d = 0.50</strong><br />
<a href="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.501.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.501-550x309.jpg" alt="juliacube-0.50" title="juliacube-0.50" width="550" height="309" class="aligncenter size-large wp-image-1895" /></a></p>
<p><strong>d = 0.75</strong><br />
<a href="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.751.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-0.751-550x309.jpg" alt="juliacube-0.75" title="juliacube-0.75" width="550" height="309" class="aligncenter size-large wp-image-1896" /></a></p>
<p><strong>d = 1.00</strong><br />
<a href="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-1.001.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/11/juliacube-1.001-550x309.jpg" alt="juliacube-1.00" title="juliacube-1.00" width="550" height="309" class="aligncenter size-large wp-image-1894" /></a></p>
<p>When d = 1.25 there are only a few bits of unconnected dust loops visible. This analysis only covers a single &#8220;slice&#8221; &#8211; namely the plane normal to (0,0,0,1). I&#8217;d be very interested to see if there are any other symmetries&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2009/11/18/the-quaternion-bulb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Quaternion Fractal Chorus</title>
		<link>http://www.gmilburn.ca/2009/10/26/a-quaternion-fractal-chorus/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-quaternion-fractal-chorus</link>
		<comments>http://www.gmilburn.ca/2009/10/26/a-quaternion-fractal-chorus/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 17:29:47 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[hdtv]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=1832</guid>
		<description><![CDATA[This undulating plane is a visualization of all quaternion Julia sets.]]></description>
			<content:encoded><![CDATA[<p>Treating my <a href="http://www.gmilburn.ca/2009/09/28/quaternion-julia-fractals/">last attempt at rendering quaternion Julia sets</a> as a study, I wanted to move on to alternate methods of visualising the deep structure of these four dimensional objects. There&#8217;s a lot of complexity there which results in some compression artifacts &#8211; <a href="http://vimeo.com/7268458?hd=1">watch it in HD to get the full effect</a>. </p>
<p><object width="571" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7268458&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7268458&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="571" height="321"></embed></object></p>
<p>There is a four dimensional Julia set for every four dimensional quaternion. We can label each quaternion using four numbers.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2009/10/quaternion.png"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/10/quaternion.png" alt="quaternion" title="quaternion" width="63" height="16" class="aligncenter size-full wp-image-1841" /></a></p>
<p>I decided to &#8220;unfold&#8221; the first two values of the quaternion onto a plane and animate the last two values. The camera is centered at (0,0) and Julia sets are placed at intervals of 0.1 off to infinity for both axes.</p>
<p><img src="http://www.gmilburn.ca/wp-content/uploads/2009/10/grid.png" alt="grid" title="grid" width="500" height="93" class="aligncenter size-full wp-image-1842" /></p>
<p>You can start to see the larger structure present more clearly. Perhaps a three dimensional unfolding next?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2009/10/26/a-quaternion-fractal-chorus/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quaternion Julia Fractals</title>
		<link>http://www.gmilburn.ca/2009/09/28/quaternion-julia-fractals/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=quaternion-julia-fractals</link>
		<comments>http://www.gmilburn.ca/2009/09/28/quaternion-julia-fractals/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 17:20:57 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[hdtv]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://www.gmilburn.ca/?p=1720</guid>
		<description><![CDATA[These beautiful shapes are three dimensional slices of four dimensional objects known as quaternion Julia sets.]]></description>
			<content:encoded><![CDATA[<p>What exactly is a quaternion Julia set? Well, it&#8217;s beautiful.</p>
<div align="center">
<object width="571" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6797740&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6797740&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="571" height="321"></embed></object>
</div>
<p>These shapes are animated projections of three dimensional slices of four dimensional objects known as <a href="http://en.wikipedia.org/wiki/Quaternion">quaternion</a> <a href="http://en.wikipedia.org/wiki/Julia_set">Julia sets</a>. The definition of a <a href="http://mathworld.wolfram.com/JuliaSet.html">Julia set</a> can get a bit complicated, but it can be thought of as an object that carves up four-dimensional space into two categories &#8211; belonging to the set, and not belonging to the set. How exactly the shape is carved depends on some very deep mathematics.</p>
<p>Now the big question &#8211; how do we look at a four dimensional object if we&#8217;re just mere three dimensional humans? Well, first let&#8217;s try to describe how we can look at a three dimensional object using only two dimensions.</p>
<p>When I think of two dimensions, I think of a flat sheet like a piece of cardboard. How could we use this flat sheet, or a lot of flat sheets, to make up a three dimensional object? Well, if we were very clever like <a href="http://www.suecrockford.com/exhibitions/detail.asp?EID=114">Yuk King Tan</a>, we could cut a huge number of cardboard sheets carefully and stack them up on top of each other. From far away it would look like a three dimensional object.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-03.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-03.jpg" alt="Tan-03" title="Tan-03" width="488" height="477" class="aligncenter size-full wp-image-1783" /></a></p>
<p>But if we look closely.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-06.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-06.jpg" alt="Tan-06" title="Tan-06" width="488" height="341" class="aligncenter size-full wp-image-1784" /></a></p>
<p>Very closely.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-07.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/09/Tan-07.jpg" alt="Tan-07" title="Tan-07" width="488" height="392" class="aligncenter size-full wp-image-1785" /></a></p>
<p>We can see that this is made up entirely of two dimensional objects cut into specific shapes, each shape cut perfectly to reflect the three dimensional object at a certain height. This is just like how an MRI machine takes &#8220;slices&#8221; of a three dimensional object (a human!) as it slowly moves upwards. The image below shows the 2D slices of the 3D skull starting just below the eyes.</p>
<p><a href="http://www.gmilburn.ca/wp-content/uploads/2009/09/mrislices.jpg"><img src="http://www.gmilburn.ca/wp-content/uploads/2009/09/mrislices.jpg" alt="mrislices" title="mrislices" width="550" height="188" class="aligncenter size-full wp-image-1734" /></a></p>
<p>If we could only see two dimensions, we could flip through each one of these images in turn to get an idea of just what a three dimensional brain looks like. This is what doctors do &#8211; all of our current display technology, fancy HDTVs included, currently only display two dimensions. So they take many two dimensional slices and then compare and visualize them in relation to each other, in order to get some idea of what our three dimensional body is actually like.</p>
<p>So we can do the same thing with these four dimensional Julia sets. We can take many three dimensional slices, animate them, and then compare and relate these slices to each other in order to create some idea in our brain of just what this four dimensional structure is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gmilburn.ca/2009/09/28/quaternion-julia-fractals/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
