<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rod Carvalho&#039;s web notebook</title>
	<atom:link href="http://stochastix.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://stochastix.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sun, 18 Oct 2009 10:17:42 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='stochastix.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b0e76faf2071260b9a9604a2923d3591?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Rod Carvalho&#039;s web notebook</title>
		<link>http://stochastix.wordpress.com</link>
	</image>
			<item>
		<title>Logicomix</title>
		<link>http://stochastix.wordpress.com/2009/09/27/logicomix/</link>
		<comments>http://stochastix.wordpress.com/2009/09/27/logicomix/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 11:32:09 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Great Thinkers]]></category>
		<category><![CDATA[Alecos Papadatos]]></category>
		<category><![CDATA[Annie Di Donna]]></category>
		<category><![CDATA[Apostolos Doxiadis]]></category>
		<category><![CDATA[Bertrand Russell]]></category>
		<category><![CDATA[Christos Papadimitriou]]></category>
		<category><![CDATA[Foundations of Mathematics]]></category>
		<category><![CDATA[Logicomix]]></category>
		<category><![CDATA[Mathematical Logic]]></category>
		<category><![CDATA[Philosophy]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4620</guid>
		<description><![CDATA[It cannot be a complete coincidence that several outstanding logicians of the 20th century found shelter in asylums at some time in their lives.
-Gian-Carlo Rota (1932-1999)
Logicomix: an Epic Search for Truth is an ambitious and highly original graphic novel on the heroic quest to make the foundations of Mathematics exact, consistent, and complete. The narrator [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4620&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="padding-left:150px;"><em>It cannot be a complete coincidence that several outstanding logicians of the 20th century found shelter in asylums at some time in their lives.</em></p>
<p style="padding-left:150px;">-<a href="http://en.wikipedia.org/wiki/Gian-Carlo_Rota" target="_blank">Gian-Carlo Rota</a> (1932-1999)</p>
<p><a href="http://www.logicomix.com" target="_blank">Logicomix: an Epic Search for Truth</a> is an ambitious and highly original graphic novel on the heroic quest to make the foundations of Mathematics exact, consistent, and complete. The narrator and protagonist of the story is the great logician and philosopher <a href="http://en.wikipedia.org/wiki/Bertrand_Russell" target="_blank">Bertrand Russell</a>. Some of the other characters are <a href="http://en.wikipedia.org/wiki/David_Hilbert" target="_blank">David Hilbert</a>, <a href="http://en.wikipedia.org/wiki/Henri_Poincar%C3%A9" target="_blank">Henri Poincaré</a>, <a href="http://en.wikipedia.org/wiki/Georg_Cantor" target="_blank">Georg Cantor</a>, <a href="http://en.wikipedia.org/wiki/Frege" target="_blank">Gottlob Frege</a>, <a href="http://en.wikipedia.org/wiki/Alfred_Whitehead" target="_blank">Alfred North Whitehead</a>, <a href="http://en.wikipedia.org/wiki/Kurt_G%C3%B6del" target="_blank">Kurt Gödel</a>, <a href="http://en.wikipedia.org/wiki/Ludwig_Wittgenstein" target="_blank">Ludwig Wittgenstein</a>, and <a href="http://en.wikipedia.org/wiki/Von_Neumann" target="_blank">John von Neumann</a>. It is a book about ideas, passions, and madness.</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/09/logicomix.jpg"><img class="size-full wp-image-4621 aligncenter" style="border:1px solid black;" title="Logicomix" src="http://stochastix.files.wordpress.com/2009/09/logicomix.jpg?w=305&#038;h=425" alt="Logicomix" width="305" height="425" /></a></p>
<p style="text-align:center;">[ image courtesy of <a href="http://www.logicomix.com/" target="_blank">Logicomix</a> ]</p>
<p>The novel was written by <a href="http://www.apostolosdoxiadis.com" target="_blank">Apostolos Doxiadis</a> and <a href="http://en.wikipedia.org/wiki/Christos_Papadimitriou" target="_blank">Christos Papadimitriou</a>. Alecos Papadatos did the drawings, and Annie Di Donna added color to them. Here are some videos on the making of <a href="http://www.logicomix.com/" target="_blank">Logicomix</a>:</p>
<p style="text-align:center;">[ <a href="http://www.youtube.com/watch?v=Gbx9M-n7nCU" target="_blank">part 1</a> | <a href="http://www.youtube.com/watch?v=6x-xDiXzVHE" target="_blank">part 2</a> | <a href="http://www.youtube.com/watch?v=O1638wSsi-8" target="_blank">part 3</a> ]</p>
<p>If you happen to be interested in this topic, I would suggest you read Greg Chaitin&#8217;s nice essay on <a href="http://www.cs.auckland.ac.nz/~chaitin/amsci.pdf" target="_blank">Computers, Paradoxes and the Foundations of Mathematics</a> [pdf].</p>
<p style="text-align:center;">__________</p>
<p>Reviews:</p>
<ul>
<li><a href="http://www.guardian.co.uk/books/2009/apr/27/graphic-novel-logicomix-bertrand-russell" target="_blank">Bertrand Russell&#8217;s mathematical quest adds up to unlikely graphic novel hit</a></li>
</ul>
<ul>
<li><a href="http://www.independent.co.uk/arts-entertainment/books/features/bertrand-russell-the-thinking-persons-superhero-1780185.html" target="_blank">Bertrand Russell: the thinking person&#8217;s superhero</a></li>
</ul>
<ul>
<li><a href="http://www.comicmix.com/news/2009/09/11/review-logicomix-the-sorrows-of-young-bertie-and-the-great-quest/" target="_blank">The sorrows of young Bertie, and the great quest</a></li>
</ul>
<ul>
<li><a href="http://www.guardian.co.uk/books/2009/oct/03/logicomix-alex-bellos-review" target="_blank">Mathematics has never been so exciting</a></li>
</ul>
<ul>
<li><a href="http://www.nytimes.com/2009/09/27/books/review/Holt-t.html" target="_blank">Algorithm and Blues</a></li>
</ul>
<ul>
<li><a href="http://www.spectator.co.uk/books/5380766/truth-for-beginners.thtml" target="_blank">Truth for beginners<br />
</a></li>
</ul>
Posted in Art, Books, Great Thinkers Tagged: Alecos Papadatos, Annie Di Donna, Apostolos Doxiadis, Bertrand Russell, Christos Papadimitriou, Foundations of Mathematics, Logicomix, Mathematical Logic, Philosophy <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4620/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4620&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/09/27/logicomix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/09/logicomix.jpg" medium="image">
			<media:title type="html">Logicomix</media:title>
		</media:content>
	</item>
		<item>
		<title>Automated generation of machining sequences</title>
		<link>http://stochastix.wordpress.com/2009/09/18/automated-generation-of-machining-sequences/</link>
		<comments>http://stochastix.wordpress.com/2009/09/18/automated-generation-of-machining-sequences/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 08:06:58 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Expert Systems]]></category>
		<category><![CDATA[Machine Tools]]></category>
		<category><![CDATA[Machining]]></category>
		<category><![CDATA[Machining Sequences]]></category>
		<category><![CDATA[Manufacturing Technology]]></category>
		<category><![CDATA[Metalworking]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=2946</guid>
		<description><![CDATA[When I was an undergraduate student I took a course on Machining. I did not enjoy to study the details of how various machine tools are built or how they work, but I had a lot of fun creating machining sequences, which required ingenuity. The regular visits to the machine shop were also fun. After [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=2946&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When I was an undergraduate student I took a course on <a href="http://en.wikipedia.org/wiki/Machining" target="_blank">Machining</a>. I did not enjoy to study the details of how various <a href="http://en.wikipedia.org/wiki/Machine_tool" target="_blank">machine tools</a> are built or how they work, but I had a lot of fun creating machining sequences, which required ingenuity. The regular visits to the machine shop were also fun. After all, it&#8217;s not everyday that one gets to see an object taking shape right before one&#8217;s eyes :-)</p>
<p>The instructor would give us a certain mechanical part and ask us to come up with a machining sequence for it. If you are not acquainted with <em>machinist&#8217;s jargon</em>, here&#8217;s a definition:</p>
<p style="padding-left:30px;"><strong><span style="text-decoration:underline;">Definition</span>:</strong> a <em>machining sequence</em> is a sequence of <a href="http://en.wikipedia.org/wiki/Machining" target="_blank">machining</a> operations (such as turning, drilling, milling, boring, broaching, etc) that remove material from, say, an aluminium block in order to obtain a desired object (such as a piston or a cylinder for a car engine).</p>
<p>Note that <a href="http://en.wikipedia.org/wiki/Machining" target="_blank">machining</a> is about removing material, i.e., it&#8217;s a <span style="text-decoration:underline;">subtractive</span> technology. By contrast, <a href="http://en.wikipedia.org/wiki/Rapid_prototyping" target="_blank">rapid prototyping</a> is an <span style="text-decoration:underline;">additive</span> technology.</p>
<p>Let us consider an example. Suppose I give you the following <a href="http://shapes.aimatshape.net/view.php?id=206" target="_blank">3D model</a>:</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/09/3d-model.jpg"><img class="alignnone size-full wp-image-4573" title="3d-model" src="http://stochastix.files.wordpress.com/2009/09/3d-model.jpg?w=450&#038;h=401" alt="3d-model" width="450" height="401" /></a></p>
<p>What <span style="text-decoration:underline;">machining sequence</span> would you propose? Here&#8217;s my proposal:</p>
<ol>
<li>Start with a crude block of aluminium.</li>
<li>Given the object&#8217;s rotational symmetry about the longitudinal axis, use the <a href="http://en.wikipedia.org/wiki/Lathe_%28tool%29" target="_blank">lathe</a> to shape the cylindrical / conical parts. Use the lathe also to drill the central hole along the longitudinal axis.</li>
<li>Note that the surface of the central hole is not smooth. It has &#8220;teeth&#8221;. I would say that a combined <a href="http://en.wikipedia.org/wiki/Lathe_%28tool%29" target="_blank">lathe</a> / <a href="http://en.wikipedia.org/wiki/Broach_%28metalwork%29" target="_blank">broach</a> would allow one to obtain the &#8220;teeth&#8221;.</li>
<li><a href="http://en.wikipedia.org/wiki/Drilling" target="_blank">Drill</a> 6 holes at the base.</li>
<li>Use a <a href="http://en.wikipedia.org/wiki/Milling_machine" target="_blank">milling machine</a> to remove material at the base, in between the 6 holes.</li>
</ol>
<p>Here&#8217;s a sketchy illustration of the machining sequence I proposed, where a machine tool is assigned to various sections of the object being fabricated:</p>
<p><a href="http://stochastix.files.wordpress.com/2009/09/machining-operations.jpg"><img class="size-full wp-image-4557 aligncenter" title="machining operations" src="http://stochastix.files.wordpress.com/2009/09/machining-operations.jpg?w=449&#038;h=318" alt="machining operations" width="449" height="318" /></a></p>
<p>I am not an experienced machinist, and I make no claims that the machining sequence I have just proposed is any good. If you have ideas, feel free to share.</p>
<p>Suppose you have a 3D model of some object you would like to fabricate via machining. An experienced machinist is able to visualize the object and devise a machining sequence. Could a computer be taught to do the same?</p>
<p style="padding-left:30px;"><strong><span style="text-decoration:underline;">Problem</span>:</strong> develop algorithms that, given a 3D model of some object, automatically generate machining sequences. These algorithms should determine which machining operations to use, and in which order.</p>
<p>The machining sequence to be carried out is a function of the geometry and the topology of the object to be fabricated. Hence, algorithms that automatically generate machining sequences would have to &#8220;understand&#8221; the geometry and the topology of the given 3D model. This suggests that ideas from <a href="http://en.wikipedia.org/wiki/Computational_geometry" target="_blank">Computational Geometry</a> and <a href="http://en.wikipedia.org/wiki/Computational_topology" target="_blank">Computational Topology</a> could perhaps be applied in this particular problem. For example, if the object to be fabricated has cylindrical holes in it, then it&#8217;s likely that one should use a drill or a lathe. These holes are a geometrical / topological property of the object. How can a computer be taught to understand them?</p>
<p>Furthermore, there probably is more than one possible machining sequence to fabricate the desired object from the same crude block of metal. If there are many possible machining sequences, then one can start thinking of <em>optimality</em>. Some possible optimality criteria would be to minimize the <span style="text-decoration:underline;">total number of operations</span>, or to minimize the <span style="text-decoration:underline;">total fabrication time</span>, for example. Can you think of other criteria? Given one optimality criterion, one can then try to find the &#8220;best&#8221; machining sequence.</p>
<p>I wonder if <a href="http://en.wikipedia.org/wiki/Machine_learning" target="_blank">Machine Learning</a> could help, too. Give the same 3D model to an experienced machinist and to the software system we&#8217;re developing. Both devise machining sequences. The human will probably beat the computer. Feed the computer with the machining sequence devised by the human. Repeat this procedure many times. Iterate until one has obtained a skilled &#8220;machining <a href="http://en.wikipedia.org/wiki/Expert_system" target="_blank">expert system</a>&#8220;. The ingenuity and creativity required to transform crude blocks of metal into beautifully machined parts would be emulated by algorithms. I make no claims that this would be easy to implement ;-)</p>
<p>I looked for work on this area. I found a few patents [1]-[5], and a bunch of technical papers [6]-[12] dedicated to this problem. Interestingly, most patents I found on this topic were filed by Japanese. This should come as no surprise. After all, the Japanese are notoriously good at optimizing manufacturing processes.</p>
<p>This post is admittedly vague. I propose a problem, but I do not present any sketch of a solution. Basically, I wanted to share my thoughts in order to invite constructive discussion. Any ideas?</p>
<p style="text-align:center;">__________</p>
<p><strong>References</strong></p>
<p style="padding-left:30px;">[1] Hajimu Kishi, Masaki Seki, Kunio Tanaka, Teruyuki Matsumura, <a href="http://www.google.com/patents/about?id=2y03AAAAEBAJ" target="_blank"><em>Automatic machining process determination method in an automatic programming system</em></a>, U.S. patent #4723203. Filed: 1985 / Issued: 1988.</p>
<p style="padding-left:30px;">[2] Koichi Asakura, <a href="http://www.google.com/patents/about?id=FPYsAAAAEBAJ" target="_blank">Machine tool with tool selection and work sequence determination</a>, U.S. patent #4739488. Filed: 1985 / Issued: 1988.</p>
<p style="padding-left:30px;">[3] Yasushi Fukaya, Yuto Mizukami, <a href="http://www.google.com/patents/about?id=LSQmAAAAEBAJ" target="_blank"><em>Method for determining a machining method in numerical control information generating apparatus</em></a>, U.S. patent #5107414. Filed: 1989 / Issued: 1992.</p>
<p style="padding-left:30px;">[4] Kotaro Watanabe, <a href="http://www.google.com/patents/about?id=eLQgAAAAEBAJ" target="_blank"><em>CAD/CAM unit data generating apparatus and process</em></a>, U.S. patent #5297022. Filed: 1992 / Issued: 1994.</p>
<p style="padding-left:30px;">[5] Takashi Takegahara, Shigetoshi Takagi, Koji Suzuki, <a href="http://www.google.com/patents/about?id=XGJ9AAAAEBAJ" target="_blank"><em>Machining sequence determining method and apparatus for wire-cut electric discharge machining and computer readable medium storing a machining sequence determining program</em></a>, U.S. patent #6445972. Filed: 1999 / Issued: 2002.</p>
<p style="padding-left:30px;">
<p style="padding-left:30px;">[6] In-Ho Kim, Jung-Soo Oh and Kyu-Kab Cho, <a href="http://dx.doi.org/10.1016/S0360-8352%2896%2900226-4" target="_blank"><em>Computer aided setup planning for machining processes</em></a>, Computers &amp; Industrial Engineering, 18th International Conference on Computers and Industrial Engineering, Vol. 31, Issues 3-4, pp. 613-617, December 1996.</p>
<p style="padding-left:30px;">[7] Z. Gu, Y.F. Zhang, A.Y.C. Nee, <a href="http://www.informaworld.com/smpp/content%7Econtent=a713843553" target="_blank">Identification of important features for machining operations sequence generation</a>, International Journal of Production Research, Vol. 35, Issue 8, pp. 2285-2308, August 1997.</p>
<p style="padding-left:30px;">[8] Majid Tolouei-Rad, <em><a href="http://www.informaworld.com/smpp/content%7Econtent=a713982101" target="_blank">An efficient algorithm for automatic machining sequence planning in milling operations</a>,</em> International Journal of Production Research, Vol. 41, Issue 17, pp. 4115-4131, November 2003.</p>
<p style="padding-left:30px;">[9] W.D. Li, S. K. Ong, A.Y.C. Nee, <a href="http://www.informaworld.com/smpp/content%7Econtent=a713758578" target="_blank"><em>Optimization of process plans using a constraint-based tabu search approach</em></a>, International Journal of Production Research, Vol. 42, Issue 10, pp. 1955-1985, May 2004.</p>
<p style="padding-left:30px;">[10] D. Kingsly Jeba Singh, C. Jebaraj, <a href="http://www.informaworld.com/smpp/content%7Econtent=a714593108" target="_blank"><em>Feature-based design for process planning of machining processes with optimization using genetic algorithms</em></a>, International Journal of Production Research, Vol. 43, Issue 18, pp. 3855-3887, September 2005.</p>
<p style="padding-left:30px;">[11] L. Wang, N. Cai, H.-Y. Feng, Z. Liu, <a href="http://www.informaworld.com/smpp/content%7Econtent=a741555301" target="_blank"><em>Enriched machining feature-based reasoning for generic machining process sequencing</em></a>, International Journal of Production Research, Vol. 44, Issue 8, pp 1479-1501, April 2006.</p>
<p style="padding-left:30px;">[12] Rezo Aliyev, <a href="http://portal.acm.org/citation.cfm?id=1357507" target="_blank"><em>A strategy for selection of the optimal machining sequence in high speed milling process</em></a>, International Journal of Computer Applications in Technology, Vol. 27, Issue 1, pp. 72-82, September 2006.</p>
Posted in Technology Tagged: Expert Systems, Machine Tools, Machining, Machining Sequences, Manufacturing Technology, Metalworking <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/2946/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/2946/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/2946/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/2946/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/2946/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/2946/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/2946/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/2946/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/2946/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/2946/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=2946&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/09/18/automated-generation-of-machining-sequences/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/09/3d-model.jpg" medium="image">
			<media:title type="html">3d-model</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/09/machining-operations.jpg" medium="image">
			<media:title type="html">machining operations</media:title>
		</media:content>
	</item>
		<item>
		<title>Interviews with Carver Mead</title>
		<link>http://stochastix.wordpress.com/2009/09/09/interviews-with-carver-mead/</link>
		<comments>http://stochastix.wordpress.com/2009/09/09/interviews-with-carver-mead/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 05:21:29 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Carver Mead]]></category>
		<category><![CDATA[Inventors]]></category>
		<category><![CDATA[Technologists]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/2007/12/17/an-interview-with-carver-mead/</guid>
		<description><![CDATA[To understand reality, you have to understand how things work. If you do that, you can start to do engineering with it, build things. And if you can’t, whatever you’re doing probably isn’t good science. To me, engineering and science aren’t separate endeavors.
-Carver Mead
Prof. Carver Mead (b. 1934) has made major contributions to solid-state electronics, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=1416&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="padding-left:150px;"><em>To understand reality, you have to understand how things work. If you do that, you can start to do engineering with it, build things. And if you can’t, whatever you’re doing probably isn’t good science. To me, engineering and science aren’t separate endeavors.</em></p>
<p style="padding-left:150px;">-Carver Mead</p>
<p>Prof. <a href="http://en.wikipedia.org/wiki/Carver_Mead" target="_blank">Carver Mead</a> (b. 1934) has made major contributions to solid-state electronics, such as his work on “electron tunneling” and building the first <a href="http://en.wikipedia.org/wiki/Gallium_arsenide" target="_blank">GaAs</a> <a href="http://en.wikipedia.org/wiki/MESFET" target="_blank">MESFET</a>.</p>
<p><a href="http://stochastix.files.wordpress.com/2007/12/carver-mead-2002.jpg"><img class="size-full wp-image-4519 aligncenter" style="border:1px solid black;" title="Carver Mead" src="http://stochastix.files.wordpress.com/2007/12/carver-mead-2002.jpg?w=200&#038;h=250" alt="Carver Mead" width="200" height="250" /></a></p>
<p>Here are a couple of interesting interviews with Carver Mead:</p>
<ul>
<li><a href="http://oralhistories.library.caltech.edu/133" target="_blank">Interview with Carver A. Mead</a> (Caltech &#8211; July 17, 1996): in this interview Mead talks about his childhood in California, how he got interested in electrical apparatuses and radios at a tender age, his undergraduate years at Caltech, how he started working in solid-state electronics, fundamental research, technology transfer, etc.</li>
</ul>
<ul>
<li><a href="http://www.technologyreview.com/Infotech/13755/" target="_blank">Carver Mead&#8217;s natural inspiration</a> (Technology Review, Sept. 2004): Mead talks about science and engineering, his way of doing research, the startups he helped get off the ground, the business of technology, &#8220;demand pull&#8221; versus “technology push”, neuromorphic electronic systems, etc. A PDF copy of this interview can be found <a href="http://www.lloydwatts.com/carver_MIT_2004.pdf" target="_blank">here</a>.</li>
</ul>
<p style="text-align:center;">__________</p>
<p>Related:</p>
<ul>
<li><a href="http://web.mit.edu/invent/iow/mead2.html" target="_blank">Inventor of the week: Carver Mead</a></li>
</ul>
<ul>
<li><a href="http://web.mit.edu/invent/a-winners/a-mead.html" target="_blank">Carver Mead: 1999 Lemelson-MIT Prize Winner</a></li>
</ul>
<ul>
<li><a href="http://electronicdesign.com/Articles/Index.cfm?AD=1&amp;AD=1&amp;ArticleID=8683" target="_blank">Carver Mead: a trip through four eras of innovation</a> (2004)</li>
</ul>
<ul>
<li><a href="http://one.caltech.edu/news/cu/Summer_06/mead" target="_blank">Carver Mead: looking to the future</a> (2006)</li>
</ul>
Posted in Electronics, Technology Tagged: Carver Mead, Inventors, Technologists <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/1416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/1416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/1416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/1416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/1416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/1416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/1416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/1416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/1416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/1416/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=1416&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/09/09/interviews-with-carver-mead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2007/12/carver-mead-2002.jpg" medium="image">
			<media:title type="html">Carver Mead</media:title>
		</media:content>
	</item>
		<item>
		<title>Are we running out of helium?</title>
		<link>http://stochastix.wordpress.com/2009/09/02/are-we-running-out-of-helium/</link>
		<comments>http://stochastix.wordpress.com/2009/09/02/are-we-running-out-of-helium/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 07:01:12 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Helium]]></category>
		<category><![CDATA[Helium-3]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4495</guid>
		<description><![CDATA[Contrary to popular belief, helium is not used only to inflate party balloons. Given that helium is inert, it is used to create nonreactive atmospheres in semiconductor fabrication and in arc welding, for instance. However, the most important industrial application of this noble gas is probably in cryogenics. Liquid helium is used to cool infrared [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4495&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Contrary to popular belief, <a href="http://en.wikipedia.org/wiki/Helium" target="_blank">helium</a> is not used only to inflate party balloons. Given that <a href="http://en.wikipedia.org/wiki/Helium" target="_blank">helium</a> is inert, it is used to create nonreactive atmospheres in semiconductor fabrication and in arc welding, for instance. However, the most important industrial application of this noble gas is probably in <a href="http://en.wikipedia.org/wiki/Cryogenics" target="_blank">cryogenics</a>. Liquid helium is used to cool infrared sensors, nuclear reactors, and superconducting magnets (for example, in <a href="http://en.wikipedia.org/wiki/Magnetic_resonance_imaging" target="_blank">MRI</a> equipment). Helium is also used for leak detection, and as a gain medium in <a href="http://en.wikipedia.org/wiki/Helium%E2%80%93neon_laser" target="_blank">He-Ne lasers</a>.</p>
<p>Helium is the 2nd most abundant element in the universe, right after hydrogen. Helium is produced in stars by <a href="http://en.wikipedia.org/wiki/Nuclear_fusion" target="_blank">nuclear fusion</a>:</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/09/deuterium-tritium-fusion.png"><img class="size-full wp-image-4496 aligncenter" title="Deuterium-Tritium Fusion" src="http://stochastix.files.wordpress.com/2009/09/deuterium-tritium-fusion.png?w=260&#038;h=300" alt="Deuterium-Tritium Fusion" width="260" height="300" /></a></p>
<p style="text-align:center;">[ <a href="http://en.wikipedia.org/wiki/File:Deuterium-tritium_fusion.svg" target="_blank">source</a> ]</p>
<p>On Earth, the <a href="http://en.wikipedia.org/wiki/Helium-4" target="_blank">helium-4</a> isotope is by far the most abundant, a byproduct of millions of years of <a href="http://en.wikipedia.org/wiki/Alpha_decay" target="_blank">alpha decay</a> of uranium and thorium (note that the nucleus of helium-4 is the same as the one of an <a href="http://en.wikipedia.org/wiki/Alpha_particle" target="_blank">alpha particle</a>). Helium is extracted during the refining of natural gas. If it&#8217;s not extracted during this refining process, it soars off and is forever lost.</p>
<p>Since <a href="http://en.wikipedia.org/wiki/Nuclear_fusion" target="_blank">nuclear fusion</a> technology is still decades away and given that <a href="http://en.wikipedia.org/wiki/Alpha_decay" target="_blank">alpha decay</a> is an extremely slow process, industrial production of helium is indeed very far from becoming a reality. We will need to keep extracting helium from natural gas reserves. The problem is that helium reserves may be depleted within the next decade [1][2]. Once that happens, where will we get the helium demanded by high-tech industries?</p>
<p>If helium becomes a sought-after commodity, then the same companies that extract natural gas will have an economic incentive to extract helium as well, instead of letting it escape to the atmosphere. However, helium is a non-renewable resource. Sooner or later, we will deplete the reserves that have built up over millions and millions of years.</p>
<p>The Sun produces colossal amounts of helium by <a href="http://en.wikipedia.org/wiki/Nuclear_fusion" target="_blank">nuclear fusion</a>. In fact, helium is named after <em><a href="http://en.wikipedia.org/wiki/Helios" target="_blank">Helios</a></em>, the Greek god who personified the Sun (helium was first found in the Sun). Harvesting helium from the Sun is impossible, however. At least directly. A possibility would be to harvest <a href="http://en.wikipedia.org/wiki/Helium-3" target="_blank">helium-3</a> (to serve as fuel for fusion reactors) from moon rocks [3][4][5], where it can be found due to billions of years of bombardment by the solar wind. If the idea of mining the Moon sounds insane to you, please note that <a href="http://en.wikipedia.org/wiki/Harrison_Schmitt" target="_blank">Harrison Schmitt</a> (geologist and Apollo 17 astronaut) is one of the proponents.</p>
<p>Is the Moon the <em><a href="http://en.wikipedia.org/wiki/El_Dorado" target="_blank">El Dorado</a></em> of helium-3? I don&#8217;t know, but I have heard rumors that India and China are developing robotic systems to harvest helium-3 from moon rocks. It seems that Space is the next frontier in the race for natural resources. What next? Will we be mining asteroids to extract <a href="http://en.wikipedia.org/wiki/Platinum" target="_blank">platinum</a> for fuel cells?</p>
<p style="text-align:center;">__________</p>
<p><strong>References:</strong></p>
<p style="padding-left:30px;">[1]  Emily Jenkins, <em><a href="http://www.wired.com/wired/archive/8.08/helium.html" target="_blank">A Helium Shortage?</a></em>, Wired Magazine, Aug. 2000.</p>
<p style="padding-left:30px;">[2] Laura Deakin, <em><a href="http://pubs.acs.org/subscribe/archive/ci/31/i06/html/06chem.html" target="_blank">The coming helium shortage</a></em>, Chemical Innovation, June 2001.</p>
<p style="padding-left:30px;">[3] Harrison Schmitt, <a href="http://www.popularmechanics.com/science/air_space/1283056.html" target="_blank"><em>Mining the Moon</em></a>, Popular Mechanics, Oct. 2004.</p>
<p style="padding-left:30px;">[4] John Lasker, <em><a href="http://www.wired.com/science/space/news/2006/12/72276" target="_blank">Race to the Moon for Nuclear Fuel</a></em>, Wired Magazine, 2006.</p>
<p style="padding-left:30px;">[5] Mark Williams, <em><a href="http://www.technologyreview.com/Energy/19296/" target="_blank">Mining the Moon</a></em>, Technology Review, Aug. 2007.</p>
<p style="padding-left:30px;">
Posted in Uncategorized Tagged: Helium, Helium-3 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4495/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4495/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4495/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4495&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/09/02/are-we-running-out-of-helium/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/09/deuterium-tritium-fusion.png" medium="image">
			<media:title type="html">Deuterium-Tritium Fusion</media:title>
		</media:content>
	</item>
		<item>
		<title>Dangerous Knowledge</title>
		<link>http://stochastix.wordpress.com/2009/09/01/dangerous-knowledge/</link>
		<comments>http://stochastix.wordpress.com/2009/09/01/dangerous-knowledge/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 13:53:03 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Great Thinkers]]></category>
		<category><![CDATA[Alan Turing]]></category>
		<category><![CDATA[Foundations of Mathematics]]></category>
		<category><![CDATA[Georg Cantor]]></category>
		<category><![CDATA[Kurt Gödel]]></category>
		<category><![CDATA[Ludwig Boltzmann]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4473</guid>
		<description><![CDATA[Bring vor, was wahr ist.
Schreib so, dass es klar ist.
Und verficht&#8217;s, bis es mit dir gar ist.
-Ludwig Boltzmann
Dangerous Knowledge is a 90-minute long BBC documentary about the lives of four great thinkers: Georg Cantor (1845-1918), Ludwig Boltzmann (1844-1906), Kurt Gödel (1906-1978), and Alan Turing (1912-1954). Cantor founded Set Theory, Boltzmann founded Statistical Mechanics, Gödel&#8217;s incompleteness [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4473&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="padding-left:210px;"><em>Bring vor, was wahr ist.<br />
Schreib so, dass es klar ist.<br />
Und verficht&#8217;s, bis es mit dir gar ist.</em></p>
<p style="padding-left:210px;">-<a href="http://en.wikipedia.org/wiki/Boltzmann" target="_blank">Ludwig Boltzmann</a></p>
<p><a href="http://www.bbc.co.uk/bbcfour/documentaries/features/dangerous-knowledge.shtml" target="_blank">Dangerous Knowledge</a> is a 90-minute long BBC documentary about the lives of four great thinkers: <a href="http://en.wikipedia.org/wiki/Georg_Cantor" target="_blank">Georg Cantor</a> (1845-1918), <a href="http://en.wikipedia.org/wiki/Boltzmann" target="_blank">Ludwig Boltzmann</a> (1844-1906), <a href="http://en.wikipedia.org/wiki/Godel" target="_blank">Kurt Gödel</a> (1906-1978), and <a href="http://en.wikipedia.org/wiki/Alan_Turing" target="_blank">Alan Turing</a> (1912-1954). Cantor founded <a href="http://en.wikipedia.org/wiki/Set_theory" target="_blank">Set Theory</a>, Boltzmann founded <a href="http://en.wikipedia.org/wiki/Statistical_mechanics" target="_blank">Statistical Mechanics</a>, Gödel&#8217;s <a href="http://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems" target="_blank">incompleteness theorems</a> had an immense impact on Mathematical Logic, and Turing was one of the fathers of Computer Science. Why these four scientists? What is the pattern? The answer is that all four of them committed suicide.</p>
<p><a href="http://stochastix.files.wordpress.com/2009/09/cantor-boltzmann-godel-turing.jpg"></a><a href="http://stochastix.files.wordpress.com/2009/09/cantor-boltzmann-godel-turing-small.jpg"><img class="size-full wp-image-4493 aligncenter" title="Cantor Boltzmann Gödel Turing" src="http://stochastix.files.wordpress.com/2009/09/cantor-boltzmann-godel-turing-small.jpg?w=450&#038;h=429" alt="Cantor Boltzmann Gödel Turing" width="450" height="429" /></a></p>
<p>The documentary is a bit too sensationalist for my taste. Its message is that these four brilliant minds were driven to madness (and, ultimately, to suicide) due to the earth-shattering nature of their ideas. While one could argue that such a claim is not too far-fetched in the cases of Cantor and Boltzmann, it seems somewhat distasteful when applied to Turing. Turing did not go insane because of the depth of his revolutionary insights. Turing&#8217;s homosexuality was viewed as a security problem during the troubled times of the Cold War, and the brutal punishment which he underwent (chemical castration) was probably what led him to take his life. Gödel feared that someone was poisoning his food, and would refuse to eat unless his wife would taste his food first. When his wife was hospitalized for some time, Gödel starved himself to death. Hence, the claim that these four suicides were due to &#8220;dangerous knowledge&#8221; seems rather crude to me.</p>
<p>On the bright side, the claim that these four geniuses were ahead of their time sounds rather plausible. Cantor&#8217;s or Boltzmann&#8217;s ideas did not meet fierce resistance because they were technically wrong, but because they challenged the belief that the universe was perfect and orderly. No one wanted to hear about Boltzmann&#8217;s work on entropy, because entropy is, by definition, a measure of disorder. As <a href="http://en.wikipedia.org/wiki/Hilbert%27s_program" target="_blank">Hilbert&#8217;s program</a> tried to fix the inconsistencies in  the foundations of Mathematics, Gödel&#8217;s <a href="http://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems" target="_blank">incompleteness theorems</a> made Hilbert&#8217;s monumental mission &#8220;wir müssen wissen, wir werden wissen&#8221; seem even harder to accomplish.</p>
<p>In my most humble opinion the times were not yet ripe for theories that imposed limitations on human knowledge. &#8220;What about Heisenberg&#8217;s <a href="http://en.wikipedia.org/wiki/Uncertainty_principle" target="_blank">uncertainty principle</a>?&#8221;, I hear you ask. Good point. Do note that two decades can make a world of difference. Heisenberg&#8217;s work was created when Quantum Mechanics was already out of the box. By contrast, Boltzmann had to fight the 19th Century establishment that was still deeply entrenched in the Newtonian paradigm.</p>
<p>If you have a couple of hours, here are the documentary&#8217;s videos:</p>
<p style="text-align:center;">[ <a href="http://video.google.com/videoplay?docid=-8492625684649921614" target="_blank">part 1</a> | <a href="http://video.google.com/videoplay?docid=-1663091361786740235" target="_blank">part 2</a>]</p>
<p><a href="http://en.wikipedia.org/wiki/Gregory_Chaitin" target="_blank">Greg Chaitin</a> and Sir <a href="http://en.wikipedia.org/wiki/Roger_Penrose" target="_blank">Roger Penrose</a> are included in this documentary, which itself makes it worth watching.</p>
Posted in Great Thinkers Tagged: Alan Turing, Foundations of Mathematics, Georg Cantor, Kurt Gödel, Ludwig Boltzmann <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4473/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4473&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/09/01/dangerous-knowledge/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/09/cantor-boltzmann-godel-turing-small.jpg" medium="image">
			<media:title type="html">Cantor Boltzmann Gödel Turing</media:title>
		</media:content>
	</item>
		<item>
		<title>Carnival of Mathematics #56</title>
		<link>http://stochastix.wordpress.com/2009/08/27/carnival-of-mathematics-56/</link>
		<comments>http://stochastix.wordpress.com/2009/08/27/carnival-of-mathematics-56/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 07:22:06 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Carnival of Mathematics]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4447</guid>
		<description><![CDATA[Welcome to the 56th installment of the Carnival of Mathematics!

Qiaochu Yuan writes about Kraft’s inequality for prefix codes and the probabilistic method, and also on linear relationships between square roots.
Prolific blogger John Cook writes about an intriguing nonlinear differential equation , with initial value . Suppose we would like to compute . Numerical methods produce [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4447&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Welcome to the 56th installment of the <a href="http://carnivalofmathematics.wordpress.com" target="_blank">Carnival of Mathematics</a>!</p>
<p><a href="http://plus.maths.org/issue5/turing/index.html"><img class="size-full wp-image-4465 aligncenter" title="Turing test" src="http://stochastix.files.wordpress.com/2009/08/turing-test.gif?w=350&#038;h=208" alt="Turing test" width="350" height="208" /></a></p>
<p>Qiaochu Yuan writes about <a href="http://qchu.wordpress.com/2009/08/12/krafts-inequality-for-prefix-codes/" target="_blank">Kraft’s inequality for prefix codes</a> and the probabilistic method, and also on <a href="http://qchu.wordpress.com/2009/07/02/square-roots-have-no-unexpected-linear-relationships" target="_blank">linear relationships between square roots</a>.</p>
<p>Prolific blogger John Cook <a href="http://www.johndcook.com/blog/2009/08/11/approximating-a-solution-that-doesnt-exist/" target="_blank">writes</a> about an intriguing nonlinear differential equation <img src='http://l.wordpress.com/latex.php?latex=%5Cdot%7By%7D%28t%29+%3D+t%5E2+%2B+y%5E2%28t%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\dot{y}(t) = t^2 + y^2(t)' title='\dot{y}(t) = t^2 + y^2(t)' class='latex' />, with initial value <img src='http://l.wordpress.com/latex.php?latex=y%280%29+%3D+1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(0) = 1' title='y(0) = 1' class='latex' />. Suppose we would like to compute <img src='http://l.wordpress.com/latex.php?latex=y%281%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(1)' title='y(1)' class='latex' />. Numerical methods produce rather bizarre results. The reason is that there is no solution at <img src='http://l.wordpress.com/latex.php?latex=t%3D1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t=1' title='t=1' class='latex' /> (finite escape time, anyone?). The moral of the story is that the theorems on existence and uniqueness of solutions to initial value problems <em>do</em> indeed matter.</p>
<p>Rick Regan <a href="http://www.exploringbinary.com/nines-in-binary" target="_blank">discovered</a> that positive integers of the form <img src='http://l.wordpress.com/latex.php?latex=10%5En+-1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='10^n -1' title='10^n -1' class='latex' /> have binary representations where the <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> least significant bits are exactly <img src='http://l.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1' title='1' class='latex' />. For example, <img src='http://l.wordpress.com/latex.php?latex=999_%7B10%7D+%3D+1111100111_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='999_{10} = 1111100111_2' title='999_{10} = 1111100111_2' class='latex' />. It&#8217;s interesting to note that this was a somewhat serendipitous finding.</p>
<p>Harrison Brown has a post on <a href="http://harrisonbrown.wordpress.com/2009/08/20/gila-0-roths-proof-of-roths-theorem" target="_blank">Roth&#8217;s proof of Roth&#8217;s theorem</a> on arithmetic progressions from a combinatorial viewpoint.</p>
<p>Dave Richeson <a href="http://divisbyzero.com/2009/08/25/367-5309-more-than-jennys-phone-number/" target="_blank">writes</a> about the prime <img src='http://l.wordpress.com/latex.php?latex=8675309&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='8675309' title='8675309' class='latex' />, <a href="http://divisbyzero.com/2009/08/26/more-on-twin-primes-and-pythagorean-triples/" target="_blank">twin primes and Pythagorean triples</a>.</p>
<p>Américo Tavares lists <a href="http://problemasteoremas.wordpress.com/2009/08/26/three-gamma-function-identities" target="_blank">three gamma function identities</a>.</p>
<p>Mike Croucher <a href="http://www.walkingrandomly.com/?p=1633" target="_blank">writes</a> about Philipp Kühl and Daniel Kirsch&#8217;s awesome <a href="http://detexify.kirelabs.org/classify.html" target="_blank">Detexify</a> project, a <img src='http://l.wordpress.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\LaTeX' title='\LaTeX' class='latex' /> symbol classifier. This is not mathematics <em>per se</em>, but it is an interesting tool for those who need to type mathematical expressions. And if you are interested in machine learning, you will definitely be intrigued.</p>
<p>Since there were few submissions to this Carnival, I  take the liberty of including some more links of interest to me:</p>
<ul>
<li><a href="http://www.math.princeton.edu/math_alive" target="_blank">Math Alive</a> was a course on mathematical concepts that have changed the world. It covers many interesting topics: Cryptography, Error Correction Codes, Data Compression, Probability and Statistics, Chaos and Complex Systems, Graph Theory, Voting and Social Choice Theory. Take a look at the <a href="http://www.math.princeton.edu/math_alive/notes.shtml" target="_blank">lecture notes</a>. The course was taught at Princeton University by <a href="http://www.math.princeton.edu/~ingrid/" target="_blank">Ingrid Daubechies</a>.</li>
</ul>
<ul>
<li>Edsger Dijkstra once said that &#8220;Computer Science is no more about computers than Astronomy is about telescopes&#8221;. <a href="http://csunplugged.com" target="_blank">Computer Science Unplugged</a> is a very interesting initiative whose aim is to teach the principles of Computer Science via a series of recreational learning activities that are suitable for kids of all ages.</li>
</ul>
<ul>
<li>Harold Kuhn&#8217;s <a href="http://books.google.com/books?id=Ptplj9VPMyYC" target="_blank">lectures on the theory of games</a> are a delightful read!</li>
</ul>
<ul>
<li>If you are interested in Combinatorial Game Theory, you have to read <a href="http://www.msri.org/communications/books/Book29/contents.html" target="_blank">Games of No Chance</a>.</li>
</ul>
<ul>
<li>Igor Pak&#8217;s <a href="http://www.math.umn.edu/~pak/geompol8.pdf" target="_blank">Lectures on Discrete and Polyhedral Geometry</a> [pdf] look terribly sexy indeed.</li>
</ul>
<ul>
<li>James Sethna&#8217;s gorgeous book <a href="http://pages.physics.cornell.edu/sethna/StatMech" target="_blank">Statistical Mechanics: Entropy, Order Parameters, and Complexity</a> is available online.</li>
</ul>
<ul>
<li>Gil Kalai <a href="http://gilkalai.wordpress.com/2009/08/07/impossibility-result-for-survivor" target="_blank">wrote</a> on strategy-proof mechanisms and an impossibility theorem. Fascinating stuff!</li>
</ul>
<ul>
<li>Ron Doerfler wrote <a href="http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-i-geometric-design" target="_blank">three</a> <a href="http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-ii-designing-with-determinants" target="_blank">beautiful</a> <a href="http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-iii-transformations" target="_blank">posts</a> on the lost art of Nomography. If you like to write code in Python, you can create your own nomographs with <a href="http://www.pynomo.org" target="_blank">PyNomo</a>. If this looks pre-historical to you, be reminded that electrical engineers (such as myself) still use <a href="http://en.wikipedia.org/wiki/Smith_chart" target="_blank">Smith charts</a> :-P</li>
</ul>
<ul>
<li>David Austin wrote an awesome introduction to the <a href="http://www.ams.org/featurecolumn/archive/svd.html" target="_blank">Singular Value Decomposition</a>. He also wrote a really good article on <a href="http://www.ams.org/featurecolumn/archive/percolation.html" target="_blank">Percolation</a>.</li>
</ul>
<ul>
<li>Reading Brad Osgood&#8217;s <a href="http://see.stanford.edu/materials/lsoftaee261/book-fall-07.pdf" target="_blank">The Fourier Transform and its Applications</a> [pdf] is a great way of relearning Applied Fourier Analysis.</li>
</ul>
<ul>
<li>If you are studying or teaching elementary Game Theory, give <a href="http://gambit.sourceforge.net" target="_blank">Gambit</a> a try!! Human beings were not designed to compute Nash equilibria with pencil and paper&#8230;</li>
</ul>
<ul>
<li>A very interesting applied problem I recently read about is the <a href="http://en.wikipedia.org/wiki/German_tank_problem" target="_blank">German tank problem</a>. During WW2, the allies wanted to estimate the number of tanks the Germans were producing each year, so that they could assess the likelihood of success of an invasion of Continental Europe. Intelligence reports were not conclusive. The allies&#8217; <a href="http://www.guardian.co.uk/world/2006/jul/20/secondworldwar.tvandradio" target="_blank">statisticians were able to estimate with great precision the number of German tanks being produced</a> from the serial numbers of captured German tanks. The fact that the Germans, in typical German fashion, numbered their tanks sequentially turned out to be quite a blunder ;-)</li>
</ul>
<ul>
<li>Here&#8217;s something for the aesthetically-inclined: <a href="http://www.rdrop.com/~half/Creations/Puzzles/visualizing.4D/index.html" target="_blank">visualizing the 4th dimension using color</a>.</li>
</ul>
<ul>
<li>If you are interested in vintage computers, you might want to take a look at <a href="http://www.fourmilab.ch/babbage/sketch.html" target="_blank">Sketch of the Analytical Engine</a> (1842).</li>
</ul>
<ul>
<li>Erico Guizzo wrote a <a href="http://hdl.handle.net/1721.1/39429" target="_blank">thesis</a> on Claude Shannon and the making of Information Theory.</li>
</ul>
<ul>
<li>You can build a <a href="http://www.rci.rutgers.edu/~cfs/472_html/Intro/TinkertoyComputer/TinkerToy.html" target="_blank">Tinkertoy computer that plays tic-tac-toe</a>.</li>
</ul>
<ul>
<li>If you happen to suffer from insomnia, I do recommend the truly monumental <a href="http://en.wikipedia.org/wiki/Principia_Mathematica" target="_blank">Principia Mathematica</a>.</li>
</ul>
<ul>
<li>If you like <a href="http://en.wikipedia.org/wiki/Calvin_and_Hobbes#Calvinball" target="_blank">Calvinball</a>, then give <a href="http://www.nomic.net/" target="_blank">Nomic</a> a try!!</li>
</ul>
<p>The next edition of the <a href="http://carnivalofmathematics.wordpress.com/" target="_blank">CoM</a> will be posted in two weeks, on <a href="http://threesixty360.wordpress.com/" target="_blank">360</a>.</p>
Posted in Mathematics Tagged: Carnival of Mathematics <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4447/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4447&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/08/27/carnival-of-mathematics-56/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/08/turing-test.gif" medium="image">
			<media:title type="html">Turing test</media:title>
		</media:content>
	</item>
		<item>
		<title>The Binary Marble Adding Machine</title>
		<link>http://stochastix.wordpress.com/2009/08/25/the-binary-marble-adding-machine/</link>
		<comments>http://stochastix.wordpress.com/2009/08/25/the-binary-marble-adding-machine/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 05:31:21 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Binary Marble Adding Machine]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Matthias Wandel]]></category>
		<category><![CDATA[Mechanical Computers]]></category>
		<category><![CDATA[Mechanical Devices]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4454</guid>
		<description><![CDATA[Matthias Wandel built a rudimentary digital computer out of wood. The ingenious Binary Marble Adding Machine is, basically, a 6-bit adder that runs on gravity and uses mechanical flip-flops for memory storage.

[ schematic courtesy of Matthias Wandel ]
Here&#8217;s a demo video:

More info on the lovely Marble Adding Machine:

More on the binary marble adding machine


Plans for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4454&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://woodgears.ca" target="_blank">Matthias Wandel</a> built a rudimentary digital computer out of wood. The ingenious <a href="http://woodgears.ca/marbleadd/index.html" target="_blank">Binary Marble Adding Machine</a> is, basically, a 6-bit <a href="http://en.wikipedia.org/wiki/Adder_%28electronics%29" target="_blank">adder</a> that runs on gravity and uses mechanical <a href="http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29" target="_blank">flip-flops</a> for memory storage.</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/08/schematic-of-the-marble-adding-machine.png"><img class="size-full wp-image-4457 aligncenter" title="schematic of the marble adding machine" src="http://stochastix.files.wordpress.com/2009/08/schematic-of-the-marble-adding-machine.png?w=360&#038;h=436" alt="schematic of the marble adding machine" width="360" height="436" /></a></p>
<p style="text-align:center;">[ <a href="http://woodgears.ca/marbleadd/plans/plan.png" target="_blank">schematic</a> courtesy of Matthias Wandel ]</p>
<p>Here&#8217;s a demo video:</p>
<p><span style="text-align:center; display: block;"><a href="http://stochastix.wordpress.com/2009/08/25/the-binary-marble-adding-machine/"><img src="http://img.youtube.com/vi/GcDshWmhF4A/2.jpg" alt="" /></a></span></p>
<p>More info on the lovely <a href="http://woodgears.ca/marbleadd/index.html" target="_blank">Marble Adding Machine</a>:</p>
<ul>
<li><a href="http://woodgears.ca/marbleadd/more.html" target="_blank">More on the binary marble adding machine</a></li>
</ul>
<ul>
<li><a href="http://woodgears.ca/marbleadd/plans/index.html" target="_blank">Plans for the marble adding machine</a></li>
</ul>
<ul>
<li><a href="http://www.sentex.net/~mwandel/marbles/flipflop.html" target="_blank">How the marble flip-flop works</a></li>
</ul>
<p>Other interesting creations of Matthias Wandel:</p>
<ul>
<li><a href="http://woodgears.ca/machines.html" target="_blank">Wooden Machines</a></li>
</ul>
<ul>
<li><a href="http://www.sentex.net/~mwandel/marbles/index.html" target="_blank">Marble Machines</a></li>
</ul>
<p style="text-align:center;">(hat tip: <a href="http://www.exploringbinary.com/the-binary-marble-adding-machine" target="_blank">Rick Regan</a>)</p>
Posted in Art, Computers Tagged: Art, Binary Marble Adding Machine, Computers, DIY, Matthias Wandel, Mechanical Computers, Mechanical Devices <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4454/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4454&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/08/25/the-binary-marble-adding-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/08/schematic-of-the-marble-adding-machine.png" medium="image">
			<media:title type="html">schematic of the marble adding machine</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/GcDshWmhF4A/2.jpg" medium="image" />
	</item>
		<item>
		<title>Optimal Account Balancing II</title>
		<link>http://stochastix.wordpress.com/2009/07/28/optimal-account-balancing-ii/</link>
		<comments>http://stochastix.wordpress.com/2009/07/28/optimal-account-balancing-ii/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 03:26:12 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Operations Research]]></category>
		<category><![CDATA[Accounting]]></category>
		<category><![CDATA[IOU Graphs]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4339</guid>
		<description><![CDATA[Consider a network of  agents, each owing money to and being owed money by other agents. The debts are represented pictorially by the weighted directed graph
which I called an IOU graph on my previous post on this topic. The IOU graph representing this network is an ordered triple , where  is the node [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4339&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Consider a network of <img src='http://l.wordpress.com/latex.php?latex=n+%3D+10&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 10' title='n = 10' class='latex' /> agents, each owing money to and being owed money by other agents. The debts are represented pictorially by the weighted directed graph</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-20-edges.png"><img class="size-full wp-image-4340 aligncenter" title="IOU graph - 10 nodes and 20 edges" src="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-20-edges.png?w=450&#038;h=324" alt="IOU graph - 10 nodes and 20 edges" width="450" height="324" /></a>which I called an <em><a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph</em> on my previous <a href="http://stochastix.wordpress.com/2009/06/20/optimal-account-balancing/" target="_blank">post</a> on this topic. The IOU <a href="http://en.wikipedia.org/wiki/Graph_(mathematics)" target="_blank">graph</a> representing this network is an ordered triple <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D%2C+w%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' title='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' class='latex' />, where <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D+%3D+%5C%7B1%2C+2%2C+%5Cldots%2C+10%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N} = \{1, 2, \ldots, 10\}' title='\mathcal{N} = \{1, 2, \ldots, 10\}' class='latex' /> is the <span style="text-decoration:underline;">node set</span> (each node of the IOU graph represents a different agent), <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BE%7D+%5Csubset+%5Cmathcal%7BN%7D+%5Ctimes+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{E} \subset \mathcal{N} \times \mathcal{N}' title='\mathcal{E} \subset \mathcal{N} \times \mathcal{N}' class='latex' /> is the <span style="text-decoration:underline;">edge set</span> (containing <img src='http://l.wordpress.com/latex.php?latex=%7C%5Cmathcal%7BE%7D%7C+%3D+20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\mathcal{E}| = 20' title='|\mathcal{E}| = 20' class='latex' /> elements), and <img src='http://l.wordpress.com/latex.php?latex=w%3A+%5Cmathcal%7BE%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5E%7B%2B%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w: \mathcal{E} \rightarrow \mathbb{R}^{+}' title='w: \mathcal{E} \rightarrow \mathbb{R}^{+}' class='latex' /> is a <span style="text-decoration:underline;">weight function</span> that assigns positive weights to each edge in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{E}' title='\mathcal{E}' class='latex' />. Each directed edge of graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}' title='\mathcal{G}' class='latex' /> is an ordered pair <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j)' title='(i,j)' class='latex' />, where <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> is the edge’s tail and <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' /> is the edge’s head. If <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29+%5Cin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j) \in \mathcal{E}' title='(i,j) \in \mathcal{E}' class='latex' /> then node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes money to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />. We do not allow nodes to owe money to themselves and, therefore, for each <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' /> we must have <img src='http://l.wordpress.com/latex.php?latex=%28i%2Ci%29+%5Cnotin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,i) \notin \mathcal{E}' title='(i,i) \notin \mathcal{E}' class='latex' />. The weight of edge <img src='http://l.wordpress.com/latex.php?latex=%28i%2C+j%29+%5Cin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i, j) \in \mathcal{E}' title='(i, j) \in \mathcal{E}' class='latex' /> is given by <img src='http://l.wordpress.com/latex.php?latex=w%5Cleft%28+%28i%2C+j%29+%5Cright%29+%3E+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w\left( (i, j) \right) &gt; 0' title='w\left( (i, j) \right) &gt; 0' class='latex' />, and it tells us the amount of money that node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />.</p>
<p>Alternatively, the information contained in the IOU graph can be encoded in the following <a href="http://en.wikipedia.org/wiki/Nonnegative_matrix" target="_blank">nonnegative matrix</a></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cleft%5B%5Cbegin%7Barray%7D%7Bcccccccccc%7D+0+%26+10+%26+0+%26+20+%26+20+%26+5+%26+15+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+5+%26+10+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+15+%26+0+%26+5+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+10+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+5+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+10+%26+0+%26+0+%26+0+%26+0%5C%5C+5+%26+20+%26+0+%26+0+%26+0+%26+0+%26+5+%26+0+%26+0+%26+0%5C%5C+0+%26+15+%26+0+%26+0+%26+0+%26+0+%26+0+%26+20+%26+0+%26+10%5C%5C+0+%26+5+%26+15+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\left[\begin{array}{cccccccccc} 0 &amp; 10 &amp; 0 &amp; 20 &amp; 20 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 5 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 15 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 5 &amp; 20 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 20 &amp; 0 &amp; 10\\ 0 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ \end{array}\right]' title='\left[\begin{array}{cccccccccc} 0 &amp; 10 &amp; 0 &amp; 20 &amp; 20 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 5 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 15 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 5 &amp; 20 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 20 &amp; 0 &amp; 10\\ 0 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ \end{array}\right]' class='latex' /></p>
<p>where entry <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j)' title='(i,j)' class='latex' /> is the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />. Since we do not allow nodes to owe money to themselves, the entries on the main diagonal of this matrix are zero. We will call this matrix the <em><span style="text-decoration:underline;">IOU matrix</span></em>. Note that the IOU matrix is the <a href="http://en.wikipedia.org/wiki/Adjacency_matrix" target="_blank">adjacency matrix</a> of the IOU graph. Every nonnegative matrix with zero entries on the main diagonal is an admissible IOU matrix, and we can associate with it a corresponding IOU graph.</p>
<p>If the IOU matrix contains all the information about the IOU graph, then we can work with the IOU matrix instead of the IOU graph. Is there any advantage in doing so? I believe there is. In my opinion, the IOU graph is good for conceptual thinking and intuition, while the IOU matrix is a <a href="http://en.wikipedia.org/wiki/Data_structure" target="_blank">data structure</a> that is convenient for computation. However, the matrix is not the only data structure that one can use to encode the information in an IOU graph. Another possibility would be to use <a href="http://en.wikipedia.org/wiki/Adjacency_list" target="_blank">adjacency lists</a>, for example.</p>
<p style="text-align:center;">__________</p>
<p><strong>Divergence and IOU Matrices</strong></p>
<p>Suppose we are given an IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D_0%2C+w_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' title='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' class='latex' />, whose node set is <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D+%3D+%5C%7B1%2C+2%2C+%5Cldots%2C+n%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N} = \{1, 2, \ldots, n\}' title='\mathcal{N} = \{1, 2, \ldots, n\}' class='latex' />. Note that <img src='http://l.wordpress.com/latex.php?latex=%28i%2Ci%29+%5Cnotin+%5Cmathcal%7BE%7D_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,i) \notin \mathcal{E}_0' title='(i,i) \notin \mathcal{E}_0' class='latex' /> for each <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' />, because nodes cannot owe money to themselves. We now introduce variables <img src='http://l.wordpress.com/latex.php?latex=y_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y_{ij} \geq 0' title='y_{ij} \geq 0' class='latex' /> as follows</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=y_%7Bij%7D+%3D+%5Cdisplaystyle%5Cleft%5C%7B%5Cbegin%7Barray%7D%7Bcl%7D+w_0+%28%28i%2Cj%29%29+%26+%5Ctext%7Bif%7D+%5Cquad%7B%7D+%28i%2Cj%29+%5Cin+%5Cmathcal%7BE%7D_0%5C%5C+0+%26+%5Ctext%7Bif%7D+%5Cquad%7B%7D+%28i%2Cj%29+%5Cnotin+%5Cmathcal%7BE%7D_0%5C%5C+%5Cend%7Barray%7D%5Cright.&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y_{ij} = \displaystyle\left\{\begin{array}{cl} w_0 ((i,j)) &amp; \text{if} \quad{} (i,j) \in \mathcal{E}_0\\ 0 &amp; \text{if} \quad{} (i,j) \notin \mathcal{E}_0\\ \end{array}\right.' title='y_{ij} = \displaystyle\left\{\begin{array}{cl} w_0 ((i,j)) &amp; \text{if} \quad{} (i,j) \in \mathcal{E}_0\\ 0 &amp; \text{if} \quad{} (i,j) \notin \mathcal{E}_0\\ \end{array}\right.' class='latex' /></p>
<p>and build the (nonnegative) <a href="http://en.wikipedia.org/wiki/Adjacency_matrix" target="_blank">adjacency matrix</a> of the IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0' title='\mathcal{G}_0' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=Y+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bccccc%7D+0+%26+y_%7B12%7D+%26+y_%7B13%7D+%26+%5Cldots+%26+y_%7B1n%7D%5C%5C+y_%7B21%7D+%26+0+%26+y_%7B23%7D+%26+%5Cldots+%26+y_%7B2n%7D%5C%5C+y_%7B31%7D+%26+y_%7B32%7D+%26+0+%26+%5Cldots+%26+y_%7B3n%7D%5C%5C%5Cvdots+%26+%5Cvdots+%26+%5Cvdots+%26+%5Cddots+%26+%5Cvdots%5C%5C+y_%7Bn1%7D+%26+y_%7Bn2%7D+%26+y_%7Bn3%7D+%26+%5Cldots+%26+0%5C%5C%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Y = \left[\begin{array}{ccccc} 0 &amp; y_{12} &amp; y_{13} &amp; \ldots &amp; y_{1n}\\ y_{21} &amp; 0 &amp; y_{23} &amp; \ldots &amp; y_{2n}\\ y_{31} &amp; y_{32} &amp; 0 &amp; \ldots &amp; y_{3n}\\\vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots\\ y_{n1} &amp; y_{n2} &amp; y_{n3} &amp; \ldots &amp; 0\\\end{array}\right]' title='Y = \left[\begin{array}{ccccc} 0 &amp; y_{12} &amp; y_{13} &amp; \ldots &amp; y_{1n}\\ y_{21} &amp; 0 &amp; y_{23} &amp; \ldots &amp; y_{2n}\\ y_{31} &amp; y_{32} &amp; 0 &amp; \ldots &amp; y_{3n}\\\vdots &amp; \vdots &amp; \vdots &amp; \ddots &amp; \vdots\\ y_{n1} &amp; y_{n2} &amp; y_{n3} &amp; \ldots &amp; 0\\\end{array}\right]' class='latex' /></p>
<p>which is the IOU matrix associated with the IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0' title='\mathcal{G}_0' class='latex' />. The <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j)' title='(i,j)' class='latex' /> entry of matrix <img src='http://l.wordpress.com/latex.php?latex=Y+%5Cin+%5Cmathbb%7BR%7D%5E%7Bn+%5Ctimes+n%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Y \in \mathbb{R}^{n \times n}' title='Y \in \mathbb{R}^{n \times n}' class='latex' /> denotes the amount of money that node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />. The <span style="text-decoration:underline;">divergence</span> of node <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' /> is a scalar defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29+%3D+%5Cdisplaystyle+%5Csum_%7Bj+%5Cneq+i%7D+y_%7Bij%7D+-+%5Cdisplaystyle+%5Csum_%7Bj+%5Cneq+i%7D+y_%7Bji%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div}_i (\mathcal{G}_0) = \displaystyle \sum_{j \neq i} y_{ij} - \displaystyle \sum_{j \neq i} y_{ji}' title='\mbox{div}_i (\mathcal{G}_0) = \displaystyle \sum_{j \neq i} y_{ij} - \displaystyle \sum_{j \neq i} y_{ji}' class='latex' /></p>
<p>and it gives us the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to other nodes minus the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> is owed to by other nodes. In terms of the IOU matrix <img src='http://l.wordpress.com/latex.php?latex=Y&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Y' title='Y' class='latex' />, the divergence of node <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' /> is given by</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29+%3D+e_i%5ET+Y+1_n+-+e_i%5ET+Y%5ET+1_n+%3D+e_i%5ET+Y+1_n+-+1_n%5ET+Y+e_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div}_i (\mathcal{G}_0) = e_i^T Y 1_n - e_i^T Y^T 1_n = e_i^T Y 1_n - 1_n^T Y e_i' title='\mbox{div}_i (\mathcal{G}_0) = e_i^T Y 1_n - e_i^T Y^T 1_n = e_i^T Y 1_n - 1_n^T Y e_i' class='latex' /></p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=e_i+%5Cin+%5Cmathbb%7BR%7D%5E%7Bn%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='e_i \in \mathbb{R}^{n}' title='e_i \in \mathbb{R}^{n}' class='latex' /> is the <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' />-th vector of the <a href="http://en.wikipedia.org/wiki/Standard_basis" target="_blank">canonical basis</a> for <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}^n' title='\mathbb{R}^n' class='latex' />, i.e., the <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' />-th column of the <img src='http://l.wordpress.com/latex.php?latex=n+%5Ctimes+n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n \times n' title='n \times n' class='latex' /> identity matrix <img src='http://l.wordpress.com/latex.php?latex=I_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_n' title='I_n' class='latex' />, and <img src='http://l.wordpress.com/latex.php?latex=1_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1_n' title='1_n' class='latex' /> is an <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-dimensional vector of ones. Let <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec}' title='\mbox{vec}' class='latex' /> denote the <a href="http://en.wikipedia.org/wiki/Vectorization_(mathematics)" target="_blank">vectorization</a> operator, which stacks a given matrix&#8217;s columns in one large column vector. Note that if we apply operator <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec}' title='\mbox{vec}' class='latex' /> to a scalar, we obtain the same scalar. Hence, we have that</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=e_i%5ET+Y+1_n+%3D+%5Cmbox%7Bvec%7D+%28e_i%5ET+Y+1_n%29+%3D+%281_n%5ET+%5Cotimes+e_i%5ET%29+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='e_i^T Y 1_n = \mbox{vec} (e_i^T Y 1_n) = (1_n^T \otimes e_i^T) \mbox{vec} (Y)' title='e_i^T Y 1_n = \mbox{vec} (e_i^T Y 1_n) = (1_n^T \otimes e_i^T) \mbox{vec} (Y)' class='latex' /></p>
<p>and</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=1_n%5ET+Y+e_i+%3D+%5Cmbox%7Bvec%7D+%281_n%5ET+Y+e_i%29+%3D+%28e_i%5ET+%5Cotimes+1_n%5ET%29+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1_n^T Y e_i = \mbox{vec} (1_n^T Y e_i) = (e_i^T \otimes 1_n^T) \mbox{vec} (Y)' title='1_n^T Y e_i = \mbox{vec} (1_n^T Y e_i) = (e_i^T \otimes 1_n^T) \mbox{vec} (Y)' class='latex' /></p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=%5Cotimes&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\otimes' title='\otimes' class='latex' /> denotes the <a href="http://en.wikipedia.org/wiki/Kronecker_product" target="_blank">Kronecker product</a>. Therefore, the divergence of node <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' /> can be written as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29+%3D+%5Cleft%5B%281_n%5ET+%5Cotimes+e_i%5ET%29+-+%28e_i%5ET+%5Cotimes+1_n%5ET%29%5Cright%5D+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div}_i (\mathcal{G}_0) = \left[(1_n^T \otimes e_i^T) - (e_i^T \otimes 1_n^T)\right] \mbox{vec} (Y)' title='\mbox{div}_i (\mathcal{G}_0) = \left[(1_n^T \otimes e_i^T) - (e_i^T \otimes 1_n^T)\right] \mbox{vec} (Y)' class='latex' />.</p>
<p>We define also the <span style="text-decoration:underline;">divergence vector</span> of graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0' title='\mathcal{G}_0' class='latex' /> as the <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-dimensional vector whose <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' />-th component is <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div}_i (\mathcal{G}_0)' title='\mbox{div}_i (\mathcal{G}_0)' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D+%281_n%5ET+%5Cotimes+e_1%5ET%29+-+%28e_1%5ET+%5Cotimes+1_n%5ET%29%5C%5C+%281_n%5ET+%5Cotimes+e_2%5ET%29+-+%28e_2%5ET+%5Cotimes+1_n%5ET%29%5C%5C+%5Cvdots%5C%5C+%281_n%5ET+%5Cotimes+e_n%5ET%29+-+%28e_n%5ET+%5Cotimes+1_n%5ET%29%5C%5C%5Cend%7Barray%7D%5Cright%5D+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = \left[\begin{array}{c} (1_n^T \otimes e_1^T) - (e_1^T \otimes 1_n^T)\\ (1_n^T \otimes e_2^T) - (e_2^T \otimes 1_n^T)\\ \vdots\\ (1_n^T \otimes e_n^T) - (e_n^T \otimes 1_n^T)\\\end{array}\right] \mbox{vec} (Y)' title='\mbox{div} (\mathcal{G}_0) = \left[\begin{array}{c} (1_n^T \otimes e_1^T) - (e_1^T \otimes 1_n^T)\\ (1_n^T \otimes e_2^T) - (e_2^T \otimes 1_n^T)\\ \vdots\\ (1_n^T \otimes e_n^T) - (e_n^T \otimes 1_n^T)\\\end{array}\right] \mbox{vec} (Y)' class='latex' />.</p>
<p>Alternatively, we can use equation <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29+%3D+e_i%5ET+Y+1_n+-+e_i%5ET+Y%5ET+1_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div}_i (\mathcal{G}_0) = e_i^T Y 1_n - e_i^T Y^T 1_n' title='\mbox{div}_i (\mathcal{G}_0) = e_i^T Y 1_n - e_i^T Y^T 1_n' class='latex' />, and write the divergence vector as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+I_n+Y+1_n+-+I_n+Y%5ET+1_n+%3D+%28Y+-+Y%5ET%29+1_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = I_n Y 1_n - I_n Y^T 1_n = (Y - Y^T) 1_n' title='\mbox{div} (\mathcal{G}_0) = I_n Y 1_n - I_n Y^T 1_n = (Y - Y^T) 1_n' class='latex' /></p>
<p>and, since</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=I_n+Y+1_n+%3D+%5Cmbox%7Bvec%7D+%28I_n+Y+1_n%29+%3D+%281_n%5ET+%5Cotimes+I_n%29+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_n Y 1_n = \mbox{vec} (I_n Y 1_n) = (1_n^T \otimes I_n) \mbox{vec} (Y)' title='I_n Y 1_n = \mbox{vec} (I_n Y 1_n) = (1_n^T \otimes I_n) \mbox{vec} (Y)' class='latex' /></p>
<p>and</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=I_n+Y%5ET+1_n+%3D+%5Cmbox%7Bvec%7D%28I_n+Y%5ET+1_n%29+%3D+%281_n%5ET+%5Cotimes+I_n%29+%5Cmbox%7Bvec%7D+%28Y%5ET%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_n Y^T 1_n = \mbox{vec}(I_n Y^T 1_n) = (1_n^T \otimes I_n) \mbox{vec} (Y^T)' title='I_n Y^T 1_n = \mbox{vec}(I_n Y^T 1_n) = (1_n^T \otimes I_n) \mbox{vec} (Y^T)' class='latex' />,</p>
<p>we obtain</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+%281_n%5ET+%5Cotimes+I_n%29+%5Cmbox%7Bvec%7D+%28Y%29+-+%281_n%5ET+%5Cotimes+I_n%29+%5Cmbox%7Bvec%7D+%28Y%5ET%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) \mbox{vec} (Y) - (1_n^T \otimes I_n) \mbox{vec} (Y^T)' title='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) \mbox{vec} (Y) - (1_n^T \otimes I_n) \mbox{vec} (Y^T)' class='latex' />.</p>
<p>Note that <img src='http://l.wordpress.com/latex.php?latex=n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n^2' title='n^2' class='latex' />-dimensional vectors <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec} (Y)' title='\mbox{vec} (Y)' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D+%28Y%5ET%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec} (Y^T)' title='\mbox{vec} (Y^T)' class='latex' /> contain the same entries, but in a different order. Hence, there exists a <img src='http://l.wordpress.com/latex.php?latex=n%5E2+%5Ctimes+n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n^2 \times n^2' title='n^2 \times n^2' class='latex' /> <a href="http://en.wikipedia.org/wiki/Permutation_matrix" target="_blank">permutation matrix</a> <img src='http://l.wordpress.com/latex.php?latex=P&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P' title='P' class='latex' /> such that</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D+%28Y%5ET%29+%3D+P+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec} (Y^T) = P \mbox{vec} (Y)' title='\mbox{vec} (Y^T) = P \mbox{vec} (Y)' class='latex' /></p>
<p>which allows us to write</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+%5Cmbox%7Bvec%7D+%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) (I_{n^2} - P) \mbox{vec} (Y)' title='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) (I_{n^2} - P) \mbox{vec} (Y)' class='latex' />.</p>
<p>Do note that the permutation matrix depends on <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> only. It does not depend on the entries of the matrix to which operator <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bvec%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{vec}' title='\mbox{vec}' class='latex' /> is applied. Henceforth, we will denote <img src='http://l.wordpress.com/latex.php?latex=%5Ctilde%7By%7D+%3D+%5Cmbox%7Bvec%7D%28Y%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\tilde{y} = \mbox{vec}(Y)' title='\tilde{y} = \mbox{vec}(Y)' class='latex' />. Finally, we have a rather compact equation for the <span style="text-decoration:underline;">divergence vector</span></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+%5Ctilde%7By%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) (I_{n^2} - P) \tilde{y}' title='\mbox{div} (\mathcal{G}_0) = (1_n^T \otimes I_n) (I_{n^2} - P) \tilde{y}' class='latex' />.</p>
<p>The divergence vector of an IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0' title='\mathcal{G}_0' class='latex' /> tells us how much money each node in the graph will lose after debts have been paid. We say that two IOU graphs (on the same node set) are <span style="text-decoration:underline;">equi-divergent</span> if their divergence vectors are the same. This means that, although the debt relationships are different, both IOU graphs result in every node getting paid what he is owed and paying what he owes.</p>
<p style="text-align:center;">__________</p>
<p><strong>Minimum Money Flow<br />
</strong></p>
<p>Suppose we are given an IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D_0%2C+w_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' title='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' class='latex' />. We would like to find a new IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D%2C+w%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' title='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' class='latex' /> on the same node set <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' />, such that the two IOU graphs are equi-divergent, i.e., <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D%29+%3D+%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}) = \mbox{div} (\mathcal{G}_0)' title='\mbox{div} (\mathcal{G}) = \mbox{div} (\mathcal{G}_0)' class='latex' />. Moreover, we would like the new IOU graph to be “optimal” in some sense. On this post, we will consider the following optimality criterion:</p>
<p style="padding-left:30px;"><span style="text-decoration:underline;">minimum money flow</span>: we want to minimize the total amount of money being exchanged between the nodes. This is the same as minimizing the sum of the weights of the IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}' title='\mathcal{G}' class='latex' />.</p>
<p>Let us start with matrix <img src='http://l.wordpress.com/latex.php?latex=X+%5Cin+%5Cmathbb%7BR%7D%5E%7Bn+%5Ctimes+n%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X \in \mathbb{R}^{n \times n}' title='X \in \mathbb{R}^{n \times n}' class='latex' />, which will be an admissible IOU matrix if we impose two constraints:</p>
<ul>
<li><span style="text-decoration:underline;">nonnegativity</span>: the entries of matrix <img src='http://l.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' /> must be nonnegative. This is equivalent to imposing the constraint that vector <img src='http://l.wordpress.com/latex.php?latex=%5Ctilde%7Bx%7D+%3D+%5Cmbox%7Bvec%7D%28X%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\tilde{x} = \mbox{vec}(X)' title='\tilde{x} = \mbox{vec}(X)' class='latex' /> has nonnegative entries, i.e., <img src='http://l.wordpress.com/latex.php?latex=%5Ctilde%7Bx%7D+%5Cgeq+0_%7Bn%5E2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\tilde{x} \geq 0_{n^2}' title='\tilde{x} \geq 0_{n^2}' class='latex' />, which is equivalent to <img src='http://l.wordpress.com/latex.php?latex=%28-I_%7Bn%5E2%7D%29+%5Ctilde%7Bx%7D+%5Cleq+0_%7Bn%5E2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(-I_{n^2}) \tilde{x} \leq 0_{n^2}' title='(-I_{n^2}) \tilde{x} \leq 0_{n^2}' class='latex' />.</li>
</ul>
<ul>
<li><span style="text-decoration:underline;">zero entries on the main diagonal</span>: we must have <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii} = 0' title='x_{ii} = 0' class='latex' /> for all <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' />. Note that <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D+%3D+e_i%5ET+X+e_i+%3D+%5Cmbox%7Bvec%7D%28e_i%5ET+X+e_i%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii} = e_i^T X e_i = \mbox{vec}(e_i^T X e_i)' title='x_{ii} = e_i^T X e_i = \mbox{vec}(e_i^T X e_i)' class='latex' />, and therefore <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii} = 0' title='x_{ii} = 0' class='latex' /> is equivalent to <img src='http://l.wordpress.com/latex.php?latex=%28e_i%5ET+%5Cotimes+e_i%5ET%29+%5Ctilde%7Bx%7D+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(e_i^T \otimes e_i^T) \tilde{x} = 0' title='(e_i^T \otimes e_i^T) \tilde{x} = 0' class='latex' />. Hence, imposing the constraint that the entries on the main diagonal be zero is equivalent to imposing the <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> equality constraints</li>
</ul>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D+e_1%5ET+%5Cotimes+e_1%5ET%5C%5C+e_2%5ET+%5Cotimes+e_2%5ET%5C%5C+%5Cvdots%5C%5C+e_n%5ET+%5Cotimes+e_n%5ET%5C%5C%5Cend%7Barray%7D%5Cright%5D+%5Ctilde%7Bx%7D+%3D+0_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\left[\begin{array}{c} e_1^T \otimes e_1^T\\ e_2^T \otimes e_2^T\\ \vdots\\ e_n^T \otimes e_n^T\\\end{array}\right] \tilde{x} = 0_n' title='\left[\begin{array}{c} e_1^T \otimes e_1^T\\ e_2^T \otimes e_2^T\\ \vdots\\ e_n^T \otimes e_n^T\\\end{array}\right] \tilde{x} = 0_n' class='latex' />.</p>
<p>Once these two constraints have been imposed, matrix <img src='http://l.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' /> is the adjacency matrix of an IOU graph. Finally, we must impose the constraint that the divergence vector of the new IOU graph is the same as the divergence vector of the given IOU graph, i.e., <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D%29+%3D+%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}) = \mbox{div} (\mathcal{G}_0)' title='\mbox{div} (\mathcal{G}) = \mbox{div} (\mathcal{G}_0)' class='latex' />, which yields</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+%5Ctilde%7Bx%7D+%3D+%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(1_n^T \otimes I_n) (I_{n^2} - P) \tilde{x} = \mbox{div} (\mathcal{G}_0)' title='(1_n^T \otimes I_n) (I_{n^2} - P) \tilde{x} = \mbox{div} (\mathcal{G}_0)' class='latex' /></p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29+%3D+%28Y+-+Y%5ET%29+1_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mbox{div} (\mathcal{G}_0) = (Y - Y^T) 1_n' title='\mbox{div} (\mathcal{G}_0) = (Y - Y^T) 1_n' class='latex' /> can be computed from the given IOU graph. Considering the <span style="text-decoration:underline;">minimum money flow</span> criterion, the <span style="text-decoration:underline;">cost function</span> to be minimized is the following</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle%5Csum_%7Bi+%5Cin+%5Cmathcal%7BN%7D%7D+%5Csum_%7Bj+%5Cneq+i%7D+x_%7Bij%7D+%3D+1_n%5ET+X+1_n+%3D+%281_n%5ET+%5Cotimes+1_n%5ET%29+%5Ctilde%7Bx%7D+%3D+1_%7Bn%5E2%7D%5ET+%5Ctilde%7Bx%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle\sum_{i \in \mathcal{N}} \sum_{j \neq i} x_{ij} = 1_n^T X 1_n = (1_n^T \otimes 1_n^T) \tilde{x} = 1_{n^2}^T \tilde{x}' title='\displaystyle\sum_{i \in \mathcal{N}} \sum_{j \neq i} x_{ij} = 1_n^T X 1_n = (1_n^T \otimes 1_n^T) \tilde{x} = 1_{n^2}^T \tilde{x}' class='latex' /></p>
<p>and, hence, we obtain the following <a href="http://en.wikipedia.org/wiki/Linear_programming" target="_blank">linear program</a> in <img src='http://l.wordpress.com/latex.php?latex=%5Ctilde%7Bx%7D+%5Cin+%5Cmathbb%7BR%7D%5E%7Bn%5E2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\tilde{x} \in \mathbb{R}^{n^2}' title='\tilde{x} \in \mathbb{R}^{n^2}' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Ctext%7Bminimize%7D+%26+%5Cdisplaystyle+1_%7Bn%5E2%7D%5ET+%5Ctilde%7Bx%7D%5C%5C%5C%5C+%5Ctext%7Bsubject+to%7D+%26+%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+%5Ctilde%7Bx%7D+%3D+%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29%5C%5C%5C%5C+%26+%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D+e_1%5ET+%5Cotimes+e_1%5ET%5C%5C+e_2%5ET+%5Cotimes+e_2%5ET%5C%5C+%5Cvdots%5C%5C+e_n%5ET+%5Cotimes+e_n%5ET%5C%5C%5Cend%7Barray%7D%5Cright%5D+%5Ctilde%7Bx%7D+%3D+0_n%5C%5C%5C%5C+%26+%28-I_%7Bn%5E2%7D%29+%5Ctilde%7Bx%7D+%5Cleq+0_%7Bn%5E2%7D%5C%5C%5C%5C%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \text{minimize} &amp; \displaystyle 1_{n^2}^T \tilde{x}\\\\ \text{subject to} &amp; (1_n^T \otimes I_n) (I_{n^2} - P) \tilde{x} = \mbox{div} (\mathcal{G}_0)\\\\ &amp; \left[\begin{array}{c} e_1^T \otimes e_1^T\\ e_2^T \otimes e_2^T\\ \vdots\\ e_n^T \otimes e_n^T\\\end{array}\right] \tilde{x} = 0_n\\\\ &amp; (-I_{n^2}) \tilde{x} \leq 0_{n^2}\\\\\end{array}' title='\begin{array}{ll} \text{minimize} &amp; \displaystyle 1_{n^2}^T \tilde{x}\\\\ \text{subject to} &amp; (1_n^T \otimes I_n) (I_{n^2} - P) \tilde{x} = \mbox{div} (\mathcal{G}_0)\\\\ &amp; \left[\begin{array}{c} e_1^T \otimes e_1^T\\ e_2^T \otimes e_2^T\\ \vdots\\ e_n^T \otimes e_n^T\\\end{array}\right] \tilde{x} = 0_n\\\\ &amp; (-I_{n^2}) \tilde{x} \leq 0_{n^2}\\\\\end{array}' class='latex' /></p>
<p>which has <img src='http://l.wordpress.com/latex.php?latex=2+n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2 n' title='2 n' class='latex' /> equality and <img src='http://l.wordpress.com/latex.php?latex=n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n^2' title='n^2' class='latex' /> inequality constraints. One can easily solve this linear program with <a href="http://www.mathworks.com" target="_blank">MATLAB</a> using function <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/linprog.html" target="_blank">linprog</a>.</p>
<p>However, this formulation looks a bit silly. Note that initially we have <img src='http://l.wordpress.com/latex.php?latex=n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n^2' title='n^2' class='latex' /> degrees of freedom (the <img src='http://l.wordpress.com/latex.php?latex=n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n^2' title='n^2' class='latex' /> entries of matrix <img src='http://l.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' />), then we impose <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> equality constraints <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii} = 0' title='x_{ii} = 0' class='latex' /> to ensure that the entries on the <a href="http://en.wikipedia.org/wiki/Main_diagonal" target="_blank">main diagonal</a> are zero, which leaves us with <img src='http://l.wordpress.com/latex.php?latex=m+%3D+n%5E2+-+n+%3D+n+%28n-1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m = n^2 - n = n (n-1)' title='m = n^2 - n = n (n-1)' class='latex' /> degrees of freedom. If we already know that the entries on the main diagonal are zero, why consider them as decision variables? Wouldn&#8217;t it make much more sense to consider only the <img src='http://l.wordpress.com/latex.php?latex=m+%3D+n+%28n-1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m = n (n-1)' title='m = n (n-1)' class='latex' /> entries off the main diagonal as decision variables?</p>
<p>Let <img src='http://l.wordpress.com/latex.php?latex=R&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='R' title='R' class='latex' /> be a <img src='http://l.wordpress.com/latex.php?latex=m+%5Ctimes+n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m \times n^2' title='m \times n^2' class='latex' /> <a href="http://en.wikipedia.org/wiki/(0,1)-matrix" target="_blank">binary matrix</a> such that <img src='http://l.wordpress.com/latex.php?latex=%5Chat%7Bx%7D+%3D+R+%5Ctilde%7Bx%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\hat{x} = R \tilde{x}' title='\hat{x} = R \tilde{x}' class='latex' /> is the reduced vector of <img src='http://l.wordpress.com/latex.php?latex=m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m' title='m' class='latex' /> decision variables, containing solely the entries of <img src='http://l.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X' title='X' class='latex' /> off the main diagonal. We now eliminate the <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> columns of <img src='http://l.wordpress.com/latex.php?latex=n+%5Ctimes+n%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n \times n^2' title='n \times n^2' class='latex' /> matrix <img src='http://l.wordpress.com/latex.php?latex=%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(1_n^T \otimes I_n) (I_{n^2} - P)' title='(1_n^T \otimes I_n) (I_{n^2} - P)' class='latex' /> which were to be multiplied by the <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii}' title='x_{ii}' class='latex' /> variables. We do so by multiplying matrix <img src='http://l.wordpress.com/latex.php?latex=%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(1_n^T \otimes I_n) (I_{n^2} - P)' title='(1_n^T \otimes I_n) (I_{n^2} - P)' class='latex' /> on the right by <img src='http://l.wordpress.com/latex.php?latex=R%5ET&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='R^T' title='R^T' class='latex' />, which produces a <img src='http://l.wordpress.com/latex.php?latex=n+%5Ctimes+m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n \times m' title='n \times m' class='latex' /> matrix <img src='http://l.wordpress.com/latex.php?latex=%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+R%5ET&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(1_n^T \otimes I_n) (I_{n^2} - P) R^T' title='(1_n^T \otimes I_n) (I_{n^2} - P) R^T' class='latex' />.</p>
<p>The new vector of decision variables is <img src='http://l.wordpress.com/latex.php?latex=%5Chat%7Bx%7D+%5Cin+%5Cmathbb%7BR%7D%5Em&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\hat{x} \in \mathbb{R}^m' title='\hat{x} \in \mathbb{R}^m' class='latex' />. Since we no longer consider the entries on the main diagonal as decision variables, we don&#8217;t need to impose the <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> equality constraints <img src='http://l.wordpress.com/latex.php?latex=x_%7Bii%7D+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ii} = 0' title='x_{ii} = 0' class='latex' />. Hence, we obtain a lower-dimensional linear program</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Ctext%7Bminimize%7D+%26+%5Cdisplaystyle+1_%7Bm%7D%5ET+%5Chat%7Bx%7D%5C%5C%5C%5C+%5Ctext%7Bsubject+to%7D+%26+%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+R%5ET+%5Chat%7Bx%7D+%3D+%5Cmbox%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29%5C%5C%5C%5C+%26+%28-I_m%29+%5Chat%7Bx%7D+%5Cleq+0_%7Bm%7D%5C%5C%5C%5C%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \text{minimize} &amp; \displaystyle 1_{m}^T \hat{x}\\\\ \text{subject to} &amp; (1_n^T \otimes I_n) (I_{n^2} - P) R^T \hat{x} = \mbox{div} (\mathcal{G}_0)\\\\ &amp; (-I_m) \hat{x} \leq 0_{m}\\\\\end{array}' title='\begin{array}{ll} \text{minimize} &amp; \displaystyle 1_{m}^T \hat{x}\\\\ \text{subject to} &amp; (1_n^T \otimes I_n) (I_{n^2} - P) R^T \hat{x} = \mbox{div} (\mathcal{G}_0)\\\\ &amp; (-I_m) \hat{x} \leq 0_{m}\\\\\end{array}' class='latex' /></p>
<p>where we now have <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> equality constraints (divergences at the nodes), and <img src='http://l.wordpress.com/latex.php?latex=m&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m' title='m' class='latex' /> inequality constrains (<img src='http://l.wordpress.com/latex.php?latex=x_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ij} \geq 0' title='x_{ij} \geq 0' class='latex' />). My intuition tells me that</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%281_n%5ET+%5Cotimes+I_n%29+%28I_%7Bn%5E2%7D+-+P%29+R%5ET+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D+%281_n%5ET+%5Cotimes+e_1%5ET%29+-+%28e_1%5ET+%5Cotimes+1_n%5ET%29%5C%5C+%281_n%5ET+%5Cotimes+e_2%5ET%29+-+%28e_2%5ET+%5Cotimes+1_n%5ET%29%5C%5C+%5Cvdots%5C%5C+%281_n%5ET+%5Cotimes+e_n%5ET%29+-+%28e_n%5ET+%5Cotimes+1_n%5ET%29%5C%5C%5Cend%7Barray%7D%5Cright%5D+R%5ET&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(1_n^T \otimes I_n) (I_{n^2} - P) R^T = \left[\begin{array}{c} (1_n^T \otimes e_1^T) - (e_1^T \otimes 1_n^T)\\ (1_n^T \otimes e_2^T) - (e_2^T \otimes 1_n^T)\\ \vdots\\ (1_n^T \otimes e_n^T) - (e_n^T \otimes 1_n^T)\\\end{array}\right] R^T' title='(1_n^T \otimes I_n) (I_{n^2} - P) R^T = \left[\begin{array}{c} (1_n^T \otimes e_1^T) - (e_1^T \otimes 1_n^T)\\ (1_n^T \otimes e_2^T) - (e_2^T \otimes 1_n^T)\\ \vdots\\ (1_n^T \otimes e_n^T) - (e_n^T \otimes 1_n^T)\\\end{array}\right] R^T' class='latex' /></p>
<p>is an <a href="http://en.wikipedia.org/wiki/Incidence_matrix" target="_blank">incidence matrix</a> of the directed <a href="http://en.wikipedia.org/wiki/Complete_graph" target="_blank">complete graph</a> on node set <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' />. What do you think? Do you agree?</p>
<p style="text-align:center;">__________</p>
<p><strong>A Numerical Example</strong></p>
<p>Consider a network of <img src='http://l.wordpress.com/latex.php?latex=n+%3D+10&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 10' title='n = 10' class='latex' /> agents whose debts are represented by the following IOU graph (with <img src='http://l.wordpress.com/latex.php?latex=15&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='15' title='15' class='latex' /> edges)</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-15-edges.png"><img class="size-full wp-image-4403 aligncenter" title="IOU graph - 10 nodes and 15 edges" src="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-15-edges.png?w=450&#038;h=321" alt="IOU graph - 10 nodes and 15 edges" width="450" height="321" /></a>The IOU matrix associated with this given IOU graph is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=Y+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bcccccccccc%7D+0+%26+0+%26+0+%26+20+%26+20+%26+5+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+10+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+5+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+10+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+5+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+10+%26+0+%26+0+%26+0+%26+0%5C%5C+5+%26+20+%26+0+%26+0+%26+0+%26+0+%26+5+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+20+%26+0+%26+10%5C%5C+0+%26+5+%26+15+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Y = \left[\begin{array}{cccccccccc} 0 &amp; 0 &amp; 0 &amp; 20 &amp; 20 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 5 &amp; 20 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 20 &amp; 0 &amp; 10\\ 0 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ \end{array}\right]' title='Y = \left[\begin{array}{cccccccccc} 0 &amp; 0 &amp; 0 &amp; 20 &amp; 20 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 10 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 5 &amp; 20 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 5 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 20 &amp; 0 &amp; 10\\ 0 &amp; 5 &amp; 15 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ \end{array}\right]' class='latex' /></p>
<p>Solving the linear program, we obtain a new IOU matrix</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=X+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bcccccccccc%7D+0+%26+6.097+%26+3.924+%26+10.776+%26+10.776+%26+8.427+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+0.850+%26+0.644+%26+1.234+%26+1.234+%26+1.039+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+1.690+%26+1.185+%26+2.505+%26+2.505+%26+2.114+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+4.672+%26+3.063+%26+7.980+%26+7.980+%26+6.306+%26+0+%26+0+%26+0+%26+0%5C%5C+0+%26+1.690+%26+1.185+%26+2.505+%26+2.505+%26+2.114+%26+0+%26+0+%26+0+%26+0%5C%5C%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X = \left[\begin{array}{cccccccccc} 0 &amp; 6.097 &amp; 3.924 &amp; 10.776 &amp; 10.776 &amp; 8.427 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0.850 &amp; 0.644 &amp; 1.234 &amp; 1.234 &amp; 1.039 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1.690 &amp; 1.185 &amp; 2.505 &amp; 2.505 &amp; 2.114 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 4.672 &amp; 3.063 &amp; 7.980 &amp; 7.980 &amp; 6.306 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1.690 &amp; 1.185 &amp; 2.505 &amp; 2.505 &amp; 2.114 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\\end{array}\right]' title='X = \left[\begin{array}{cccccccccc} 0 &amp; 6.097 &amp; 3.924 &amp; 10.776 &amp; 10.776 &amp; 8.427 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 0.850 &amp; 0.644 &amp; 1.234 &amp; 1.234 &amp; 1.039 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1.690 &amp; 1.185 &amp; 2.505 &amp; 2.505 &amp; 2.114 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 4.672 &amp; 3.063 &amp; 7.980 &amp; 7.980 &amp; 6.306 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\ 0 &amp; 1.690 &amp; 1.185 &amp; 2.505 &amp; 2.505 &amp; 2.114 &amp; 0 &amp; 0 &amp; 0 &amp; 0\\\end{array}\right]' class='latex' /></p>
<p>which is the adjacency matrix of a new IOU graph. The given IOU graph and the new IOU graph are <span style="text-decoration:underline;">equi-divergent</span>. The given IOU graph had <img src='http://l.wordpress.com/latex.php?latex=15&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='15' title='15' class='latex' /> edges and a total of <img src='http://l.wordpress.com/latex.php?latex=165&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='165' title='165' class='latex' /> flowing in it, while the new IOU graph has <img src='http://l.wordpress.com/latex.php?latex=25&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='25' title='25' class='latex' /> edges and a total of <img src='http://l.wordpress.com/latex.php?latex=95&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='95' title='95' class='latex' /> flowing in it. While the flow of money has been reduced, the number of edges (i.e., the number of transactions) has increased dramatically!!</p>
<p>On my previous <a href="http://stochastix.wordpress.com/2009/06/20/optimal-account-balancing/" target="_blank">post</a> on this topic, I gave two very simple examples, and in both of them the <span style="text-decoration:underline;">minimum money flow</span> solution also yielded the <span style="text-decoration:underline;">least number of transactions</span>. I wondered back then if that was always the case. This example clearly shows that it is not. Generally speaking, not only does the minimum money flow criterion fail to minimize the number of transactions, but it can actually result in more transactions than the ones in the initial IOU graph. I cannot think of any reason why minimizing the total amount of money flowing in the IOU graph at the cost of a larger number of transactions would be a good idea&#8230;</p>
<p>Therefore, the next step is to abandon the <span style="text-decoration:underline;">minimum money flow</span> criterion, and focus solely on the <span style="text-decoration:underline;">least number of transactions</span>. Minimizing the number of transactions is a hard combinatorial problem, but maybe there are approximation algorithms that make the problem tractable.</p>
Posted in Operations Research Tagged: Accounting, IOU Graphs, Operations Research <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4339/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4339&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/28/optimal-account-balancing-ii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-20-edges.png" medium="image">
			<media:title type="html">IOU graph - 10 nodes and 20 edges</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/iou-graph-10-nodes-and-15-edges.png" medium="image">
			<media:title type="html">IOU graph - 10 nodes and 15 edges</media:title>
		</media:content>
	</item>
		<item>
		<title>Analytical Geometry with POV-Ray</title>
		<link>http://stochastix.wordpress.com/2009/07/28/analytical-geometry-with-pov-ray/</link>
		<comments>http://stochastix.wordpress.com/2009/07/28/analytical-geometry-with-pov-ray/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 12:45:54 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Geometry]]></category>
		<category><![CDATA[Analytical Geometry]]></category>
		<category><![CDATA[Computer Graphics]]></category>
		<category><![CDATA[Friedrich A. Lohmueller]]></category>
		<category><![CDATA[Mathematical Art]]></category>
		<category><![CDATA[POV-Ray]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4386</guid>
		<description><![CDATA[If you would like to use POV-Ray to visualize 3-dimensional geometrical objects, I highly recommend Friedrich A. Lohmueller&#8217;s beautiful tutorial on Analytical Geometry with POV-Ray. Other POV-Ray tutorials by Friedrich A. Lohmueller can be found here.

[ image courtesy of Friedrich A. Lohmueller ]
In my humble opinion, this is how Analytical Geometry should be taught. Descartes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4386&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you would like to use <a href="http://www.povray.org" target="_blank">POV-Ray</a> to visualize 3-dimensional geometrical objects, I highly recommend <a href="http://f-lohmueller.de" target="_blank">Friedrich A. Lohmueller</a>&#8217;s beautiful tutorial on <a href="http://f-lohmueller.de/pov_tut/a_geo/a_geo__e.htm" target="_blank">Analytical Geometry with POV-Ray</a>. Other POV-Ray tutorials by Friedrich A. Lohmueller can be found <a href="http://f-lohmueller.de/pov_tut/pov__eng.htm" target="_blank">here</a>.</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/07/the-shadow-of-a-pyramid-by-friedrich-a-lohmueller-2007.jpg"><img class="size-full wp-image-4385 aligncenter" style="border:1px solid black;" title="The Shadow of a Pyramid (by Friedrich A. Lohmueller, 2007)" src="http://stochastix.files.wordpress.com/2009/07/the-shadow-of-a-pyramid-by-friedrich-a-lohmueller-2007.jpg?w=450&#038;h=300" alt="The Shadow of a Pyramid (by Friedrich A. Lohmueller, 2007)" width="450" height="300" /></a></p>
<p style="text-align:center;">[ <a href="http://f-lohmueller.de/pov_tut/a_geo/a_geo_pyramid_shadow01_im.htm" target="_blank">image</a> courtesy of Friedrich A. Lohmueller ]</p>
<p>In my humble opinion, this is how <a href="http://en.wikipedia.org/wiki/Analytic_geometry" target="_blank">Analytical Geometry</a> should be taught. <a href="http://en.wikipedia.org/wiki/Ren%C3%A9_Descartes" target="_blank">Descartes</a> had no access to 3-d graphics. We do. Why not take advantage of the technology?</p>
Posted in Art, Geometry Tagged: Analytical Geometry, Art, Computer Graphics, Friedrich A. Lohmueller, Geometry, Mathematical Art, POV-Ray <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4386/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4386&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/28/analytical-geometry-with-pov-ray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/the-shadow-of-a-pyramid-by-friedrich-a-lohmueller-2007.jpg" medium="image">
			<media:title type="html">The Shadow of a Pyramid (by Friedrich A. Lohmueller, 2007)</media:title>
		</media:content>
	</item>
		<item>
		<title>Information, Physics and Computation</title>
		<link>http://stochastix.wordpress.com/2009/07/20/information-physics-and-computation/</link>
		<comments>http://stochastix.wordpress.com/2009/07/20/information-physics-and-computation/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 04:39:14 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Information Theory]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Andrea Montanari]]></category>
		<category><![CDATA[Belief Propagation]]></category>
		<category><![CDATA[Coding Theory]]></category>
		<category><![CDATA[Error-Correcting Codes]]></category>
		<category><![CDATA[Factor Graphs]]></category>
		<category><![CDATA[Graphical Models]]></category>
		<category><![CDATA[Marc Mézard]]></category>
		<category><![CDATA[Statistical Physics]]></category>
		<category><![CDATA[Theoretical Computer Science]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4329</guid>
		<description><![CDATA[Andrea Montanari and Marc Mézard have written a book: Information, Physics and Computation. It is a unique, ambitious book which covers the exciting intersection of Statistical Physics,  Theoretical Computer Science, Discrete Mathematics, Information Theory, and Coding Theory.

[ graphs courtesy of Montanari &#38; Mézard ]
The book was published recently. Hopefully, the PDF files will continue to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4329&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.stanford.edu/~montanar" target="_blank">Andrea Montanari</a> and <a href="http://www.lptms.u-psud.fr/membres/mezard/" target="_blank">Marc Mézard</a> have written a book: <a href="http://www.stanford.edu/~montanar/BOOK/book.html" target="_blank">Information, Physics and Computation</a>. It is a unique, ambitious book which covers the exciting intersection of Statistical Physics,  Theoretical Computer Science, Discrete Mathematics, Information Theory, and Coding Theory.</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/07/parity-check-code-factor-graph-small.png"><img class="alignnone size-full wp-image-4336" title="parity check code &amp; factor graph (small)" src="http://stochastix.files.wordpress.com/2009/07/parity-check-code-factor-graph-small.png?w=431&#038;h=229" alt="parity check code &amp; factor graph (small)" width="431" height="229" /></a></p>
<p style="text-align:center;">[ graphs courtesy of <a href="http://www.stanford.edu/~montanar" target="_blank">Montanari</a> &amp; <a href="http://www.lptms.u-psud.fr/membres/mezard/" target="_blank">Mézard</a> ]</p>
<p>The book was published recently. Hopefully, the PDF files will continue to be available <a href="http://www.stanford.edu/~montanar/BOOK/book.html" target="_blank">online</a>. If you liked <a href="http://www.inference.phy.cam.ac.uk/mackay/" target="_blank">David MacKay</a>&#8217;s gorgeous <a href="http://www.inference.phy.cam.ac.uk/mackay/itila/" target="_blank">book</a>, you will probably like this one too.</p>
Posted in Books, Computer Science, Information Theory, Physics Tagged: Andrea Montanari, Belief Propagation, Books, Coding Theory, Error-Correcting Codes, Factor Graphs, Graphical Models, Information Theory, Marc Mézard, Statistical Physics, Theoretical Computer Science <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4329/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4329&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/20/information-physics-and-computation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/parity-check-code-factor-graph-small.png" medium="image">
			<media:title type="html">parity check code &#38; factor graph (small)</media:title>
		</media:content>
	</item>
		<item>
		<title>The virtual Apollo Guidance Computer</title>
		<link>http://stochastix.wordpress.com/2009/07/20/the-virtual-apollo-guidance-computer/</link>
		<comments>http://stochastix.wordpress.com/2009/07/20/the-virtual-apollo-guidance-computer/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 03:40:13 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Aerospace]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Apollo 11]]></category>
		<category><![CDATA[Apollo Guidance Computer]]></category>
		<category><![CDATA[Apollo program]]></category>
		<category><![CDATA[Astronautics]]></category>
		<category><![CDATA[NASA]]></category>
		<category><![CDATA[Vintage Computers]]></category>
		<category><![CDATA[Vintage Software]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4304</guid>
		<description><![CDATA[I remember on the trip home on Apollo 11 it suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn&#8217;t feel like a giant. I felt very, very small.
-Neil Armstrong [1]
On this day [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4304&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="padding-left:150px;"><em>I remember on the trip home on Apollo 11 it suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn&#8217;t feel like a giant. I felt very, very small.</em></p>
<p style="padding-left:150px;">-<a href="http://en.wikipedia.org/wiki/Neil_Armstrong" target="_blank">Neil Armstrong</a> [1]</p>
<p>On this day 40 years ago, the Apollo 11&#8217;s <em>Eagle</em> <a href="http://en.wikipedia.org/wiki/Apollo_Lunar_Module" target="_blank">lunar module</a> landed on the Moon. As <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" target="_blank">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" target="_blank">Buzz Aldrin</a> became the first humans to walk on the lunar surface, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" target="_blank">Michael Collins</a> orbited the Moon inside the <em>Columbia</em> <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" target="_blank">command module</a>, experiencing &#8220;an aloneness unknown to man before&#8221;, as aviator Charles Lindbergh put it [2].</p>
<p style="text-align:center;"><a title="The Apollo 11 crew portrait. Left to right are Armstrong, Michael Collins, and Buzz Aldrin." href="http://stochastix.files.wordpress.com/2009/07/apollo-11-crew.jpg"><img class="size-full wp-image-4305 aligncenter" style="border:1px solid black;" title="The Apollo 11 crew portrait. Left to right are Armstrong, Michael Collins, and Buzz Aldrin." src="http://stochastix.files.wordpress.com/2009/07/apollo-11-crew.jpg?w=405&#038;h=322" alt="The Apollo 11 crew portrait. Left to right are Armstrong, Michael Collins, and Buzz Aldrin." width="405" height="322" /></a></p>
<p style="text-align:center;">[ <a href="http://en.wikipedia.org/wiki/File:Apollo_11.jpg" target="_blank">photo</a> courtesy of <a href="http://en.wikipedia.org/wiki/NASA" target="_blank">NASA</a> ]</p>
<p>The <a href="http://en.wikipedia.org/wiki/Apollo_program" target="_blank">Apollo program</a> was an enormous technical achievement. I shall forever be amazed at how the engineers who worked on this program managed to accomplish so much with the technology they had available at the time. The <a href="http://en.wikipedia.org/wiki/Rocket_engine" target="_blank">rocket engine</a> was a relatively recent technology back then, the <a href="http://en.wikipedia.org/wiki/Transistor" target="_blank">transistor</a> had been invented in 1947, the <a href="http://en.wikipedia.org/wiki/Integrated_circuit" target="_blank">integrated circuit</a> had been invented in 1958, and the <a href="http://en.wikipedia.org/wiki/Microprocessor" target="_blank">microprocessor</a> had not even been invented yet. In particular, the <a href="http://en.wikipedia.org/wiki/Apollo_Guidance_Computer" target="_blank">Apollo Guidance Computer</a> (AGC) was a wonderful work of ingenuity: it was the world&#8217;s first modern real-time embedded system, and it led to the development of <a href="http://en.wikipedia.org/wiki/Aircraft_flight_control_systems#Fly-by-wire_control_systems" target="_blank">fly-by-wire</a> systems.</p>
<p>To commemorate the <a href="http://www.nasa.gov/mission_pages/apollo/40th/events.html" target="_blank">40th anniversary</a> of the <a href="http://en.wikipedia.org/wiki/Apollo_11" target="_blank">Apollo 11</a> mission, the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" target="_blank">command module</a> code (<em>Comanche054</em>) and the <a href="http://en.wikipedia.org/wiki/Apollo_Lunar_Module" target="_blank">lunar module</a> code (<em>Luminary099</em>) have been transcribed from scanned images by the <a href="http://www.ibiblio.org/apollo/" target="_blank">Virtual AGC and AGS</a> project! [3] The code can be found <a href="http://code.google.com/p/virtualagc/" target="_blank">here</a>.</p>
<p>For example, take a look at the following modules: <a href="http://code.google.com/p/virtualagc/source/browse/trunk/Luminary099/ASCENT_GUIDANCE.agc" target="_blank">ascent guidance</a>, <a href="http://code.google.com/p/virtualagc/source/browse/trunk/Luminary099/KALMAN_FILTER.agc" target="_blank">Kalman filter</a>, <a href="http://code.google.com/p/virtualagc/source/browse/trunk/Luminary099/BURN_BABY_BURN--MASTER_IGNITION_ROUTINE.agc" target="_blank">master ignition routine</a>. Yes, programming the <a href="http://en.wikipedia.org/wiki/Apollo_Guidance_Computer" target="_blank">AGC</a> seems to have been a spartan endeavor! ;-) If you happen to dislike vintage assembly programming languages, take a look at the <a href="http://code.google.com/p/virtualagc/source/browse/#svn/trunk/yaAGC" target="_blank">yaAGC</a> code, which is written in <a href="http://en.wikipedia.org/wiki/C_(programming_language)" target="_blank">C</a>.</p>
<p style="text-align:center;">__________</p>
<p>References:</p>
<p style="padding-left:30px;">[1] <a href="http://www.time.com/time/magazine/article/0,9171,878100-1,00.html" target="_blank">The Greening of the Astronauts</a> (Dec. 1972)</p>
<p style="padding-left:30px;">[2] <a href="http://www.guardian.co.uk/science/2009/jul/19/michael-collins-astronaut-apollo11" target="_blank">How Michael Collins became the forgotten astronaut of Apollo 11</a> (July 2009)</p>
<p style="padding-left:30px;">[3] <a href="http://googlecode.blogspot.com/2009/07/apollo-11-missions-40th-anniversary-one.html" target="_blank">Apollo 11 mission&#8217;s 40th Anniversary: One large step for open source code&#8230; </a>(July 2009)</p>
Posted in Aerospace, Software Tagged: Aerospace, Apollo 11, Apollo Guidance Computer, Apollo program, Astronautics, NASA, Software, Vintage Computers, Vintage Software <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4304/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4304&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/20/the-virtual-apollo-guidance-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/apollo-11-crew.jpg" medium="image">
			<media:title type="html">The Apollo 11 crew portrait. Left to right are Armstrong, Michael Collins, and Buzz Aldrin.</media:title>
		</media:content>
	</item>
		<item>
		<title>The discovery of Carbon-60</title>
		<link>http://stochastix.wordpress.com/2009/07/17/the-discovery-of-carbon-60/</link>
		<comments>http://stochastix.wordpress.com/2009/07/17/the-discovery-of-carbon-60/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 04:04:51 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Chemistry]]></category>
		<category><![CDATA[Buckminsterfullerene]]></category>
		<category><![CDATA[Carbon]]></category>
		<category><![CDATA[Carbon-60]]></category>
		<category><![CDATA[Donald R. Huffman]]></category>
		<category><![CDATA[Harold W. Kroto]]></category>
		<category><![CDATA[James R. Heath]]></category>
		<category><![CDATA[Richard E. Smalley]]></category>
		<category><![CDATA[Robert F. Curl Jr.]]></category>
		<category><![CDATA[Sean C. O'Brien]]></category>
		<category><![CDATA[Wolfgang Krätschmer]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4278</guid>
		<description><![CDATA[When I first studied Chemistry, I learned that there are two allotropes of carbon: graphite and diamond. As you know, these two forms of pure carbon have dramatically different mechanical, electrical, optical and thermal properties. Then, in the early 1990s, I read with excitement about a new form of pure carbon, carbon-60, which consists of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4278&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When I first studied Chemistry, I learned that there are two <a href="http://en.wikipedia.org/wiki/Allotropy" target="_blank">allotropes</a> of carbon: <a href="http://en.wikipedia.org/wiki/Graphite" target="_blank">graphite</a> and <a href="http://en.wikipedia.org/wiki/Diamond" target="_blank">diamond</a>. As you know, these two forms of pure carbon have dramatically different mechanical, electrical, optical and thermal properties. Then, in the early 1990s, I read with excitement about a new form of pure carbon, <a href="http://en.wikipedia.org/wiki/C60" target="_blank">carbon-60</a>, which consists of 60 carbon atoms bonded together in a polyhedral structure which resembles a soccer ball:</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/07/c60.png"><img class="size-full wp-image-4279 aligncenter" title="C60" src="http://stochastix.files.wordpress.com/2009/07/c60.png?w=263&#038;h=257" alt="C60" width="263" height="257" /></a></p>
<p style="text-align:center;">[ <a href="http://en.wikipedia.org/wiki/File:C60a.png" target="_blank">image source</a> ]</p>
<p>This novel molecule was named <em>Buckminsterfullerene</em> (after <a href="http://en.wikipedia.org/wiki/Buckminster_Fuller" target="_blank">Buckminster Fuller</a>), and is colloquially called <em>buckyball</em>. The beautiful carbon-60 molecule was discovered in the mid-1980s at <a href="http://en.wikipedia.org/wiki/Rice_University" target="_blank">Rice University</a> by <a href="http://en.wikipedia.org/wiki/Robert_Curl" target="_blank">Robert F. Curl Jr.</a>, <a href="http://www.its.caltech.edu/%7Eheathgrp" target="_blank">James R. Heath</a>, Sir <a href="http://en.wikipedia.org/wiki/Harold_Kroto" target="_blank">Harold W. Kroto</a>, Sean C. O&#8217;Brien, and <a href="http://en.wikipedia.org/wiki/Richard_Smalley" target="_blank">Richard E. Smalley</a> by vaporizing carbon with a laser beam and allowing the carbon atoms to reconstitute in clusters with a &#8220;soccer-ball-like&#8221; structure. The following documentary (divided in 5 parts) tells the exciting story of this discovery:</p>
<p style="text-align:center;">[ <a href="http://www.youtube.com/watch?v=QVGryuO7zC4" target="_blank">part 1</a> | <a href="http://www.youtube.com/watch?v=B__NJSL7Yk4" target="_blank">part 2</a> | <a href="http://www.youtube.com/watch?v=3TPJ8UVHzVQ" target="_blank">part 3</a> | <a href="http://www.youtube.com/watch?v=Cja9HJ0C8p8" target="_blank">part 4</a> | <a href="http://www.youtube.com/watch?v=SH_g4Qxb8B8" target="_blank">part 5</a> ]</p>
<p>In 1996, Bob Curl, Harry Kroto and Rick Smalley won the <a href="http://nobelprize.org/nobel_prizes/chemistry/laureates/1996/index.html" target="_blank">Nobel prize in Chemistry</a> for the discovery of carbon-60.</p>
<p><span style="text-decoration:underline;">Hat tip</span>: <a href="http://onionesquereality.wordpress.com/" target="_blank">Shubhendu Trivedi</a></p>
<p style="text-align:center;">__________</p>
<p>Related:</p>
<ul>
<li><a href="http://thesciencenetwork.org/programs/the-science-studio/art-buckyballs-and-chemistry-the-abcs-of-discovery" target="_blank">Art, buckyballs and chemistry: the ABCs of discovery. A conversation with Nobel Laureate Sir Harold Kroto</a> (Nov. 2, 2007)</li>
</ul>
Posted in Chemistry Tagged: Buckminsterfullerene, Carbon, Carbon-60, Chemistry, Donald R. Huffman, Harold W. Kroto, James R. Heath, Richard E. Smalley, Robert F. Curl Jr., Sean C. O'Brien, Wolfgang Krätschmer <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4278/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4278&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/17/the-discovery-of-carbon-60/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/c60.png" medium="image">
			<media:title type="html">C60</media:title>
		</media:content>
	</item>
		<item>
		<title>Matching plus Allocation</title>
		<link>http://stochastix.wordpress.com/2009/07/09/matching-plus-allocation/</link>
		<comments>http://stochastix.wordpress.com/2009/07/09/matching-plus-allocation/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 23:12:28 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Combinatorial Optimization]]></category>
		<category><![CDATA[Recreational Mathematics]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4248</guid>
		<description><![CDATA[Suppose we are given  red balls and  black balls. All of these balls are labeled with a real number. For example
We now pair red balls with black balls. There are  such matchings, as illustrated below

Additionally, suppose that a pair composed of a red ball with label  and a black ball with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4248&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Suppose we are given <img src='http://l.wordpress.com/latex.php?latex=n+%3D+3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 3' title='n = 3' class='latex' /> red balls and <img src='http://l.wordpress.com/latex.php?latex=n+%3D+3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 3' title='n = 3' class='latex' /> black balls. All of these balls are labeled with a real number. For example</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/red-black-balls.png"><img class="size-full wp-image-4249 aligncenter" title="Red + Black balls" src="http://stochastix.files.wordpress.com/2009/07/red-black-balls.png?w=151&#038;h=169" alt="Red + Black balls" width="151" height="169" /></a>We now pair red balls with black balls. There are <img src='http://l.wordpress.com/latex.php?latex=n%21+%3D+3%21+%3D+6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n! = 3! = 6' title='n! = 3! = 6' class='latex' /> such matchings, as illustrated below</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/6-matchings.png"><img class="size-full wp-image-4252 aligncenter" title="6 matchings" src="http://stochastix.files.wordpress.com/2009/07/6-matchings.png?w=450&#038;h=350" alt="6 matchings" width="450" height="350" /></a></p>
<p>Additionally, suppose that a pair composed of a <span style="text-decoration:underline;">red</span> ball with label <img src='http://l.wordpress.com/latex.php?latex=r+%5Cin+%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r \in \mathbb{R}' title='r \in \mathbb{R}' class='latex' /> and a <span style="text-decoration:underline;">black</span> ball with label <img src='http://l.wordpress.com/latex.php?latex=b+%5Cin+%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='b \in \mathbb{R}' title='b \in \mathbb{R}' class='latex' /> can be exchanged for a <span style="text-decoration:underline;">white</span> ball with label <img src='http://l.wordpress.com/latex.php?latex=b+-+r&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='b - r' title='b - r' class='latex' />. For example</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/3-reds-3-blacks-produce-3-whites.png"><img class="size-full wp-image-4254 aligncenter" title="3 reds &amp; 3 blacks produce 3 whites" src="http://stochastix.files.wordpress.com/2009/07/3-reds-3-blacks-produce-3-whites.png?w=315&#038;h=179" alt="3 reds &amp; 3 blacks produce 3 whites" width="315" height="179" /></a>Since there are <img src='http://l.wordpress.com/latex.php?latex=3%21+%3D+6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3! = 6' title='3! = 6' class='latex' /> matchings, in general there will be <img src='http://l.wordpress.com/latex.php?latex=6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6' title='6' class='latex' /> collections of <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' /> white balls, as depicted below</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/6x3-white-balls.png"><img class="size-full wp-image-4257 aligncenter" title="6x3 white balls" src="http://stochastix.files.wordpress.com/2009/07/6x3-white-balls.png?w=329&#038;h=315" alt="6x3 white balls" width="329" height="315" /></a>Note that the sum of the labels of the white balls is always <img src='http://l.wordpress.com/latex.php?latex=6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6' title='6' class='latex' />, regardless of the matching. This is due to the fact that <a href="http://en.wikipedia.org/wiki/Addition" target="_blank">addition</a> is commutative and associative. Note also that the <img src='http://l.wordpress.com/latex.php?latex=3%21+%3D+6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3! = 6' title='3! = 6' class='latex' /> resulting collections of <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' /> white balls are not necessarily distinct.</p>
<p>Suppose now that we would like to allocate the <img src='http://l.wordpress.com/latex.php?latex=n+%3D+3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 3' title='n = 3' class='latex' /> white balls to <img src='http://l.wordpress.com/latex.php?latex=m+%3D+2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m = 2' title='m = 2' class='latex' /> bowls such that the sum of the labels of the white balls in each bowl is 50% of the total sum of the labels of the white balls. Pictorially, we have</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/123-50-50-allocation.png"><img class="size-full wp-image-4261 aligncenter" title="123-50-50 allocation" src="http://stochastix.files.wordpress.com/2009/07/123-50-50-allocation.png?w=450&#038;h=259" alt="123-50-50 allocation" width="450" height="259" /></a>and, since the sum of the labels of the white balls in each bowl is exactly <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />, the allocation is <em>feasible</em>. Nonetheless, this allocation is not unique: we could also have allocated ball with label 3 to bowl 1 and balls with labels 1 and 2 to bowl 2. If we wanted to allocate 1/3 of the total to bowl 1 and 2/3 of the total to bowl 2, we could have allocated ball with label 2 to bowl 1, and balls with labels 1 and 3 to bowl 2, for instance. This allocation would also be feasible.</p>
<p>However, not all desired allocations are feasible. For example, suppose that we want to allocate 90% to bowl 1 and 10% to bowl 2. This allocation is <em>unfeasible</em>. We can allocate a total of 5 to bowl 1 and 1 to bowl 2, which corresponds to 83.3% and 16.7% instead of 90% and 10%.</p>
<p><a href="http://stochastix.files.wordpress.com/2009/07/123-90-10-allocation.png"><img class="size-full wp-image-4263 aligncenter" title="123-90-10 allocation" src="http://stochastix.files.wordpress.com/2009/07/123-90-10-allocation.png?w=450&#038;h=258" alt="123-90-10 allocation" width="450" height="258" /></a>Though we cannot attain the desired allocation exactly, we are able to get relatively &#8220;close&#8221; to it. We could use, for instance, a quadratic criterion to measure how &#8220;far&#8221; a particular allocation is from the desired one.</p>
<p>In each bowl we are attempting to reconstruct a given real number from a finite collection of real numbers. Hence, the <em>unfeasibility</em> of a desired allocation stems from the &#8220;chunkiness&#8221; of the &#8220;parts&#8221; we have at our disposal. But here is the interesting aspect of this problem: we can change the &#8220;parts&#8221; (i.e., the white balls) by matching the red and black balls in a different way. Therefore, <span style="text-decoration:underline;">allocation</span> can not be &#8220;decoupled&#8221; from <span style="text-decoration:underline;">matching</span>, so to say. The two operations are now intertwined. When performing the matching, we should strive to build a good collection of white balls so that the actual allocation is as &#8220;close&#8221; as possible to the desired one.</p>
<p>If we have <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> red balls and <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> black balls, then there are <img src='http://l.wordpress.com/latex.php?latex=n%21&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n!' title='n!' class='latex' /> matchings. Each red-black pair is then allocated to one of <img src='http://l.wordpress.com/latex.php?latex=m+%5Cleq+n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m \leq n' title='m \leq n' class='latex' /> bowls. Hence, our search space has <img src='http://l.wordpress.com/latex.php?latex=n%21+m%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n! m^n' title='n! m^n' class='latex' /> points, and an <a href="http://en.wikipedia.org/wiki/Brute-force_search" target="_blank">exhaustive search</a> will run in time <img src='http://l.wordpress.com/latex.php?latex=O%28n%21+m%5En%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='O(n! m^n)' title='O(n! m^n)' class='latex' /> which is intractable for &#8220;large&#8221; values of <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />. For example, if <img src='http://l.wordpress.com/latex.php?latex=n+%3D+10&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n = 10' title='n = 10' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=m+%3D+3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m = 3' title='m = 3' class='latex' />, the search space has over <img src='http://l.wordpress.com/latex.php?latex=200&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='200' title='200' class='latex' /> billion points! Yet once again, we are doomed by the curse of <a href="http://en.wikipedia.org/wiki/Combinatorial_explosion" target="_blank">combinatorial explosion</a>.</p>
<p>Our challenge (and only hope) is to <span style="text-decoration:underline;">design a heuristic-based algorithm</span> which, although not optimal, is &#8220;good enough&#8221; most of the time. Any ideas?</p>
<p>This problem seems to have some of the ingredients of many classical problems such as <a href="http://en.wikipedia.org/wiki/Partition_(number_theory)" target="_blank">integer partitions</a>, <a href="http://en.wikipedia.org/wiki/Knapsack_problem" target="_blank">knapsack</a>, and bipartite / tripartite <a href="http://en.wikipedia.org/wiki/Matching_problem" target="_blank">matching</a>. It is not difficult to formulate the problem as a constrained quadratic binary optimization problem, but solving it is hard.</p>
Posted in Computer Science Tagged: Combinatorial Optimization, Recreational Mathematics <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4248/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4248&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/07/09/matching-plus-allocation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/red-black-balls.png" medium="image">
			<media:title type="html">Red + Black balls</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/6-matchings.png" medium="image">
			<media:title type="html">6 matchings</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/3-reds-3-blacks-produce-3-whites.png" medium="image">
			<media:title type="html">3 reds &#38; 3 blacks produce 3 whites</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/6x3-white-balls.png" medium="image">
			<media:title type="html">6x3 white balls</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/123-50-50-allocation.png" medium="image">
			<media:title type="html">123-50-50 allocation</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/07/123-90-10-allocation.png" medium="image">
			<media:title type="html">123-90-10 allocation</media:title>
		</media:content>
	</item>
		<item>
		<title>Optimal Account Balancing</title>
		<link>http://stochastix.wordpress.com/2009/06/20/optimal-account-balancing/</link>
		<comments>http://stochastix.wordpress.com/2009/06/20/optimal-account-balancing/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 03:38:15 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Operations Research]]></category>
		<category><![CDATA[Accounting]]></category>
		<category><![CDATA[CVXOPT]]></category>
		<category><![CDATA[IOU Graphs]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4079</guid>
		<description><![CDATA[Suppose that Alice owes Bob $5 and is owed $10 by Bob. These debts can be represented as the weighted directed graph
which we will call an IOU graph. Alice pays Bob $5 and Bob pays Alice $10. The debts are paid and $15 have been exchanged in a total of two transactions. Let us now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4079&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Suppose that Alice owes Bob $5 and is owed $10 by Bob. These debts can be represented as the weighted directed <a href="http://en.wikipedia.org/wiki/Graph_(mathematics)" target="_blank">graph</a></p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob.png"><img class="size-full wp-image-4123 aligncenter" title="IOU graph - Alice and Bob" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob.png?w=302&#038;h=114" alt="IOU graph - Alice and Bob" width="302" height="114" /></a>which we will call an <em><a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph</em>. Alice pays Bob $5 and Bob pays Alice $10. The debts are paid and $15 have been exchanged in a total of two transactions. Let us now consider the following <a href="http://en.wikipedia.org/wiki/Cash_flow" target="_blank">cash flow</a> diagram</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob.png"><img class="size-full wp-image-4129 aligncenter" title="FBD - Alice and Bob" src="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob.png?w=315&#038;h=73" alt="FBD - Alice and Bob" width="315" height="73" /></a>and, accounting for the net cash flows, we obtain</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob-2.png"><img class="size-full wp-image-4131 aligncenter" title="FBD - Alice and Bob 2" src="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob-2.png?w=315&#038;h=69" alt="FBD - Alice and Bob 2" width="315" height="69" /></a>which illustrates that if Bob paid Alice $5, then the debts would still be paid, though only $5 would be exchanged and only one transaction would be made. This looks much cleverer and more efficient than exchanging $15 in a total of two transactions. Hence, the following IOU graph</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob-2.png"><img class="size-full wp-image-4203 aligncenter" title="IOU graph - Alice and Bob 2" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob-2.png?w=288&#038;h=90" alt="IOU graph - Alice and Bob 2" width="288" height="90" /></a>is &#8220;equivalent&#8221; to the original IOU graph. In both IOU graphs, if debts are paid then Alice will be $5 up, while Bob will be $5 down.</p>
<p>We add a third agent, Charlie. Consider now the <a href="http://en.wikipedia.org/wiki/IOU_(debt)" target="_blank">IOU</a> graph</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png"><img class="size-full wp-image-4135 aligncenter" title="IOU graph - Alice Bob and Charlie" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png?w=315&#038;h=311" alt="IOU graph - Alice Bob and Charlie" width="315" height="311" /></a>where:</p>
<ul>
<li><span style="text-decoration:underline;">Alice</span> must pay a total of $20 and be paid a total of $30.</li>
</ul>
<ul>
<li><span style="text-decoration:underline;">Bob</span> must pay a total of $15 and be paid a total of $20.</li>
</ul>
<ul>
<li><span style="text-decoration:underline;">Charlie</span> must pay a total of $35 and be paid a total of $20.</li>
</ul>
<p>Hence, after the debts are paid, Alice will have $30 &#8211; $20 = $10 more in her account, Bob will have $20 &#8211; $15 = $5 more in his account, and Charlie will have $20 &#8211; $35 = -$15 more (= $15 less) in his account. Note that $10 + $5 &#8211; $15 = $0, i.e., money is conserved. In total, $70 have been exchanged in six transactions. We can do better than that. For example, we could pay all debts in just three transactions, as illustrated in the following IOU graph</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-2b.png"><img class="size-full wp-image-4208 aligncenter" title="iou-graph-alice-bob-and-charlie-2b" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-2b.png?w=291&#038;h=279" alt="iou-graph-alice-bob-and-charlie-2b" width="291" height="279" /></a>where a total of $20 are exchanged. Note that Alice is $10 up, Bob is $5 up, and Charlie is $15 down, just like before. We can do even better than this. If Charlie pays Bob&#8217;s debt to Alice, then all debts can be paid in just two transactions as shown in the IOU graph below</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png"><img class="size-full wp-image-4140 aligncenter" title="IOU graph - Alice Bob and Charlie 3" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png?w=302&#038;h=288" alt="IOU graph - Alice Bob and Charlie 3" width="302" height="288" /></a>where only $15 are exchanged. This is an &#8220;optimal&#8221; debt-paying scheme because the debts cannot be paid in less than two transactions, nor exchanging less than $15. Do you agree?</p>
<p style="text-align:center;">__________</p>
<p><strong>Debts and IOU Graphs</strong></p>
<p>An <a href="http://en.wikipedia.org/wiki/IOU_(debt)" target="_blank">IOU</a> graph is a weighted directed <a href="http://en.wikipedia.org/wiki/Graph_(mathematics)" target="_blank">graph</a> given by an ordered triple <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D%2C+w%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' title='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' class='latex' />, where:</p>
<ul>
<li><img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' /> is the <span style="text-decoration:underline;">node set</span>. Each node of the <a href="http://en.wikipedia.org/wiki/IOU_(debt)" target="_blank">IOU</a> graph represents a different agent.</li>
</ul>
<ul>
<li><img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BE%7D+%5Csubset+%5Cmathcal%7BN%7D+%5Ctimes+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{E} \subset \mathcal{N} \times \mathcal{N}' title='\mathcal{E} \subset \mathcal{N} \times \mathcal{N}' class='latex' /> is the <span style="text-decoration:underline;">edge set</span>. Each directed edge is an ordered pair <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j)' title='(i,j)' class='latex' />, where <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> is the edge&#8217;s tail and <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' /> is the edge&#8217;s head. If <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29+%5Cin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j) \in \mathcal{E}' title='(i,j) \in \mathcal{E}' class='latex' /> then node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes money to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />. We do not allow nodes to owe money to themselves and, therefore, for each <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \mathcal{N}' title='i \in \mathcal{N}' class='latex' /> we must have <img src='http://l.wordpress.com/latex.php?latex=%28i%2Ci%29+%5Cnotin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,i) \notin \mathcal{E}' title='(i,i) \notin \mathcal{E}' class='latex' />.</li>
</ul>
<ul>
<li><img src='http://l.wordpress.com/latex.php?latex=w%3A+%5Cmathcal%7BE%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5E%7B%2B%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w: \mathcal{E} \rightarrow \mathbb{R}^{+}' title='w: \mathcal{E} \rightarrow \mathbb{R}^{+}' class='latex' /> is a <span style="text-decoration:underline;">weight function</span> that assigns positive weights to each edge in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{E}' title='\mathcal{E}' class='latex' />. The weight of edge <img src='http://l.wordpress.com/latex.php?latex=%28i%2C+j%29+%5Cin+%5Cmathcal%7BE%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i, j) \in \mathcal{E}' title='(i, j) \in \mathcal{E}' class='latex' /> is given by <img src='http://l.wordpress.com/latex.php?latex=w%5Cleft%28+%28i%2C+j%29+%5Cright%29+%3E+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w\left( (i, j) \right) &gt; 0' title='w\left( (i, j) \right) &gt; 0' class='latex' />, and it tells us the amount of money that node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />.</li>
</ul>
<p>We define the in-neighborhood and out-neighborhood of node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> as follows</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Cmathcal%7BN%7D_i%5E%7Bin%7D+%26%3D+%5Cdisplaystyle%5C%7B+j+%5Cin+%5Cmathcal%7BN%7D+%5Cmid+%28j%2Ci%29+%5Cin+%5Cmathcal%7BE%7D%5C%7D%5C%5C%5C%5C+%5Cmathcal%7BN%7D_i%5E%7Bout%7D+%26%3D+%5Cdisplaystyle%5C%7B+j+%5Cin+%5Cmathcal%7BN%7D+%5Cmid+%28i%2Cj%29+%5Cin+%5Cmathcal%7BE%7D%5C%7D%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \mathcal{N}_i^{in} &amp;= \displaystyle\{ j \in \mathcal{N} \mid (j,i) \in \mathcal{E}\}\\\\ \mathcal{N}_i^{out} &amp;= \displaystyle\{ j \in \mathcal{N} \mid (i,j) \in \mathcal{E}\}\end{array}' title='\begin{array}{ll} \mathcal{N}_i^{in} &amp;= \displaystyle\{ j \in \mathcal{N} \mid (j,i) \in \mathcal{E}\}\\\\ \mathcal{N}_i^{out} &amp;= \displaystyle\{ j \in \mathcal{N} \mid (i,j) \in \mathcal{E}\}\end{array}' class='latex' /></p>
<p>and illustrate them below</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/06/in-out-neighborhoods1.png"><img class="alignnone size-full wp-image-4210" title="IN &amp; OUT neighborhoods" src="http://stochastix.files.wordpress.com/2009/06/in-out-neighborhoods1.png?w=450&#038;h=311" alt="IN &amp; OUT neighborhoods" width="450" height="311" /></a></p>
<p>The <span style="text-decoration:underline;">divergence</span> [1] of node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> of graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}' title='\mathcal{G}' class='latex' /> is a scalar defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D%29+%3D+%5Cdisplaystyle+%5Csum_%7Bj+%5Cin+%5Cmathcal%7BN%7D_i%5E%7Bout%7D%7D+x_%7Bij%7D+-+%5Cdisplaystyle+%5Csum_%7Bj+%5Cin+%5Cmathcal%7BN%7D_i%5E%7Bin%7D%7D+x_%7Bji%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{div}_i (\mathcal{G}) = \displaystyle \sum_{j \in \mathcal{N}_i^{out}} x_{ij} - \displaystyle \sum_{j \in \mathcal{N}_i^{in}} x_{ji}' title='\textbf{div}_i (\mathcal{G}) = \displaystyle \sum_{j \in \mathcal{N}_i^{out}} x_{ij} - \displaystyle \sum_{j \in \mathcal{N}_i^{in}} x_{ji}' class='latex' /></p>
<p>and it gives us the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to other nodes minus the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> is owed to by other nodes. The divergence of a node can be viewed as the discrete, graph-theoretic analogue of the <a href="http://en.wikipedia.org/wiki/Divergence" target="_blank">divergence operator</a> in vector calculus. We define also the <span style="text-decoration:underline;">divergence vector</span> of graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}' title='\mathcal{G}' class='latex' /> as the vector whose <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' />-th component is <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{div}_i (\mathcal{G})' title='\textbf{div}_i (\mathcal{G})' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdiv%7D+%28%5Cmathcal%7BG%7D%29+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D+%5Cvdots%5C%5C+%5Ctextbf%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D%29%5C%5C+%5Cvdots+%5C%5C+%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{div} (\mathcal{G}) = \left[\begin{array}{c} \vdots\\ \textbf{div}_i (\mathcal{G})\\ \vdots \\ \end{array}\right]' title='\textbf{div} (\mathcal{G}) = \left[\begin{array}{c} \vdots\\ \textbf{div}_i (\mathcal{G})\\ \vdots \\ \end{array}\right]' class='latex' />.</p>
<p>The divergence vector of an <a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}' title='\mathcal{G}' class='latex' /> tells us how much money each node in the graph will lose after debts have been paid. We say that two IOU graphs (on the same node set) are <span style="text-decoration:underline;">equi-divergent</span> if their divergence vectors are the same. This means that, although the debt relationships are different, both IOU graphs result in every node getting paid what he is owed and paying what he owes.</p>
<p style="text-align:center;">__________</p>
<p><strong>Optimal Account Balancing</strong></p>
<p>Suppose we are given an <a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D_0+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D_0%2C+w_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' title='\mathcal{G}_0 = (\mathcal{N}, \mathcal{E}_0, w_0)' class='latex' />. We would like to find a new IOU graph <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BG%7D+%3D+%28%5Cmathcal%7BN%7D%2C+%5Cmathcal%7BE%7D%2C+w%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' title='\mathcal{G} = (\mathcal{N}, \mathcal{E}, w)' class='latex' /> on the same node set <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' />, such that the two IOU graphs are equi-divergent</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdiv%7D+%28%5Cmathcal%7BG%7D%29+%3D+%5Ctextbf%7Bdiv%7D+%28%5Cmathcal%7BG%7D_0%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{div} (\mathcal{G}) = \textbf{div} (\mathcal{G}_0)' title='\textbf{div} (\mathcal{G}) = \textbf{div} (\mathcal{G}_0)' class='latex' />.</p>
<p>Moreover, we would like the new IOU graph to be &#8220;optimal&#8221; in some sense. I can think of the two following optimality criteria:</p>
<p style="padding-left:30px;"><strong><span style="text-decoration:underline;">minimum money flow</span>:</strong> we want to minimize the total amount of money being exchanged between the nodes. This is the same as minimizing the sum of the (positive) weights of the edges of the IOU graph.</p>
<p style="padding-left:30px;"><strong><span style="text-decoration:underline;">least number of transactions</span>:</strong> we want to minimize the total number of transactions being made. This is the same as minimizing the number of edges in the IOU graph, i.e., maximizing the sparsity of the IOU graph.</p>
<p>Can you think of other interesting optimality criteria?</p>
<p>It would be reasonable to consider the case where the <span style="text-decoration:underline;">transaction fees</span> are nonzero. If these are <span style="text-decoration:underline;">variable</span> and proportional to the amount of money being transferred, then we would like to minimize the amount of money flowing in the network of agents. If the transaction fees are <span style="text-decoration:underline;">fixed</span>, then we would like to minimize the total number of transactions being made. For example, in the two examples above the minimum money flow solution is the same as the least number of transactions solution. Is this always the case?</p>
<p>In order to find the optimal <a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph, we start with a weighted directed graph on node set <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' /> whose edge set is the one of the directed <a href="http://en.wikipedia.org/wiki/Complete_graph" target="_blank">complete graph</a> on <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N}' title='\mathcal{N}' class='latex' />. Hence, every two distinct nodes are connected by two directed edges with opposite directions. The weight of edge <img src='http://l.wordpress.com/latex.php?latex=%28i%2Cj%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(i,j)' title='(i,j)' class='latex' /> is denoted by <img src='http://l.wordpress.com/latex.php?latex=x_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ij} \geq 0' title='x_{ij} \geq 0' class='latex' />. Since some of these weights might be zero, there might be edges in this graph which do not represent debt relationships! Therefore, although this graph is weighted and directed, it is <span style="text-decoration:underline;">not necessarily</span> an IOU graph. We optimize for the <img src='http://l.wordpress.com/latex.php?latex=n+%28n-1%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n (n-1)' title='n (n-1)' class='latex' /> nonnegative variables <img src='http://l.wordpress.com/latex.php?latex=%5C%7Bx_%7Bij%7D%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\{x_{ij}\}' title='\{x_{ij}\}' class='latex' /> and, in the end, we remove the edges whose weight is zero so that we obtain an IOU graph. I view this approach as somewhat akin to <a href="http://en.wikipedia.org/wiki/Scaffolding" target="_blank">scaffolding</a> ;-)</p>
<p>For example, considering the minimum money flow criterion, we have the following <span style="text-decoration:underline;">minimum cost flow problem</span> [1]</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Ctext%7Bminimize%7D+%26+%5Cdisplaystyle+%5Csum_%7Bi+%5Cin+%5Cmathcal%7BN%7D%7D%5Csum_%7Bj+%5Cneq+i%7D+x_%7Bij%7D%5C%5C%5C%5C+%5Ctext%7Bsubject+to%7D+%26+%5Cdisplaystyle+%5Csum_%7Bj+%5Cneq+i%7D+x_%7Bij%7D+-+%5Cdisplaystyle+%5Csum_%7Bj+%5Cneq+i%7D+x_%7Bji%7D+%3D+%5Ctextbf%7Bdiv%7D_i+%28%5Cmathcal%7BG%7D_0%29%2C+%5Cquad%7B%7D+%5Cforall+i+%5Cin+%5Cmathcal%7BN%7D%5C%5C%5C%5C+%26+x_%7Bij%7D+%5Cgeq+0%2C+%5Cquad%7B%7D+%5Cforall+i+%5Cneq+j+%5Cin+%5Cmathcal%7BN%7D%5C%5C%5C%5C%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \text{minimize} &amp; \displaystyle \sum_{i \in \mathcal{N}}\sum_{j \neq i} x_{ij}\\\\ \text{subject to} &amp; \displaystyle \sum_{j \neq i} x_{ij} - \displaystyle \sum_{j \neq i} x_{ji} = \textbf{div}_i (\mathcal{G}_0), \quad{} \forall i \in \mathcal{N}\\\\ &amp; x_{ij} \geq 0, \quad{} \forall i \neq j \in \mathcal{N}\\\\\end{array}' title='\begin{array}{ll} \text{minimize} &amp; \displaystyle \sum_{i \in \mathcal{N}}\sum_{j \neq i} x_{ij}\\\\ \text{subject to} &amp; \displaystyle \sum_{j \neq i} x_{ij} - \displaystyle \sum_{j \neq i} x_{ji} = \textbf{div}_i (\mathcal{G}_0), \quad{} \forall i \in \mathcal{N}\\\\ &amp; x_{ij} \geq 0, \quad{} \forall i \neq j \in \mathcal{N}\\\\\end{array}' class='latex' /></p>
<p style="text-align:center;">
<p>which can be solved via <a href="http://en.wikipedia.org/wiki/Linear_programming" target="_blank">linear programming</a> [2]. In words: we want to find the debts <img src='http://l.wordpress.com/latex.php?latex=x_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ij} \geq 0' title='x_{ij} \geq 0' class='latex' /> such that all debts are paid (each node should be paid what it is owed minus what it owes to other nodes) and the total amount of debt is minimized, which results in the total amount of money flowing to be also minimized.</p>
<p>The least number of transactions criterion is much harder to tackle because we want to maximize the sparsity of the graph, while ensuring that the graph and the original IOU graph equi-divergent. We want to optimize the topology of the graph and, hence, a combinatorial flavor is added to the problem. I will write more about it on future posts.</p>
<p style="text-align:center;">__________</p>
<p><strong>A Numerical Example</strong></p>
<p>Let us again consider the <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />-agent example where the agents are Alice, Bob and Charlie. The <a href="http://en.wikipedia.org/wiki/IOU_%28debt%29" target="_blank">IOU</a> graph is</p>
<p><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png"><img class="size-full wp-image-4135 aligncenter" title="IOU graph - Alice Bob and Charlie" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png?w=315&#038;h=311" alt="IOU graph - Alice Bob and Charlie" width="315" height="311" /></a>where the node set is <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BN%7D+%3D+%5C%7B%5Ctext%7Ba%7D%2C+%5Ctext%7Bb%7D%2C+%5Ctext%7Bc%7D%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{N} = \{\text{a}, \text{b}, \text{c}\}' title='\mathcal{N} = \{\text{a}, \text{b}, \text{c}\}' class='latex' />. We introduce vector</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=x+%3D+%28x_%7Bab%7D%2C+x_%7Bac%7D%2C+x_%7Bba%7D%2C+x_%7Bbc%7D%2C+x_%7Bca%7D%2C+x_%7Bcb%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x = (x_{ab}, x_{ac}, x_{ba}, x_{bc}, x_{ca}, x_{cb})' title='x = (x_{ab}, x_{ac}, x_{ba}, x_{bc}, x_{ca}, x_{cb})' class='latex' /></p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=x_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ij} \geq 0' title='x_{ij} \geq 0' class='latex' /> is the amount of money node <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> owes to node <img src='http://l.wordpress.com/latex.php?latex=j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='j' title='j' class='latex' />. The divergence of the new graph at each node must be the same as the divergence of the given IOU graph at each node, which yields the equality constraint <img src='http://l.wordpress.com/latex.php?latex=C+x+%3D+b&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C x = b' title='C x = b' class='latex' />, where</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=C+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Brrrrrr%7D+-1+%26+-1+%26+1+%26+0+%26+1+%26+0%5C%5C+1+%26+0+%26+-1+%26+-1+%26+0+%26+1%5C%5C+0+%26+1+%26+0+%26+1+%26+-1+%26+-1%5C%5C%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C = \left[\begin{array}{rrrrrr} -1 &amp; -1 &amp; 1 &amp; 0 &amp; 1 &amp; 0\\ 1 &amp; 0 &amp; -1 &amp; -1 &amp; 0 &amp; 1\\ 0 &amp; 1 &amp; 0 &amp; 1 &amp; -1 &amp; -1\\\end{array}\right]' title='C = \left[\begin{array}{rrrrrr} -1 &amp; -1 &amp; 1 &amp; 0 &amp; 1 &amp; 0\\ 1 &amp; 0 &amp; -1 &amp; -1 &amp; 0 &amp; 1\\ 0 &amp; 1 &amp; 0 &amp; 1 &amp; -1 &amp; -1\\\end{array}\right]' class='latex' /></p>
<p>is the <a href="http://en.wikipedia.org/wiki/Incidence_matrix" target="_blank">incidence matrix</a> of the graph, and <img src='http://l.wordpress.com/latex.php?latex=b+%3D+%5B%5Cbegin%7Barray%7D%7Bccc%7D+10+%26+5+%26+-15%5Cend%7Barray%7D%5D%5ET&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='b = [\begin{array}{ccc} 10 &amp; 5 &amp; -15\end{array}]^T' title='b = [\begin{array}{ccc} 10 &amp; 5 &amp; -15\end{array}]^T' class='latex' /> is the <a href="http://en.wikipedia.org/wiki/Additive_inverse" target="_blank">opposite</a> of the divergence vector of the given IOU graph above. This equality constraint guarantees that the given IOU graph and the new graph we obtain are equi-divergent.</p>
<p>Let <img src='http://l.wordpress.com/latex.php?latex=I_6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='I_6' title='I_6' class='latex' /> be the <img src='http://l.wordpress.com/latex.php?latex=6+%5Ctimes+6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6 \times 6' title='6 \times 6' class='latex' /> identity matrix, let <img src='http://l.wordpress.com/latex.php?latex=1_6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1_6' title='1_6' class='latex' /> be the <img src='http://l.wordpress.com/latex.php?latex=6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6' title='6' class='latex' />-dimensional vector of ones, and let <img src='http://l.wordpress.com/latex.php?latex=0_6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='0_6' title='0_6' class='latex' /> be the <img src='http://l.wordpress.com/latex.php?latex=6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6' title='6' class='latex' />-dimensional vector of zeros. The <img src='http://l.wordpress.com/latex.php?latex=6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='6' title='6' class='latex' /> nonnegativity constraints <img src='http://l.wordpress.com/latex.php?latex=x_%7Bij%7D+%5Cgeq+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_{ij} \geq 0' title='x_{ij} \geq 0' class='latex' /> can be written in matrix form as <img src='http://l.wordpress.com/latex.php?latex=%28-I_6%29+x+%5Cleq+0_6&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(-I_6) x \leq 0_6' title='(-I_6) x \leq 0_6' class='latex' />. Considering the <span style="text-decoration:underline;">minimum money flow</span> criterion, we obtain the linear program</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Ctext%7Bminimize%7D+%26+1_6%5ET+x%5C%5C%5C%5C+%5Ctext%7Bsubject+to%7D+%26+C+x+%3D+b%2C+%5Cquad%7B%7D+%28-I_6%29+x+%5Cleq+0_6%5C%5C%5C%5C%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \text{minimize} &amp; 1_6^T x\\\\ \text{subject to} &amp; C x = b, \quad{} (-I_6) x \leq 0_6\\\\\end{array}' title='\begin{array}{ll} \text{minimize} &amp; 1_6^T x\\\\ \text{subject to} &amp; C x = b, \quad{} (-I_6) x \leq 0_6\\\\\end{array}' class='latex' /></p>
<p>Note that the equality constraint <img src='http://l.wordpress.com/latex.php?latex=C+x+%3D+b&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C x = b' title='C x = b' class='latex' /> is equivalent to two inequality constraints: <img src='http://l.wordpress.com/latex.php?latex=C+x+%5Cleq+b&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C x \leq b' title='C x \leq b' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=C+x+%5Cgeq+b&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C x \geq b' title='C x \geq b' class='latex' />. Thus, we can transform the linear program above into a linear program with inequality constraints only</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bll%7D+%5Ctext%7Bminimize%7D+%26+1_6%5ET+x%5C%5C%5C%5C+%5Ctext%7Bsubject+to%7D+%26+%5Cleft%5B%5Cbegin%7Barray%7D%7Br%7D+C%5C%5C+-C%5C%5C+-I_6%5C%5C%5Cend%7Barray%7D%5Cright%5D+x+%5Cleq+%5Cleft%5B%5Cbegin%7Barray%7D%7Br%7D+b%5C%5C+-b%5C%5C+0_6%5C%5C%5Cend%7Barray%7D%5Cright%5D%5C%5C%5C%5C%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{ll} \text{minimize} &amp; 1_6^T x\\\\ \text{subject to} &amp; \left[\begin{array}{r} C\\ -C\\ -I_6\\\end{array}\right] x \leq \left[\begin{array}{r} b\\ -b\\ 0_6\\\end{array}\right]\\\\\end{array}' title='\begin{array}{ll} \text{minimize} &amp; 1_6^T x\\\\ \text{subject to} &amp; \left[\begin{array}{r} C\\ -C\\ -I_6\\\end{array}\right] x \leq \left[\begin{array}{r} b\\ -b\\ 0_6\\\end{array}\right]\\\\\end{array}' class='latex' /></p>
<p>If you have <a href="http://www.mathworks.com/" target="_blank">MATLAB</a>, you can easily solve these linear programs using function <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/linprog.html" target="_blank">linprog</a>. The following <a href="http://www.python.org" target="_blank">Python</a> 2.5 script solves the latter linear program using <a href="http://abel.ee.ucla.edu/cvxopt" target="_blank">CVXOPT</a>:</p>
<pre class="brush: python;">
from cvxopt import matrix
from cvxopt import solvers

# -------------------
# auxiliary matrices
# -------------------

# defines incidence matrix
C = matrix([ [-1.0, 1.0, 0.0],
             [-1.0, 0.0, 1.0],
             [1.0, -1.0, 0.0],
             [0.0, -1.0, 1.0],
             [1.0, 0.0, -1.0],
             [0.0, 1.0, -1.0] ])

# defines desired divergence vector
d = matrix( [-10.0, -5.0, 15.0] )

# defines 6x6 identity matrix   
Id = matrix([ [1, 0, 0, 0, 0, 0],
              [0, 1, 0, 0, 0, 0],
              [0, 0, 1, 0, 0, 0],
              [0, 0, 0, 1, 0, 0],
              [0, 0, 0, 0, 1, 0],
              [0, 0, 0, 0, 0, 1] ])

# ---------------
# linear program
# ---------------

# defines objective vector
c = matrix(1.0, (6,1))

# defines inequality constraint matrices
G = matrix( [C, -C, -Id] )
h = matrix( [-d, d, matrix(0.0, (6,1))] )

# solves linear program
solvers.options['show_progress'] = True
solution = solvers.lp(c, G, h)

# prints solution
print solution['x']
</pre>
<p>The solution is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=x+%3D+%5Cleft%5B%5Cbegin%7Barray%7D%7Br%7D5.86%5Ctext%7Be-%7D008%5C%5C+-1.50%5Ctext%7Be-%7D008%5C%5C+-1.36%5Ctext%7Be-%7D008%5C%5C+-1.99%5Ctext%7Be-%7D008%5C%5C+1.00%5Ctext%7Be%2B%7D001%5C%5C+5.00%5Ctext%7Be%2B%7D000%5C%5C%5Cend%7Barray%7D%5Cright%5D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x = \left[\begin{array}{r}5.86\text{e-}008\\ -1.50\text{e-}008\\ -1.36\text{e-}008\\ -1.99\text{e-}008\\ 1.00\text{e+}001\\ 5.00\text{e+}000\\\end{array}\right]' title='x = \left[\begin{array}{r}5.86\text{e-}008\\ -1.50\text{e-}008\\ -1.36\text{e-}008\\ -1.99\text{e-}008\\ 1.00\text{e+}001\\ 5.00\text{e+}000\\\end{array}\right]' class='latex' />,</p>
<p>which is &#8220;contaminated&#8221; with numerical noise. Adjusting the tolerances of the numerical solver, one can reduce the numerical noise and obtain the true solution, which is <img src='http://l.wordpress.com/latex.php?latex=x+%3D+%280%2C+0%2C+0%2C+0%2C+10%2C+5%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x = (0, 0, 0, 0, 10, 5)' title='x = (0, 0, 0, 0, 10, 5)' class='latex' />. Removing the edges with zero weight, we obtain an IOU graph with 2 edges</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png"><img class="size-full wp-image-4140 aligncenter" title="IOU graph - Alice Bob and Charlie 3" src="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png?w=302&#038;h=288" alt="IOU graph - Alice Bob and Charlie 3" width="302" height="288" /></a></p>
<p>and, hence, only two transactions are required, and only $15 need to be exchanged. This is the exact same solution we obtained previously via heuristic methods! :-)</p>
<p style="text-align:center;">__________</p>
<p><strong>Concluding Remarks<br />
</strong></p>
<p>The two optimal debt-paying schemes considered on this post rely on an &#8220;accountant&#8221; who has perfect <span style="text-decoration:underline;">global information</span> about all the debts in the network of agents. This accountant solves an optimization problem to find out what transactions should be carried out. This is a <span style="text-decoration:underline;">centralized</span> approach, as the decision power is centralized in the accountant. Another (and arguably more interesting) approach would be a <span style="text-decoration:underline;">decentralized</span> one, where the nodes have only <span style="text-decoration:underline;">local information</span> (i.e., each node only knows who owes him money and to whom he owes money) and where each node solves a local optimization problem using, for example, message-passing algorithms. I will write about it on future posts.</p>
<p>The only modeling of this problem I have found was on <a href="http://www.cds.caltech.edu/~demetri" target="_blank">Demetri Spanos</a>&#8216; PhD thesis [3]. If you know of any papers on this topic, please let me know.</p>
<p>Last but not least, allow me to add a personal note: I first started thinking of this problem years ago, while going to dinners with friends and trying to figure out how to split the bill in an efficient manner. The real world is a great source of inspiration when it comes to interesting problems.</p>
<p style="text-align:center;">__________</p>
<p><strong>References</strong></p>
<p style="padding-left:30px;">[1]  Dimitri Bertsekas, <em><a href="http://www.athenasc.com/netbook.html" target="_blank">Network Optimization: Continuous and Discrete Models</a></em>, Athena Scientific, 1998.</p>
<p style="padding-left:30px;">[2] Stephen Boyd and Lieven Vandenberghe, <em><a href="http://www.stanford.edu/~boyd/cvxbook" target="_blank">Convex Optimization</a></em>, Cambridge University Press, 2004.</p>
<p style="padding-left:30px;">[3] Demetri Spanos, <a href="http://resolver.caltech.edu/CaltechETD:etd-06262006-171822" target="_blank"><em>Distributed gradient systems and dynamic coordination</em></a>, Ph.D. thesis, California Institute of Technology, December 2005.</p>
Posted in Operations Research Tagged: Accounting, CVXOPT, IOU Graphs, Operations Research, Python <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4079/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4079/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4079/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4079/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4079/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4079/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4079/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4079/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4079/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4079/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4079&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/06/20/optimal-account-balancing/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob.png" medium="image">
			<media:title type="html">IOU graph - Alice and Bob</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob.png" medium="image">
			<media:title type="html">FBD - Alice and Bob</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/fbd-alice-and-bob-2.png" medium="image">
			<media:title type="html">FBD - Alice and Bob 2</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-and-bob-2.png" medium="image">
			<media:title type="html">IOU graph - Alice and Bob 2</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png" medium="image">
			<media:title type="html">IOU graph - Alice Bob and Charlie</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-2b.png" medium="image">
			<media:title type="html">iou-graph-alice-bob-and-charlie-2b</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png" medium="image">
			<media:title type="html">IOU graph - Alice Bob and Charlie 3</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/in-out-neighborhoods1.png" medium="image">
			<media:title type="html">IN &#38; OUT neighborhoods</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie.png" medium="image">
			<media:title type="html">IOU graph - Alice Bob and Charlie</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/06/iou-graph-alice-bob-and-charlie-3.png" medium="image">
			<media:title type="html">IOU graph - Alice Bob and Charlie 3</media:title>
		</media:content>
	</item>
		<item>
		<title>How would you design this contract?</title>
		<link>http://stochastix.wordpress.com/2009/05/15/how-would-you-design-this-contract/</link>
		<comments>http://stochastix.wordpress.com/2009/05/15/how-would-you-design-this-contract/#comments</comments>
		<pubDate>Sat, 16 May 2009 05:45:28 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Brain Teasers]]></category>
		<category><![CDATA[Contract Design]]></category>
		<category><![CDATA[Contract Theory]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4089</guid>
		<description><![CDATA[[ source ]
Let us start with the following joke:
Two business partners asked their lawyer to hold $20,000, making him promise to get both of their signatures before disbursing any of it. As soon as one partner left town, the other pressed the lawyer for $15,000, citing an emergency. The lawyer reluctantly gave it to him, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4089&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/05/handshake.jpg"><img class="size-full wp-image-4090 aligncenter" title="&quot;I give you all my risk and you give me all your capital. That's a mathematically optimal exchange.&quot;" src="http://stochastix.files.wordpress.com/2009/05/handshake.jpg?w=284&#038;h=284" alt="&quot;I give you all my risk and you give me all your capital. That's a mathematically optimal exchange.&quot;" width="284" height="284" /></a>[ <a href="http://www.camdenconsultancyservice.co.uk/ContractAdministration.htm" target="_blank">source</a> ]</p>
<p>Let us start with the following <a href="http://www.futilitycloset.com/2007/12/15/turnabout" target="_blank">joke</a>:</p>
<p style="padding-left:30px;"><em>Two business partners asked their lawyer to hold $20,000, making him promise to get both of their signatures before disbursing any of it. As soon as one partner left town, the other pressed the lawyer for $15,000, citing an emergency. The lawyer reluctantly gave it to him, and he disappeared. On his return, the other partner was irate, so the lawyer explained that he had donated the $15,000 out of his own pocket.</em></p>
<p style="padding-left:30px;"><em>&#8220;Then give me the $20,000 you&#8217;re holding,&#8221; said the partner.</em></p>
<p style="padding-left:30px;"><em>&#8220;All right,&#8221; said the lawyer. &#8220;Give me the two signatures.&#8221;</em></p>
<p style="text-align:center;">__________</p>
<p>These two business partners and their lawyer should have signed a <a href="http://en.wikipedia.org/wiki/Contract" target="_blank">contract</a>. If the lawyer disbursed any of the partners&#8217; money without having both of their signatures, he would face legal action for <a href="http://en.wikipedia.org/wiki/Breach_of_contract" target="_blank">breach of contract</a>. However, this contract would still not be immune to <a href="http://en.wikipedia.org/wiki/Collusion" target="_blank">collusion</a>: one of the two partners could split the money with the lawyer and disappear, and the other partner would never have the two signatures required by contract to have his money back. How would you design <span style="text-decoration:underline;">a better contract</span>? By &#8220;better contract&#8221;, I mean:</p>
<ul>
<li>a contract that would NOT give any of the parties involved an incentive to break it.</li>
</ul>
<ul>
<li>a contract that would be robust (and, ideally, immune) to collusion.</li>
</ul>
<p>I make no claims that such a &#8220;perfect contract&#8221; even exists, but maybe one could devise a contract that would be better than the aforementioned one. Purely for recreational purposes, I propose a <span style="text-decoration:underline;">challenge</span>: try to design the best contract you can think of!</p>
<p>If you have any ideas, please feel free to share them.</p>
Posted in Brain Teasers Tagged: Brain Teasers, Contract Design, Contract Theory <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4089/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4089/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4089/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4089/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4089/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4089/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4089&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/05/15/how-would-you-design-this-contract/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/05/handshake.jpg" medium="image">
			<media:title type="html">&#34;I give you all my risk and you give me all your capital. That's a mathematically optimal exchange.&#34;</media:title>
		</media:content>
	</item>
		<item>
		<title>Radiology Art</title>
		<link>http://stochastix.wordpress.com/2009/04/04/radiology-art/</link>
		<comments>http://stochastix.wordpress.com/2009/04/04/radiology-art/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 14:52:27 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Digital Art]]></category>
		<category><![CDATA[Radiology Art]]></category>
		<category><![CDATA[Satre Stuelke]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4069</guid>
		<description><![CDATA[The Radiology Art project was started by artist and medical student Satre Stuelke in the Summer of 2007. Stuelke uses a CT scanner to acquire DICOM images of various objects (e.g., electronic apparatuses, toys) and then processes them with OsiriX Imaging Software and Adobe Photoshop. Colors are assigned based on the varying densities of materials [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4069&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a href="http://www.radiologyart.com" target="_blank">Radiology Art</a> project was started by artist and medical student <a href="http://www.satre.org" target="_blank">Satre Stuelke</a> in the Summer of 2007. Stuelke uses a <a href="http://en.wikipedia.org/wiki/Computed_tomography" target="_blank">CT</a> scanner to acquire <a href="http://en.wikipedia.org/wiki/Digital_Imaging_and_Communications_in_Medicine" target="_blank">DICOM</a> images of various objects (e.g., electronic apparatuses, toys) and then processes them with <a href="http://www.osirix-viewer.com" target="_blank">OsiriX Imaging Software</a> and <a href="http://en.wikipedia.org/wiki/Adobe_Photoshop" target="_blank">Adobe Photoshop</a>. Colors are assigned based on the varying densities of materials present throughout the object. The post-processed images are stunning.</p>
<p>For example, here&#8217;s a CT scan of a Teslovak KT88S <a href="http://en.wikipedia.org/wiki/Vacuum_tube" target="_blank">vacuum tube</a>:</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/04/ct-scan-of-a-vacuum-tube.jpg"><img class="size-full wp-image-4070 aligncenter" title="CT scan of a Teslovak KT88S vacuum tube" src="http://stochastix.files.wordpress.com/2009/04/ct-scan-of-a-vacuum-tube.jpg?w=340&#038;h=432" alt="CT scan of a Teslovak KT88S vacuum tube" width="340" height="432" /></a>[ <a href="http://satre.itrnet.com/radiology_art/html/tube1.html" target="_blank">image</a> courtesy of Satre Stuelke ]</p>
<p>Related:</p>
<ul>
<li><a href="http://www.nytimes.com/2009/03/24/science/24scan.html" target="_blank">A Cultural Scan</a></li>
</ul>
<ul>
<li><a href="http://blogs.america.gov/science/2009/03/24/diagnostic-art" target="_blank">Diagnostic Art</a></li>
</ul>
Posted in Art Tagged: Art, Digital Art, Radiology Art, Satre Stuelke <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4069/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4069/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4069/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4069/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4069/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4069/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4069/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4069/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4069/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4069/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4069&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/04/04/radiology-art/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/04/ct-scan-of-a-vacuum-tube.jpg" medium="image">
			<media:title type="html">CT scan of a Teslovak KT88S vacuum tube</media:title>
		</media:content>
	</item>
		<item>
		<title>The Trials of J. Robert Oppenheimer</title>
		<link>http://stochastix.wordpress.com/2009/02/27/the-trials-of-j-robert-oppenheimer/</link>
		<comments>http://stochastix.wordpress.com/2009/02/27/the-trials-of-j-robert-oppenheimer/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 08:57:57 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Great Thinkers]]></category>
		<category><![CDATA[J. Robert Oppenheimer]]></category>
		<category><![CDATA[Physicists]]></category>
		<category><![CDATA[Robert Oppenheimer]]></category>
		<category><![CDATA[The Trials of J. Robert Oppenheimer]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=4036</guid>
		<description><![CDATA[In the days of my almost infinitely prolonged adolescence, I hardly took an action, hardly did anything that did not arouse in me a very great sense of revulsion and of wrong. My feeling about myself was always one of extreme discontent.
- J. Robert Oppenheimer (1904-1967)
The Trials of J. Robert Oppenheimer is a two-hour documentary [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4036&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="padding-left:150px;"><em>In the days of my almost infinitely prolonged adolescence, I hardly took an action, hardly did anything that did not arouse in me a very great sense of revulsion and of wrong. My feeling about myself was always one of extreme discontent.</em></p>
<p style="padding-left:150px;">- J. Robert Oppenheimer (1904-1967)</p>
<p><a href="http://www.pbs.org/wgbh/americanexperience/oppenheimer" target="_blank">The Trials of J. Robert Oppenheimer</a> is a two-hour documentary film on the life of the brilliant and charismatic American nuclear physicist <a href="http://en.wikipedia.org/wiki/J._Robert_Oppenheimer" target="_blank">J. Robert Oppenheimer</a> (1904-1967), from his youth and emergence as one of America&#8217;s leading physicists, to his leadership of the <a href="http://en.wikipedia.org/wiki/Manhattan_Project" target="_blank">Manhattan Project</a>, and his most tragic humiliation during the anti-Communist <a href="http://en.wikipedia.org/wiki/Second_Red_Scare" target="_blank">witch-hunt</a> in the 1950s.</p>
<p style="text-align:center;"><a title="&quot;My two great loves are physics and desert country. It’s a pity they can’t be combined.” - J. Robert Oppenheimer" href="http://stochastix.files.wordpress.com/2009/02/oppenheimer.jpg"><img class="size-full wp-image-4037 aligncenter" style="border:1px solid black;" title="J. Robert Oppenheimer" src="http://stochastix.files.wordpress.com/2009/02/oppenheimer.jpg?w=365&#038;h=284" alt="oppenheimer" width="365" height="284" /></a></p>
<p>The film was produced by <a href="http://grubin.com" target="_blank">David Grubin</a>, and it features actor <a href="http://en.wikipedia.org/wiki/David_Strathairn" target="_blank">David Strathairn</a> as Oppenheimer. You can watch it online for free. The <a href="http://www.pbs.org/wgbh/americanexperience/oppenheimer/transcript/" target="_blank">transcript</a> is also available.</p>
<p style="text-align:center;">__________</p>
<p>Related:</p>
<ul>
<li><a href="http://onionesquereality.wordpress.com/2008/11/23/american-prometheus/" target="_blank">Shubhendu Trivedi&#8217;s review of <em>American Prometheus</em></a></li>
</ul>
<ul>
<li><a href="http://engineered.typepad.com/thoughts_on_business_engi/2007/12/book-choice.html" target="_blank">Aurélie Thiele’s review of <em>American Prometheus</em></a></li>
</ul>
<ul>
<li><a href="http://motls.blogspot.com/2008/04/robert-oppenheimer-104th-birthday.html" target="_blank">Robert Oppenheimer: 104th birthday</a> (by Luboš Motl)</li>
</ul>
<ul>
<li><a href="http://blogs.ethz.ch/kowalski/2009/05/16/oppenheimer" target="_blank">Oppenheimer</a> (by E. Kowalski)</li>
</ul>
Posted in Great Thinkers Tagged: J. Robert Oppenheimer, Physicists, Robert Oppenheimer, The Trials of J. Robert Oppenheimer <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/4036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/4036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/4036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/4036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/4036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/4036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/4036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/4036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/4036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/4036/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=4036&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/02/27/the-trials-of-j-robert-oppenheimer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/02/oppenheimer.jpg" medium="image">
			<media:title type="html">J. Robert Oppenheimer</media:title>
		</media:content>
	</item>
		<item>
		<title>Distance between two words</title>
		<link>http://stochastix.wordpress.com/2009/01/31/distance-between-two-words/</link>
		<comments>http://stochastix.wordpress.com/2009/01/31/distance-between-two-words/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 13:13:11 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Graphs]]></category>
		<category><![CDATA[Graphviz]]></category>
		<category><![CDATA[GvGen]]></category>
		<category><![CDATA[Hamming distance]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=3861</guid>
		<description><![CDATA[Consider a finite set  with  distinct elements which we will call symbols. We will call set  an alphabet. A word (also known as string) of length  over set  is formed by constructing an -tuple of symbols from alphabet 

where  for all . A string of length  will be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=3861&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Consider a finite set <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' /> with <img src='http://l.wordpress.com/latex.php?latex=%7C%5CSigma%7C&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\Sigma|' title='|\Sigma|' class='latex' /> distinct elements which we will call <em>symbols</em>. We will call set <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' /> an <em>alphabet</em>. A <em>word</em> (also known as <em>string</em>) of length <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> over set <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' /> is formed by constructing an <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-tuple of symbols from alphabet <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=w+%3D+%28w_1%2C+w_2%2C+w_3%2C+%5Cldots%2C+w_n%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w = (w_1, w_2, w_3, \ldots, w_n)' title='w = (w_1, w_2, w_3, \ldots, w_n)' class='latex' /></p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=w_i+%5Cin+%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='w_i \in \Sigma' title='w_i \in \Sigma' class='latex' /> for all <img src='http://l.wordpress.com/latex.php?latex=+i+%5Cin+%5C%7B1%2C+2%2C+%5Cldots%2C+n%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt=' i \in \{1, 2, \ldots, n\}' title=' i \in \{1, 2, \ldots, n\}' class='latex' />. A string of length <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> will be called an <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-string. The set of all <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings is given by the cartesian product</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5CSigma%5En+%3D+%5CSigma+%5Ctimes+%5CSigma+%5Ctimes+%5Cldots+%5Ctimes+%5CSigma+%3D+%5Cdisplaystyle%5Cprod_%7Bi%3D1%7D%5En+%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma^n = \Sigma \times \Sigma \times \ldots \times \Sigma = \displaystyle\prod_{i=1}^n \Sigma' title='\Sigma^n = \Sigma \times \Sigma \times \ldots \times \Sigma = \displaystyle\prod_{i=1}^n \Sigma' class='latex' />.</p>
<p>For example, in <a href="http://en.wikipedia.org/wiki/Coding_theory" target="_blank">coding theory</a> one usually works with binary words, i.e., words over alphabet <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BF%7D_2+%3D+%5C%7B0%2C1%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{F}_2 = \{0,1\}' title='\mathbb{F}_2 = \{0,1\}' class='latex' />. The set of all binary words of length <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' /> is <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BF%7D_2%5En+%3D+%5C%7B0%2C1%5C%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{F}_2^n = \{0,1\}^n' title='\mathbb{F}_2^n = \{0,1\}^n' class='latex' />, whose cardinality is <img src='http://l.wordpress.com/latex.php?latex=%7C+%5Cmathbb%7BF%7D_2%5En+%7C+%3D+2%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='| \mathbb{F}_2^n | = 2^n' title='| \mathbb{F}_2^n | = 2^n' class='latex' />.</p>
<p>In this post we will work only with words over the alphabet</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5CSigma+%3D+%5C%7B%5Ctext%7Ba%7D+%2C%5Ctext%7Bb%7D+%2C%5Ctext%7Bc%7D+%2C%5Ctext%7Bd%7D+%2C%5Ctext%7Be%7D+%2C%5Ctext%7Bf%7D+%2C%5Ctext%7Bg%7D+%2C%5Ctext%7Bh%7D+%2C%5Ctext%7Bi%7D+%2C%5Ctext%7Bj%7D+%2C%5Ctext%7Bk%7D+%2C%5Ctext%7Bl%7D+%2C%5Ctext%7Bm%7D+%2C%5Ctext%7Bn%7D+%2C%5Ctext%7Bo%7D+%2C%5Ctext%7Bp%7D+%2C%5Ctext%7Bq%7D+%2C%5Ctext%7Br%7D+%2C%5Ctext%7Bs%7D+%2C%5Ctext%7Bt%7D+%2C%5Ctext%7Bu%7D+%2C%5Ctext%7Bv%7D+%2C%5Ctext%7Bw%7D+%2C%5Ctext%7Bx%7D+%2C%5Ctext%7By%7D+%2C%5Ctext%7Bz%7D%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma = \{\text{a} ,\text{b} ,\text{c} ,\text{d} ,\text{e} ,\text{f} ,\text{g} ,\text{h} ,\text{i} ,\text{j} ,\text{k} ,\text{l} ,\text{m} ,\text{n} ,\text{o} ,\text{p} ,\text{q} ,\text{r} ,\text{s} ,\text{t} ,\text{u} ,\text{v} ,\text{w} ,\text{x} ,\text{y} ,\text{z}\}' title='\Sigma = \{\text{a} ,\text{b} ,\text{c} ,\text{d} ,\text{e} ,\text{f} ,\text{g} ,\text{h} ,\text{i} ,\text{j} ,\text{k} ,\text{l} ,\text{m} ,\text{n} ,\text{o} ,\text{p} ,\text{q} ,\text{r} ,\text{s} ,\text{t} ,\text{u} ,\text{v} ,\text{w} ,\text{x} ,\text{y} ,\text{z}\}' class='latex' /></p>
<p>which is known as the <a href="http://en.wikipedia.org/wiki/Latin_alphabet" target="_blank">Latin alphabet</a>, and whose 26 symbols are known as<em> letters</em>. For example,  <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bcat%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{cat}' title='\textbf{cat}' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bcar%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{car}' title='\textbf{car}' class='latex' /> are represented by the 3-strings <img src='http://l.wordpress.com/latex.php?latex=s_1+%3D+%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Bt%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_1 = (\text{c}, \text{a}, \text{t})' title='s_1 = (\text{c}, \text{a}, \text{t})' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=s_2+%3D+%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Br%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_2 = (\text{c}, \text{a}, \text{r})' title='s_2 = (\text{c}, \text{a}, \text{r})' class='latex' />, respectively, where <img src='http://l.wordpress.com/latex.php?latex=s_1%2C+s_2+%5Cin+%5CSigma%5E3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_1, s_2 \in \Sigma^3' title='s_1, s_2 \in \Sigma^3' class='latex' />.</p>
<p style="text-align:center;">__________</p>
<p><strong>Hamming distance</strong></p>
<p>Given two strings of equal length, the <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between them is the number of positions for which the corresponding symbols are different. In other words, the Hamming distance between two strings of equal length is the minimum number of symbol substitutions required to change one string into the other.</p>
<p>Let function <img src='http://l.wordpress.com/latex.php?latex=d_%7BH%7D+%3A+%5CSigma%5En+%5Ctimes+%5CSigma%5En+%5Crightarrow+%5Cmathbb%7BZ%7D_0%5E%7B%2B%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='d_{H} : \Sigma^n \times \Sigma^n \rightarrow \mathbb{Z}_0^{+}' title='d_{H} : \Sigma^n \times \Sigma^n \rightarrow \mathbb{Z}_0^{+}' class='latex' /> be defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=d_%7BH%7D+%28v%2C+w%29+%3D+%5Cdisplaystyle+%5Csum_%7Bi%3D1%7D%5En+%5Cmu+%5Cleft%28+v_i%2C+w_i+%5Cright%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='d_{H} (v, w) = \displaystyle \sum_{i=1}^n \mu \left( v_i, w_i \right)' title='d_{H} (v, w) = \displaystyle \sum_{i=1}^n \mu \left( v_i, w_i \right)' class='latex' /></p>
<p>where function <img src='http://l.wordpress.com/latex.php?latex=%5Cmu+%3A+%5CSigma+%5Ctimes+%5CSigma+%5Crightarrow+%5C%7B0%2C1%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mu : \Sigma \times \Sigma \rightarrow \{0,1\}' title='\mu : \Sigma \times \Sigma \rightarrow \{0,1\}' class='latex' /> is defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmu+%28a%2C+b%29+%3D+%5Cdisplaystyle%5Cleft%5C%7B%5Cbegin%7Barray%7D%7Brl%7D+0+%26+%5Ctext%7Bif%7D+%5Cquad%7B%7D+a+%3D+b%5C%5C+1+%26+%5Ctext%7Bif%7D+%5Cquad%7B%7D+a+%5Cneq+b%5C%5C+%5Cend%7Barray%7D%5Cright.&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mu (a, b) = \displaystyle\left\{\begin{array}{rl} 0 &amp; \text{if} \quad{} a = b\\ 1 &amp; \text{if} \quad{} a \neq b\\ \end{array}\right.' title='\mu (a, b) = \displaystyle\left\{\begin{array}{rl} 0 &amp; \text{if} \quad{} a = b\\ 1 &amp; \text{if} \quad{} a \neq b\\ \end{array}\right.' class='latex' /></p>
<p>then <img src='http://l.wordpress.com/latex.php?latex=d_H+%28s_1%2C+s_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='d_H (s_1, s_2)' title='d_H (s_1, s_2)' class='latex' /> is the <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings <img src='http://l.wordpress.com/latex.php?latex=s_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_1' title='s_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=s_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_2' title='s_2' class='latex' />. For example, if <img src='http://l.wordpress.com/latex.php?latex=s_1+%3D+%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Bt%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_1 = (\text{c}, \text{a}, \text{t})' title='s_1 = (\text{c}, \text{a}, \text{t})' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=s_2+%3D+%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Br%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_2 = (\text{c}, \text{a}, \text{r})' title='s_2 = (\text{c}, \text{a}, \text{r})' class='latex' />, then we have <img src='http://l.wordpress.com/latex.php?latex=d_H+%28s_1%2C+s_2%29+%3D+1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='d_H (s_1, s_2) = 1' title='d_H (s_1, s_2) = 1' class='latex' /> because <img src='http://l.wordpress.com/latex.php?latex=s_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_1' title='s_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=s_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s_2' title='s_2' class='latex' /> only differ in one symbol (the last one).</p>
<p>Suppose we are given an <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-string over the Latin alphabet <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' />. If we replace the letter at position <img src='http://l.wordpress.com/latex.php?latex=i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i' title='i' class='latex' /> with another letter in <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' />, where <img src='http://l.wordpress.com/latex.php?latex=i+%5Cin+%5C%7B1%2C+2%2C+%5Cldots%2C+n%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='i \in \{1, 2, \ldots, n\}' title='i \in \{1, 2, \ldots, n\}' class='latex' />, we can obtain a total of <img src='http://l.wordpress.com/latex.php?latex=%7C%5CSigma%7C+-+1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\Sigma| - 1' title='|\Sigma| - 1' class='latex' /> new <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings, each within <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> <img src='http://l.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1' title='1' class='latex' /> of the original <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-string. Let us call these <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings <em>neighbors</em> of the original <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-string. Thus, an <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-string has a total of <img src='http://l.wordpress.com/latex.php?latex=%28%7C%5CSigma%7C+-+1%29+n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(|\Sigma| - 1) n' title='(|\Sigma| - 1) n' class='latex' /> neighbors.</p>
<p style="text-align:center;">__________</p>
<p><strong>Word graphs</strong></p>
<p>If two <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings are neighbors of one another when their <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> is equal to <img src='http://l.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1' title='1' class='latex' />, then a graphical approach would be the natural way to go. Let <img src='http://l.wordpress.com/latex.php?latex=G+%3D+%28N%2CE%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='G = (N,E)' title='G = (N,E)' class='latex' /> be an undirected graph whose set of nodes is <img src='http://l.wordpress.com/latex.php?latex=N+%3D+%5CSigma%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='N = \Sigma^n' title='N = \Sigma^n' class='latex' /> (set of all <img src='http://l.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n' title='n' class='latex' />-strings over alphabet <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' />), and whose set of edges is <img src='http://l.wordpress.com/latex.php?latex=E+%5Csubset+%5CSigma%5En+%5Ctimes+%5CSigma%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E \subset \Sigma^n \times \Sigma^n' title='E \subset \Sigma^n \times \Sigma^n' class='latex' />. Two nodes are connected by an edge  if their <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> is equal to <img src='http://l.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1' title='1' class='latex' />. Hence the total number of nodes in <img src='http://l.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='G' title='G' class='latex' /> is <img src='http://l.wordpress.com/latex.php?latex=%7CN%7C+%3D+%7C%5CSigma%5En%7C+%3D+26%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|N| = |\Sigma^n| = 26^n' title='|N| = |\Sigma^n| = 26^n' class='latex' />, and the total number of edges in <img src='http://l.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='G' title='G' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%7CE%7C+%3D+%5Cdisplaystyle%5Cfrac%7Bn+%7C+%5CSigma%5En%7C%7D%7B2%7D+%5Cleft%28%7C+%5CSigma%7C+-+1%5Cright%29+%3D+%5Cdisplaystyle%5Cfrac%7Bn%7D%7B2%7D+%7C+%5CSigma%7C%5En%5Cleft%28%7C+%5CSigma%7C+-+1%5Cright%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|E| = \displaystyle\frac{n | \Sigma^n|}{2} \left(| \Sigma| - 1\right) = \displaystyle\frac{n}{2} | \Sigma|^n\left(| \Sigma| - 1\right)' title='|E| = \displaystyle\frac{n | \Sigma^n|}{2} \left(| \Sigma| - 1\right) = \displaystyle\frac{n}{2} | \Sigma|^n\left(| \Sigma| - 1\right)' class='latex' />,</p>
<p>because each node has <img src='http://l.wordpress.com/latex.php?latex=%28%7C%5CSigma%7C+-+1%29+n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(|\Sigma| - 1) n' title='(|\Sigma| - 1) n' class='latex' /> neighbors, there are <img src='http://l.wordpress.com/latex.php?latex=%7C%5CSigma%5En%7C&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\Sigma^n|' title='|\Sigma^n|' class='latex' /> nodes, and each edge is counted twice so we need to divide the total by <img src='http://l.wordpress.com/latex.php?latex=2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2' title='2' class='latex' />. Note that <img src='http://l.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='G' title='G' class='latex' /> is a <a href="http://en.wikipedia.org/wiki/Regular_graph" target="_blank">regular graph</a> (of degree <img src='http://l.wordpress.com/latex.php?latex=%7C%5CSigma%7C+-+1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\Sigma| - 1' title='|\Sigma| - 1' class='latex' />) because all nodes have the same number of neighbors.</p>
<p>For example, let <img src='http://l.wordpress.com/latex.php?latex=n%3D3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n=3' title='n=3' class='latex' /> and let us consider the <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />-string <img src='http://l.wordpress.com/latex.php?latex=%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Br%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\text{c}, \text{a}, \text{r})' title='(\text{c}, \text{a}, \text{r})' class='latex' />, which has <img src='http://l.wordpress.com/latex.php?latex=%28%7C%5CSigma%7C+-+1%29+n+%3D+75&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(|\Sigma| - 1) n = 75' title='(|\Sigma| - 1) n = 75' class='latex' /> neighbors. Out of these <img src='http://l.wordpress.com/latex.php?latex=75&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='75' title='75' class='latex' /> words, I could count <img src='http://l.wordpress.com/latex.php?latex=21&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='21' title='21' class='latex' /> words which actually mean something in the English language:</p>
<p style="text-align:center;padding-left:60px;"><em>bar, ear, far, gar, jar, mar, oar, par, tar, war, yar, cor, cur, cab, cad, cam, can, cap, cat, caw, cay</em>.</p>
<p>Please let me know if I forgot to include any word in this list. These words form a sub-graph of the graph of all <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />-strings. Note that the words</p>
<p style="text-align:center;"><em>bar, car, </em><em>ear, </em><em>far, gar, </em><em>jar, mar, </em><em>oar, </em><em>par, </em><em>tar, </em><em>war, yar<br />
</em></p>
<p>are all neighbors of one another, and hence, they form a <a href="http://en.wikipedia.org/wiki/Clique_%28graph_theory%29" target="_blank">clique</a> of size <img src='http://l.wordpress.com/latex.php?latex=12&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='12' title='12' class='latex' />. The words</p>
<p style="text-align:center;"><em>car, cor, </em><em>cur</em></p>
<p>form a clique of size <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />. The words</p>
<p style="text-align:center;"><em>cab</em>, <em>cad, cam</em>, <em>can</em>, <em>cap, car, cat, caw, cay<br />
</em></p>
<p>are all neighbors of one another as well, and thus they form a clique of size <img src='http://l.wordpress.com/latex.php?latex=9&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='9' title='9' class='latex' />. The subgraph formed by the word &#8220;car&#8221; and its neighbors which make sense in the English language is illustrated below, where the three cliques are easy to identify</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/01/undirected-word-graph-with-3-cliques-iii.png"><img class="alignnone size-full wp-image-4004" title="Undirected Word Graph with 3 Cliques" src="http://stochastix.files.wordpress.com/2009/01/undirected-word-graph-with-3-cliques-iii.png?w=450&#038;h=158" alt="Undirected Word Graph with 3 Cliques" width="450" height="158" /></a></p>
<p style="text-align:center;">
<p style="text-align:center;">[ graph generated with <a href="http://www.graphviz.org" target="_blank">Graphviz</a> ]</p>
<p>It is not practical to depict the whole graph of <img src='http://l.wordpress.com/latex.php?latex=3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3' title='3' class='latex' />-strings over alphabet <img src='http://l.wordpress.com/latex.php?latex=%5CSigma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Sigma' title='\Sigma' class='latex' /> since it contains <img src='http://l.wordpress.com/latex.php?latex=%7C%5CSigma%5E3%7C+%3D+%7C%5CSigma%7C%5E3+%3D+26%5E3+%3D+17576&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\Sigma^3| = |\Sigma|^3 = 26^3 = 17576' title='|\Sigma^3| = |\Sigma|^3 = 26^3 = 17576' class='latex' /> nodes and <img src='http://l.wordpress.com/latex.php?latex=%7CE%7C+%3D+659100&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|E| = 659100' title='|E| = 659100' class='latex' /> edges!</p>
<p style="text-align:center;">__________</p>
<p><strong>Python code</strong><strong><br />
</strong></p>
<p>In case you are wondering: no, I did <span style="text-decoration:underline;">not</span> type the 26 symbols of the Latin alphabet in <img src='http://l.wordpress.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\LaTeX' title='\LaTeX' class='latex' />. That would have been way too cumbersome. All it took was one single line of <a href="http://www.python.org" target="_blank">Python</a> code:</p>
<pre class="brush: python;">

&quot;, &quot;.join([(&quot;\text{&quot; + chr(i) + &quot;}&quot;) for i in range(ord('a'),ord('z')+1)])
</pre>
<p>Suppose we would like to find all strings within <a href="http://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> of <img src='http://l.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1' title='1' class='latex' /> of string <img src='http://l.wordpress.com/latex.php?latex=%28%5Ctext%7Bc%7D%2C+%5Ctext%7Ba%7D%2C+%5Ctext%7Bt%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\text{c}, \text{a}, \text{t})' title='(\text{c}, \text{a}, \text{t})' class='latex' />. The following <a href="http://www.python.org" target="_blank">Python</a> script automates the process:</p>
<pre class="brush: python;">
def MutateString(s, alphabet, index):
    li = []
    for ch in alphabet:
        if ch != s[index]:
            li.append(s[:index] + ch + s[index+1:])
    return li

# build Latin alphabet (lowercase symbols only)
Sigma = [chr(i) for i in range(ord('a'),ord('z')+1)]

# obtain list of mutated strings
print &quot;Mutate 1st symbol:\n&quot; + &quot;, &quot;.join(MutateString('cat', Sigma, 0)) + '\n'
print &quot;Mutate 2nd symbol:\n&quot; + &quot;, &quot;.join(MutateString('cat', Sigma, 1)) + '\n'
print &quot;Mutate 3rd symbol:\n&quot; + &quot;, &quot;.join(MutateString('cat', Sigma, 2)) + '\n'
</pre>
<p>The graph of the word &#8220;car&#8221; and its neighbors was generated also by a <a href="http://www.python.org" target="_blank">Python</a> script using the <a href="http://software.inl.fr/trac/wiki/GvGen" target="_blank">GvGen</a> library.</p>
<pre class="brush: python;">
def HammingDistance(s1, s2):
    &quot;&quot;&quot;Computes the Hamming distance between strings s1 and s2&quot;&quot;&quot;
    assert len(s1) == len(s2)
    return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2))

import gvgen

# list of words
words = ['car', 'bar', 'ear', 'far', 'gar', 'jar', 'mar', 'oar', 'par', 'tar', 'war', 'yar', 'cor', 'cur', 'cab', 'cad', 'cam', 'can', 'cap', 'cat', 'caw', 'cay']

# creates the new graph instance
graph = gvgen.GvGen()
graph.smart_mode = 1

# creates graph nodes
nodes = []
for elem in words:
    nodes.append(graph.newItem(elem))

# creates graph edges
for i in nodes:
    for j in nodes:

        # extracts the labels of each node
        node1 = i['properties']['label']
        node2 = j['properties']['label']

        # links nodes i and j if the Hamming
        # distance between their labels is 1
        if HammingDistance(node1,node2) == 1:
            graph.newLink(i,j)

# outputs the Graphviz code to a .dot file
filename = &quot;test.dot&quot;
FileOut = open(filename,&quot;w&quot;)
graph.dot(FileOut)
FileOut.close()
</pre>
<p>The script outputs a <a href="http://en.wikipedia.org/wiki/DOT_language" target="_blank">DOT file</a> which can be read by <a href="http://www.graphviz.org" target="_blank">Graphviz</a>. In particular, I used <em>GVedit</em> (with layout engine = <em>circo</em>) to generate the diagram depicted above.</p>
<p><span style="text-decoration:underline;">Remark</span>: these snippets of code worked with <a href="http://www.python.org" target="_blank">Python</a> 2.5.2. I can not guarantee that they work with other versions.<strong> </strong></p>
Posted in Computer Science Tagged: Computer Science, Graphs, Graphviz, GvGen, Hamming distance, Python <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/3861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/3861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/3861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/3861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/3861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/3861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/3861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/3861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/3861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/3861/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=3861&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/01/31/distance-between-two-words/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/01/undirected-word-graph-with-3-cliques-iii.png" medium="image">
			<media:title type="html">Undirected Word Graph with 3 Cliques</media:title>
		</media:content>
	</item>
		<item>
		<title>Colored Water Figures</title>
		<link>http://stochastix.wordpress.com/2009/01/01/colored-water-figures/</link>
		<comments>http://stochastix.wordpress.com/2009/01/01/colored-water-figures/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 06:35:21 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[High-Speed Photography]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=3768</guid>
		<description><![CDATA[Fotoopa is a photographer from Belgium who has shot amazing high speed photos of dancing and splashing colored water drops. Here&#8217;s an example of a droplet captured in mid-splash in vivid detail:

[ photo courtesy of fotoopa ]
Apart from the standard photographic equipment (camera, lenses, multiple flashes), fotoopa uses some high-tech hardware more commonly found on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=3768&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.pbase.com/fotoopa" target="_blank">Fotoopa</a> is a photographer from Belgium who has shot amazing high speed photos of dancing and splashing colored water drops. Here&#8217;s an example of a droplet captured in mid-splash in vivid detail:</p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2009/01/colored-waterfigure-by-fotoopa.jpg"><img class="size-full wp-image-3769 aligncenter" style="border:1px solid black;" title="Colored Waterfigure - by Fotoopa" src="http://stochastix.files.wordpress.com/2009/01/colored-waterfigure-by-fotoopa.jpg?w=360&#038;h=240" alt="Colored Waterfigure - by Fotoopa" width="360" height="240" /></a></p>
<p style="text-align:center;">[ <a href="http://www.flickr.com/photos/fotoopa_hs/2411101670/in/set-72157604178274003/" target="_blank">photo</a> courtesy of <a href="http://www.flickr.com/photos/fotoopa_hs/" target="_blank">fotoopa</a> ]</p>
<p>Apart from the standard photographic equipment (camera, lenses, multiple flashes), <a href="http://www.pbase.com/fotoopa" target="_blank">fotoopa</a> uses some high-tech <a href="http://www.pbase.com/fotoopa/equipment" target="_blank">hardware</a> more commonly found on a physics research lab: lasers, <a href="http://en.wikipedia.org/wiki/Light-emitting_diode" target="_blank">LEDs</a>, homemade electronics, power amplifiers, microcontrollers, <a href="http://en.wikipedia.org/wiki/Field-programmable_gate_array" target="_blank">FPGAs</a>. It&#8217;s very, very impressive indeed.</p>
Posted in Art, Technology Tagged: Art, High-Speed Photography, Photography, Technology <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/3768/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/3768/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/3768/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/3768/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/3768/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/3768/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/3768/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/3768/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/3768/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/3768/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=3768&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2009/01/01/colored-water-figures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2009/01/colored-waterfigure-by-fotoopa.jpg" medium="image">
			<media:title type="html">Colored Waterfigure - by Fotoopa</media:title>
		</media:content>
	</item>
		<item>
		<title>Distance between two lines</title>
		<link>http://stochastix.wordpress.com/2008/12/28/distance-between-two-lines/</link>
		<comments>http://stochastix.wordpress.com/2008/12/28/distance-between-two-lines/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 10:51:01 +0000</pubDate>
		<dc:creator>Rod Carvalho</dc:creator>
				<category><![CDATA[Geometry]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Analytical Geometry]]></category>

		<guid isPermaLink="false">http://stochastix.wordpress.com/?p=2879</guid>
		<description><![CDATA[Suppose we are given two lines in ,  and . Line  passes through the point  and its direction is given by vector 
.
Line  passes through the point  and its direction is given by vector 
.
What is the distance between lines  and ?
__________
Lines as functions

Let vector-valued functions  and  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=2879&subd=stochastix&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Suppose we are given two <a href="http://en.wikipedia.org/wiki/Line_%28mathematics%29" target="_blank">lines</a> in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}^n' title='\mathbb{R}^n' class='latex' />, <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />. Line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> passes through the point <img src='http://l.wordpress.com/latex.php?latex=x_0+%5Cin+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_0 \in \mathbb{R}^n' title='x_0 \in \mathbb{R}^n' class='latex' /> and its direction is given by vector <img src='http://l.wordpress.com/latex.php?latex=u+%5Cin+%5Cmathbb%7BR%7D%5En+%5Csetminus+%5C%7B0_n%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='u \in \mathbb{R}^n \setminus \{0_n\}' title='u \in \mathbb{R}^n \setminus \{0_n\}' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1+%3D+%5Cleft%5C%7B+x_0+%2B+%5Clambda+u+%5Cmid+%5Clambda+%5Cin+%5Cmathbb%7BR%7D+%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1 = \left\{ x_0 + \lambda u \mid \lambda \in \mathbb{R} \right\}' title='\mathcal{L}_1 = \left\{ x_0 + \lambda u \mid \lambda \in \mathbb{R} \right\}' class='latex' />.</p>
<p>Line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> passes through the point <img src='http://l.wordpress.com/latex.php?latex=y_0+%5Cin+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y_0 \in \mathbb{R}^n' title='y_0 \in \mathbb{R}^n' class='latex' /> and its direction is given by vector <img src='http://l.wordpress.com/latex.php?latex=v+%5Cin+%5Cmathbb%7BR%7D%5En+%5Csetminus+%5C%7B0_n%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v \in \mathbb{R}^n \setminus \{0_n\}' title='v \in \mathbb{R}^n \setminus \{0_n\}' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2+%3D+%5Cleft%5C%7B+y_0+%2B+%5Cgamma+v+%5Cmid+%5Cgamma+%5Cin+%5Cmathbb%7BR%7D+%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2 = \left\{ y_0 + \gamma v \mid \gamma \in \mathbb{R} \right\}' title='\mathcal{L}_2 = \left\{ y_0 + \gamma v \mid \gamma \in \mathbb{R} \right\}' class='latex' />.</p>
<p>What is the distance between lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />?</p>
<p style="text-align:center;">__________</p>
<p><strong>Lines as functions<br />
</strong></p>
<p>Let vector-valued functions <img src='http://l.wordpress.com/latex.php?latex=x+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x : \mathbb{R} \rightarrow \mathbb{R}^n' title='x : \mathbb{R} \rightarrow \mathbb{R}^n' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=y+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y : \mathbb{R} \rightarrow \mathbb{R}^n' title='y : \mathbb{R} \rightarrow \mathbb{R}^n' class='latex' /> be defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29+%3D+x_0+%2B+%5Clambda+u%2C+%5Cquad%7B%7D+y%28%5Cgamma%29+%3D+y_0+%2B+%5Cgamma+v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda) = x_0 + \lambda u, \quad{} y(\gamma) = y_0 + \gamma v' title='x(\lambda) = x_0 + \lambda u, \quad{} y(\gamma) = y_0 + \gamma v' class='latex' />.</p>
<p>Lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> are thus the images of set <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}' title='\mathbb{R}' class='latex' /> under functions <img src='http://l.wordpress.com/latex.php?latex=x+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x : \mathbb{R} \rightarrow \mathbb{R}^n' title='x : \mathbb{R} \rightarrow \mathbb{R}^n' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=y+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y : \mathbb{R} \rightarrow \mathbb{R}^n' title='y : \mathbb{R} \rightarrow \mathbb{R}^n' class='latex' />, respectively</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1+%3D+%5Cleft%5C%7B+x%28%5Clambda%29+%5Cmid+%5Clambda+%5Cin+%5Cmathbb%7BR%7D+%5Cright%5C%7D%2C+%5Cquad%7B%7D+%5Cmathcal%7BL%7D_2+%3D+%5Cleft%5C%7B+y%28%5Cgamma%29+%5Cmid+%5Cgamma+%5Cin+%5Cmathbb%7BR%7D+%5Cright%5C%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1 = \left\{ x(\lambda) \mid \lambda \in \mathbb{R} \right\}, \quad{} \mathcal{L}_2 = \left\{ y(\gamma) \mid \gamma \in \mathbb{R} \right\}' title='\mathcal{L}_1 = \left\{ x(\lambda) \mid \lambda \in \mathbb{R} \right\}, \quad{} \mathcal{L}_2 = \left\{ y(\gamma) \mid \gamma \in \mathbb{R} \right\}' class='latex' />.</p>
<p>Function <img src='http://l.wordpress.com/latex.php?latex=x%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x: \mathbb{R} \rightarrow \mathbb{R}^n' title='x: \mathbb{R} \rightarrow \mathbb{R}^n' class='latex' /> maps each <img src='http://l.wordpress.com/latex.php?latex=%5Clambda+%5Cin++%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda \in  \mathbb{R}' title='\lambda \in  \mathbb{R}' class='latex' /> into point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda) \in \mathcal{L}_1' title='x(\lambda) \in \mathcal{L}_1' class='latex' />. Therefore, choosing a particular value of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> corresponds to choosing a point on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' />, and <em>vice versa</em> (because function <img src='http://l.wordpress.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x' title='x' class='latex' /> is injective). Thus, each point on the line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> can be unambiguously specified by a value of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' />. Similarly, following the same line of thought, each point on the line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> can be unambiguously specified by a value of <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />.</p>
<p style="text-align:center;">__________</p>
<p><strong>Distance between two points<br />
</strong></p>
<p>In order to compute the distance between lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />, we first need to know how to compute the distance between two points in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}^n' title='\mathbb{R}^n' class='latex' />, i.e., we need to choose a <a href="http://en.wikipedia.org/wiki/Metric_%28mathematics%29" target="_blank">metric</a> on <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D%5En&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}^n' title='\mathbb{R}^n' class='latex' />. For the sake of simplicity, we will use the <a href="http://en.wikipedia.org/wiki/Euclidean_metric" target="_blank">Euclidean metric</a>, i.e., we will use the 2-norm to measure lengths and distances. In other words, we will be working in normed vector space <img src='http://l.wordpress.com/latex.php?latex=%28%5Cmathbb%7BR%7D%5En%2C++%5C%7C+%5Ccdot+%5C%7C_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\mathbb{R}^n,  \| \cdot \|_2)' title='(\mathbb{R}^n,  \| \cdot \|_2)' class='latex' />.</p>
<p>Let us fix parameters <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, i.e., <img src='http://l.wordpress.com/latex.php?latex=%5Clambda+%3D+%5Cbar%7B%5Clambda%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda = \bar{\lambda}' title='\lambda = \bar{\lambda}' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma+%3D+%5Cbar%7B%5Cgamma%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma = \bar{\gamma}' title='\gamma = \bar{\gamma}' class='latex' />, and compute the distance between fixed points <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda})' title='x(\bar{\lambda})' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=y%28%5Cbar%7B%5Cgamma%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\bar{\gamma})' title='y(\bar{\gamma})' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28+x%28%5Cbar%7B%5Clambda%7D%29%2C+y%28%5Cbar%7B%5Cgamma%7D%29+%29+%3D+%5C%7C+x%28+%5Cbar%7B%5Clambda%7D+%29+-+y%28%5Cbar%7B%5Cgamma%7D+%29%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} ( x(\bar{\lambda}), y(\bar{\gamma}) ) = \| x( \bar{\lambda} ) - y(\bar{\gamma} )\|_2' title='\textbf{dist} ( x(\bar{\lambda}), y(\bar{\gamma}) ) = \| x( \bar{\lambda} ) - y(\bar{\gamma} )\|_2' class='latex' />.</p>
<p>Pictorially, we have that <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28+x%28%5Cbar%7B%5Clambda%7D%29%2C+y%28%5Cbar%7B%5Cgamma%7D%29+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} ( x(\bar{\lambda}), y(\bar{\gamma}) )' title='\textbf{dist} ( x(\bar{\lambda}), y(\bar{\gamma}) )' class='latex' /> is the length of the line segment connecting fixed points <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda})' title='x(\bar{\lambda})' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=y%28%5Cbar%7B%5Cgamma%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\bar{\gamma})' title='y(\bar{\gamma})' class='latex' /></p>
<p style="text-align:center;"><a href="http://stochastix.files.wordpress.com/2008/12/distance-between-2-fixed-points.png"><img class="size-full wp-image-3427 aligncenter" title="Distance between 2 fixed points" src="http://stochastix.files.wordpress.com/2008/12/distance-between-2-fixed-points.png?w=450&#038;h=323" alt="Distance between 2 fixed points" width="450" height="323" /></a></p>
<p>To each pair of parameters <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%2C+%5Cgamma%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda, \gamma)' title='(\lambda, \gamma)' class='latex' />, it is assigned a non-negative scalar <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28+x%28%5Clambda%29%2C+y%28%5Cgamma%29+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} ( x(\lambda), y(\gamma) )' title='\textbf{dist} ( x(\lambda), y(\gamma) )' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%2C+%5Cgamma%29+%5Cmapsto+%28+x%28%5Clambda%29%2C+y%28%5Cgamma%29+%29+%5Cmapsto+%5Ctextbf%7Bdist%7D+%28+x%28%5Clambda%29%2C+y%28%5Cgamma%29+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda, \gamma) \mapsto ( x(\lambda), y(\gamma) ) \mapsto \textbf{dist} ( x(\lambda), y(\gamma) )' title='(\lambda, \gamma) \mapsto ( x(\lambda), y(\gamma) ) \mapsto \textbf{dist} ( x(\lambda), y(\gamma) )' class='latex' />.</p>
<p style="text-align:center;">__________</p>
<p><strong>Distance between a point and a line</strong></p>
<p>Suppose now that we vary <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, while <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> remains fixed, <img src='http://l.wordpress.com/latex.php?latex=%5Clambda+%3D+%5Cbar%7B%5Clambda%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda = \bar{\lambda}' title='\lambda = \bar{\lambda}' class='latex' />. As we vary <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, we travel along line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> and hence the distance between free point <img src='http://l.wordpress.com/latex.php?latex=y%28%5Cgamma%29+%5Cin+%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\gamma) \in \mathcal{L}_2' title='y(\gamma) \in \mathcal{L}_2' class='latex' /> and fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) \in \mathcal{L}_1' title='x(\bar{\lambda}) \in \mathcal{L}_1' class='latex' /> is given by</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Cbar%7B%5Clambda%7D%29%2C+y%28%5Cgamma%29%29+%3D+%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\bar{\lambda}), y(\gamma)) = \| x(\bar{\lambda}) - y(\gamma)\|_2' title='\textbf{dist} (x(\bar{\lambda}), y(\gamma)) = \| x(\bar{\lambda}) - y(\gamma)\|_2' class='latex' />.</p>
<p>Since <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' /> is now free, <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Cbar%7B%5Clambda%7D%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\bar{\lambda}), y(\gamma))' title='\textbf{dist} (x(\bar{\lambda}), y(\gamma))' class='latex' /> is a function of <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />.</p>
<p>For example, let us pick three distinct values for <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, say <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma_1%2C+%5Cgamma_2%2C+%5Cgamma_3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma_1, \gamma_2, \gamma_3' title='\gamma_1, \gamma_2, \gamma_3' class='latex' />. The image below depicts the line segments connecting fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) \in \mathcal{L}_1' title='x(\bar{\lambda}) \in \mathcal{L}_1' class='latex' /> and points <img src='http://l.wordpress.com/latex.php?latex=y%28%5Cgamma_1%29%2C+y%28%5Cgamma_2%29%2C+y%28%5Cgamma_3%29+%5Cin+%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\gamma_1), y(\gamma_2), y(\gamma_3) \in \mathcal{L}_2' title='y(\gamma_1), y(\gamma_2), y(\gamma_3) \in \mathcal{L}_2' class='latex' />. The length of these line segments gives us the distance between the fixed point and each of the three points on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />.</p>
<p><a href="http://stochastix.files.wordpress.com/2008/12/distances-between-a-fixed-point-in-l1-and-three-points-in-l2.png"><img class="size-full wp-image-3432 aligncenter" title="Distances between a fixed point in L1 and three points in L2" src="http://stochastix.files.wordpress.com/2008/12/distances-between-a-fixed-point-in-l1-and-three-points-in-l2.png?w=450&#038;h=322" alt="Distances between a fixed point in L1 and three points in L2" width="450" height="322" /></a></p>
<p>The distance between fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) \in \mathcal{L}_1' title='x(\bar{\lambda}) \in \mathcal{L}_1' class='latex' /> and line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is thus</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Cbar%7B%5Clambda%7D%29%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Cgamma+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\bar{\lambda}), \mathcal{L}_2) = \displaystyle \min_{\gamma \in \mathbb{R}} \| x(\bar{\lambda}) - y(\gamma) \|_2' title='\textbf{dist} (x(\bar{\lambda}), \mathcal{L}_2) = \displaystyle \min_{\gamma \in \mathbb{R}} \| x(\bar{\lambda}) - y(\gamma) \|_2' class='latex' />.</p>
<p>We have an optimization problem: we would like to find the value of parameter <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma+%5Cin+%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma \in \mathbb{R}' title='\gamma \in \mathbb{R}' class='latex' /> which minimizes function <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Cbar%7B%5Clambda%7D%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\bar{\lambda}), y(\gamma))' title='\textbf{dist} (x(\bar{\lambda}), y(\gamma))' class='latex' />. This minimizer is (see appendix A)</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cgamma%5E%2A+%3D+%5Cdisplaystyle+%5Carg+%5Cmin_%7B%5Cgamma+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%5C%7C_2+%5CRightarrow+%5Cgamma%5E%2A+%3D+%5Cdisplaystyle+%5Cfrac%7Bv%5ET++%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29%7D%7B+v%5ET+v%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma^* = \displaystyle \arg \min_{\gamma \in \mathbb{R}} \| x(\bar{\lambda}) - y(\gamma) \|_2 \Rightarrow \gamma^* = \displaystyle \frac{v^T  ( x(\bar{\lambda}) - y_0 )}{ v^T v}' title='\gamma^* = \displaystyle \arg \min_{\gamma \in \mathbb{R}} \| x(\bar{\lambda}) - y(\gamma) \|_2 \Rightarrow \gamma^* = \displaystyle \frac{v^T  ( x(\bar{\lambda}) - y_0 )}{ v^T v}' class='latex' />.</p>
<p>Evaluating function <img src='http://l.wordpress.com/latex.php?latex=y&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y' title='y' class='latex' /> at <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma%5E%2A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma^*' title='\gamma^*' class='latex' /> we obtain <img src='http://l.wordpress.com/latex.php?latex=y%28+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y( \gamma^*)' title='y( \gamma^*)' class='latex' />, the point on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> that is closest to fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) \in \mathcal{L}_1' title='x(\bar{\lambda}) \in \mathcal{L}_1' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=y%28+%5Cgamma%5E%2A%29+%3D+%5Cdisplaystyle+y_0+%2B+P_v++%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y( \gamma^*) = \displaystyle y_0 + P_v  ( x(\bar{\lambda}) - y_0 )' title='y( \gamma^*) = \displaystyle y_0 + P_v  ( x(\bar{\lambda}) - y_0 )' class='latex' />,</p>
<p>where</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=P_v+%3D+%5Cdisplaystyle+%5Cfrac%7Bv+v%5ET%7D%7Bv%5ET+v%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v = \displaystyle \frac{v v^T}{v^T v}' title='P_v = \displaystyle \frac{v v^T}{v^T v}' class='latex' /></p>
<p>is a symmetric, idempotent (<img src='http://l.wordpress.com/latex.php?latex=P_v%5E2+%3D+P_v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v^2 = P_v' title='P_v^2 = P_v' class='latex' />) <a href="http://en.wikipedia.org/wiki/Projection_%28linear_algebra%29" target="_blank">projection</a> matrix, and <img src='http://l.wordpress.com/latex.php?latex=P_v+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v ( x(\bar{\lambda}) - y_0 )' title='P_v ( x(\bar{\lambda}) - y_0 )' class='latex' /> is the orthogonal projection of vector <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y_0' title='x(\bar{\lambda}) - y_0' class='latex' /> onto vector <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' />. It can be shown that vectors  <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y( \gamma^*)' title='x(\bar{\lambda}) - y( \gamma^*)' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' /> are orthogonal (see appendix B).</p>
<p>For example, let us consider the <img src='http://l.wordpress.com/latex.php?latex=n%3D3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='n=3' title='n=3' class='latex' /> case: we have two lines in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D%5E3&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}^3' title='\mathbb{R}^3' class='latex' />, <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />, where <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> lies on plane <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BP%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{P}' title='\mathcal{P}' class='latex' />. Pictorially, we have</p>
<p><a href="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space.png"><img class="size-full wp-image-3477 aligncenter" title="Two lines in 3-space" src="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space.png?w=450&#038;h=311" alt="Two lines in 3-space" width="450" height="311" /></a></p>
<p>We would like to find the point on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> that is closest to fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) \in \mathcal{L}_1' title='x(\bar{\lambda}) \in \mathcal{L}_1' class='latex' />. Projecting vector <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y_0' title='x(\bar{\lambda}) - y_0' class='latex' /> orthogonally onto vector <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' />, we obtain</p>
<p><a href="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space-distance-between-fixed-point-in-l1-and-l2.png"><img class="size-full wp-image-3483 aligncenter" title="Two lines in 3-space - distance between fixed point in L1 and L2" src="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space-distance-between-fixed-point-in-l1-and-l2.png?w=450&#038;h=307" alt="Two lines in 3-space - distance between fixed point in L1 and L2" width="450" height="307" /></a>The image above illustrates rather nicely that vectors  <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y( \gamma^*)' title='x(\bar{\lambda}) - y( \gamma^*)' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' /> are orthogonal (see appendix B). The distance between fixed point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda})' title='x(\bar{\lambda})' class='latex' /> and line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Cbar%7B%5Clambda%7D%29%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\bar{\lambda}), \mathcal{L}_2) = \| x(\bar{\lambda}) - y( \gamma^*) \|_2' title='\textbf{dist} (x(\bar{\lambda}), \mathcal{L}_2) = \| x(\bar{\lambda}) - y( \gamma^*) \|_2' class='latex' />,</p>
<p>where <img src='http://l.wordpress.com/latex.php?latex=y%28+%5Cgamma%5E%2A%29+%3D+%5Cdisplaystyle+y_0+%2B+P_v++%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y( \gamma^*) = \displaystyle y_0 + P_v  ( x(\bar{\lambda}) - y_0 )' title='y( \gamma^*) = \displaystyle y_0 + P_v  ( x(\bar{\lambda}) - y_0 )' class='latex' />. Please note that plane <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BP%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{P}' title='\mathcal{P}' class='latex' /> serves no purpose other than to make it easier to visualize in 3-d (plane <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BP%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{P}' title='\mathcal{P}' class='latex' /> gives an impression of depth). In other words, plane <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BP%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{P}' title='\mathcal{P}' class='latex' /> has some &#8220;artistic value&#8221;, but no &#8220;mathematical value&#8221;.</p>
<p style="text-align:center;">__________</p>
<p><strong>Distance between two lines</strong></p>
<p>Let us now vary both <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />. As we vary <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, we travel along lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />, respectively. Since both parameters are free, the distance between free points <img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29+%5Cin+%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda) \in \mathcal{L}_1' title='x(\lambda) \in \mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=y%28%5Cgamma%29+%5Cin+%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\gamma) \in \mathcal{L}_2' title='y(\gamma) \in \mathcal{L}_2' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29+%3D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), y(\gamma)) = \| x(\lambda) - y(\gamma) \|_2' title='\textbf{dist} (x(\lambda), y(\gamma)) = \| x(\lambda) - y(\gamma) \|_2' class='latex' />,</p>
<p>which is a function of both <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />. The distance between lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is thus</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%28%5Clambda%2C+%5Cgamma%29+%5Cin+%5Cmathbb%7BR%7D%5E2%7D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{(\lambda, \gamma) \in \mathbb{R}^2} \| x(\lambda) - y(\gamma) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{(\lambda, \gamma) \in \mathbb{R}^2} \| x(\lambda) - y(\gamma) \|_2' class='latex' />.</p>
<p>The original problem of computing the distance between two lines has thus been cast as an optimization problem: we would like to find the pair <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%2C+%5Cgamma%29+%5Cin+%5Cmathbb%7BR%7D%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda, \gamma) \in \mathbb{R}^2' title='(\lambda, \gamma) \in \mathbb{R}^2' class='latex' /> which minimizes <img src='http://l.wordpress.com/latex.php?latex=+%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt=' \textbf{dist} (x(\lambda), y(\gamma))' title=' \textbf{dist} (x(\lambda), y(\gamma))' class='latex' />. Once we have found the pair of minimizers <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%5E%2A%2C+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda^*, \gamma^*)' title='(\lambda^*, \gamma^*)' class='latex' />, the distance between <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5C%7C+x%28%5Clambda%5E%2A%29+-+y%28%5Cgamma%5E%2A%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \| x(\lambda^*) - y(\gamma^*) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \| x(\lambda^*) - y(\gamma^*) \|_2' class='latex' />.</p>
<p>The pair <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%5E%2A%2C+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda^*, \gamma^*)' title='(\lambda^*, \gamma^*)' class='latex' /> is not necessarily unique. For example, if the lines are parallel to each other, then there are infinitely many pairs of minimizers <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%5E%2A%2C+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda^*, \gamma^*)' title='(\lambda^*, \gamma^*)' class='latex' />.</p>
<p>Trying to find the pair <img src='http://l.wordpress.com/latex.php?latex=%28%5Clambda%2C+%5Cgamma%29+%5Cin+%5Cmathbb%7BR%7D%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(\lambda, \gamma) \in \mathbb{R}^2' title='(\lambda, \gamma) \in \mathbb{R}^2' class='latex' /> which minimizes <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), y(\gamma))' title='\textbf{dist} (x(\lambda), y(\gamma))' class='latex' /> is a one-stage 2-dimensional optimization problem. However, we can solve this optimization problem in two stages, where at each stage we must solve a 1-dimensional optimization problem</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Clambda+%5Cin+%5Cmathbb%7BR%7D%7D+%5Cmin_%7B%5Cgamma+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2' class='latex' />.</p>
<p>Note that</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5Cmin_%7B%5Cgamma+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2+%3D+%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+%5Cmathcal%7BL%7D_2%29+&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2 = \textbf{dist} (x(\lambda), \mathcal{L}_2) ' title='\displaystyle \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2 = \textbf{dist} (x(\lambda), \mathcal{L}_2) ' class='latex' /></p>
<p>is the distance between point <img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda)' title='x(\lambda)' class='latex' /> and line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />, and thus</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Clambda+%5Cin+%5Cmathbb%7BR%7D%7D+%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+%5Cmathcal%7BL%7D_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \textbf{dist} (x(\lambda), \mathcal{L}_2)' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \textbf{dist} (x(\lambda), \mathcal{L}_2)' class='latex' />.</p>
<p>We already know how to compute the distance between a point on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' />: given a value of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' />, the choice of <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' /> which minimizes <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), y(\gamma))' title='\textbf{dist} (x(\lambda), y(\gamma))' class='latex' /> is <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma+%3D+%5CGamma+%28%5Clambda%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma = \Gamma (\lambda)' title='\gamma = \Gamma (\lambda)' class='latex' />, where function <img src='http://l.wordpress.com/latex.php?latex=%5CGamma+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Gamma : \mathbb{R} \rightarrow \mathbb{R}' title='\Gamma : \mathbb{R} \rightarrow \mathbb{R}' class='latex' /> is defined as (see appendix A)</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5CGamma+%28%5Clambda%29+%3D++%5Cdisplaystyle+%5Cfrac%7Bv%5ET++%28+x%28%5Clambda%29+-+y_0+%29%7D%7B+v%5ET+v%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Gamma (\lambda) =  \displaystyle \frac{v^T  ( x(\lambda) - y_0 )}{ v^T v}' title='\Gamma (\lambda) =  \displaystyle \frac{v^T  ( x(\lambda) - y_0 )}{ v^T v}' class='latex' />,</p>
<p>and the point on line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> which is closest to <img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda)' title='x(\lambda)' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=y%28%5CGamma+%28%5Clambda%29%29+%3D+y_0+%2B+P_v+%5Cleft%28+x%28%5Clambda%29+-+y_0+%5Cright%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y(\Gamma (\lambda)) = y_0 + P_v \left( x(\lambda) - y_0 \right)' title='y(\Gamma (\lambda)) = y_0 + P_v \left( x(\lambda) - y_0 \right)' class='latex' />.</p>
<p>Therefore, for a given value of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' />, we have that the distance between <img src='http://l.wordpress.com/latex.php?latex=x%28%5Clambda%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\lambda)' title='x(\lambda)' class='latex' /> and line <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5CGamma%28%5Clambda%29%29%29+%3D+%5C%7C+x%28%5Clambda%29+-+y%28+%5CGamma+%28%5Clambda%29%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), \mathcal{L}_2) = \textbf{dist} (x(\lambda), y(\Gamma(\lambda))) = \| x(\lambda) - y( \Gamma (\lambda)) \|_2' title='\textbf{dist} (x(\lambda), \mathcal{L}_2) = \textbf{dist} (x(\lambda), y(\Gamma(\lambda))) = \| x(\lambda) - y( \Gamma (\lambda)) \|_2' class='latex' />.</p>
<p>Note that <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+%5Cmathcal%7BL%7D_2%29+&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), \mathcal{L}_2) ' title='\textbf{dist} (x(\lambda), \mathcal{L}_2) ' class='latex' /> is a function of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> only, as we have already optimized function <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), y(\gamma))' title='\textbf{dist} (x(\lambda), y(\gamma))' class='latex' /> for <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />. Finally, the distance between lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> can be found by solving a 1-dimensional optimization problem in <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Clambda+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7Cx%28%5Clambda%29+-+y%28+%5CGamma+%28%5Clambda%29+%29%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \|x(\lambda) - y( \Gamma (\lambda) )\|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \|x(\lambda) - y( \Gamma (\lambda) )\|_2' class='latex' />.</p>
<p>Once we have found the <img src='http://l.wordpress.com/latex.php?latex=%5Clambda%5E%2A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda^*' title='\lambda^*' class='latex' /> which minimizes the distance <img src='http://l.wordpress.com/latex.php?latex=%5C%7C+x%28%5Clambda%29+-+y%28+%5CGamma+%28%5Clambda%29%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\| x(\lambda) - y( \Gamma (\lambda)) \|_2' title='\| x(\lambda) - y( \Gamma (\lambda)) \|_2' class='latex' />, the distance between  lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> is simply</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5C%7C+x%28%5Clambda%5E%2A%29+-+y%28+%5CGamma+%28%5Clambda%5E%2A%29%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \| x(\lambda^*) - y( \Gamma (\lambda^*)) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \| x(\lambda^*) - y( \Gamma (\lambda^*)) \|_2' class='latex' />.</p>
<p>Note that:</p>
<ul>
<li><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = 0' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = 0' class='latex' />: lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> do intersect.</li>
</ul>
<ul>
<li><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3E+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) &gt; 0' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) &gt; 0' class='latex' />: lines <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_1' title='\mathcal{L}_1' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BL%7D_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathcal{L}_2' title='\mathcal{L}_2' class='latex' /> do not intersect.</li>
</ul>
<p>The value of <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2)' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2)' class='latex' /> can be written in terms of points <img src='http://l.wordpress.com/latex.php?latex=x_0%2C+y_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x_0, y_0' title='x_0, y_0' class='latex' /> and direction vectors <img src='http://l.wordpress.com/latex.php?latex=u%2C+v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='u, v' title='u, v' class='latex' />, as I will show on some future posts.</p>
<p style="text-align:center;">__________</p>
<p><strong>The shortest distance game</strong></p>
<p>It might seem a bit obscure that the one-stage 2-dimensional optimization problem</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%28%5Clambda%2C+%5Cgamma%29+%5Cin+%5Cmathbb%7BR%7D%5E2%7D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{(\lambda, \gamma) \in \mathbb{R}^2} \| x(\lambda) - y(\gamma) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{(\lambda, \gamma) \in \mathbb{R}^2} \| x(\lambda) - y(\gamma) \|_2' class='latex' /></p>
<p>is equivalent to a two-stage optimization problem where at each stage one must solve a 1-dimensional optimization problem</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Clambda+%5Cin+%5Cmathbb%7BR%7D%7D+%5Cmin_%7B%5Cgamma+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Clambda%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \min_{\gamma \in \mathbb{R}} \| x(\lambda) - y(\gamma) \|_2' class='latex' />.</p>
<p>Personally, I like to look at this from a game-theoretic viewpoint. Let us play a sequential game! We shall call the <em>shortest distance game</em>. I play first, then you play:</p>
<ol>
<li>I choose a value for <img src='http://l.wordpress.com/latex.php?latex=%5Clambda+%5Cin+%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda \in \mathbb{R}' title='\lambda \in \mathbb{R}' class='latex' />, I tell you what <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> I chose.</li>
<li>You then choose <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma+%3D+%5CGamma+%28%5Clambda%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma = \Gamma (\lambda)' title='\gamma = \Gamma (\lambda)' class='latex' /> such that <img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28x%28%5Clambda%29%2C+y%28%5Cgamma%29%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (x(\lambda), y(\gamma))' title='\textbf{dist} (x(\lambda), y(\gamma))' class='latex' /> is minimized.</li>
</ol>
<p>Note that you are required to play optimally, i.e., to minimize distance. Hence you have no freedom in the choice of <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />: you choose <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' /> as a response to my choice of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' />. Your choice is now coupled to mine, and thus, we are left with only one degree of freedom, the choice of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' />. I now choose the value of <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> which minimizes <img src='http://l.wordpress.com/latex.php?latex=+%5C%7C+x%28%5Clambda%29+-+y%28+%5CGamma+%28%5Clambda%29%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt=' \| x(\lambda) - y( \Gamma (\lambda)) \|_2' title=' \| x(\lambda) - y( \Gamma (\lambda)) \|_2' class='latex' /></p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Ctextbf%7Bdist%7D+%28%5Cmathcal%7BL%7D_1%2C+%5Cmathcal%7BL%7D_2%29+%3D+%5Cdisplaystyle+%5Cmin_%7B%5Clambda+%5Cin+%5Cmathbb%7BR%7D%7D+%5C%7C+x%28%5Clambda%29+-+y%28+%5CGamma+%28%5Clambda%29%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \| x(\lambda) - y( \Gamma (\lambda)) \|_2' title='\textbf{dist} (\mathcal{L}_1, \mathcal{L}_2) = \displaystyle \min_{\lambda \in \mathbb{R}} \| x(\lambda) - y( \Gamma (\lambda)) \|_2' class='latex' />.</p>
<p>Fortunately, I can use calculus to find the minimizer <img src='http://l.wordpress.com/latex.php?latex=%5Clambda%5E%2A&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda^*' title='\lambda^*' class='latex' />. Trying all values in <img src='http://l.wordpress.com/latex.php?latex=%5Cmathbb%7BR%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\mathbb{R}' title='\mathbb{R}' class='latex' /> for parameter <img src='http://l.wordpress.com/latex.php?latex=%5Clambda&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\lambda' title='\lambda' class='latex' /> would be rather tedious ;-)</p>
<p style="text-align:center;">__________</p>
<p><strong>Appendix A</strong></p>
<p>Note that the value of parameter <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' /> which minimizes the distance <img src='http://l.wordpress.com/latex.php?latex=%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%5C%7C_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\| x(\bar{\lambda}) - y(\gamma) \|_2' title='\| x(\bar{\lambda}) - y(\gamma) \|_2' class='latex' /> is the same that minimizes the squared distance <img src='http://l.wordpress.com/latex.php?latex=%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%5C%7C_2%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\| x(\bar{\lambda}) - y(\gamma) \|_2^2' title='\| x(\bar{\lambda}) - y(\gamma) \|_2^2' class='latex' />. Finding the minimizer of the squared norm is much easier, thus we introduce a cost function <img src='http://l.wordpress.com/latex.php?latex=C+%3A+%5Cmathbb%7BR%7D+%5Crightarrow+%5B0%2C+%5Cinfty%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C : \mathbb{R} \rightarrow [0, \infty)' title='C : \mathbb{R} \rightarrow [0, \infty)' class='latex' /> defined as</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=C%28%5Cgamma%29+%3D+%5Cdisplaystyle+%5Cfrac%7B1%7D%7B2%7D+%5C%7C+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%5C%7C_2%5E2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C(\gamma) = \displaystyle \frac{1}{2} \| x(\bar{\lambda}) - y(\gamma) \|_2^2' title='C(\gamma) = \displaystyle \frac{1}{2} \| x(\bar{\lambda}) - y(\gamma) \|_2^2' class='latex' />.</p>
<p>Differentiating with respect to <img src='http://l.wordpress.com/latex.php?latex=%5Cgamma&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma' title='\gamma' class='latex' />, we obtain</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brl%7D+%5Cdisplaystyle+%5Cfrac%7Bd+C%7D%7Bd+%5Cgamma%7D+%28%5Cgamma%29+%26%3D+%5Cdisplaystyle+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28%5Cgamma%29+%29%5ET+%28-+v%29%5C%5C+%26%3D++%5Cdisplaystyle+v%5ET+%28+y%28%5Cgamma%29+-+x%28%5Cbar%7B%5Clambda%7D%29+%29+%5C%5C+%26%3D+%5Cdisplaystyle+v%5ET+%5Cleft%28+%5Cgamma+v+-+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29+%5Cright%29+%5C%5C+%26%3D%5Cdisplaystyle+%5C%7Cv%5C%7C_2%5E2+%5Cgamma+-+v%5ET+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29.%5C%5C+%5Cend%7Barray%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\begin{array}{rl} \displaystyle \frac{d C}{d \gamma} (\gamma) &amp;= \displaystyle ( x(\bar{\lambda}) - y(\gamma) )^T (- v)\\ &amp;=  \displaystyle v^T ( y(\gamma) - x(\bar{\lambda}) ) \\ &amp;= \displaystyle v^T \left( \gamma v - ( x(\bar{\lambda}) - y_0 ) \right) \\ &amp;=\displaystyle \|v\|_2^2 \gamma - v^T ( x(\bar{\lambda}) - y_0 ).\\ \end{array}' title='\begin{array}{rl} \displaystyle \frac{d C}{d \gamma} (\gamma) &amp;= \displaystyle ( x(\bar{\lambda}) - y(\gamma) )^T (- v)\\ &amp;=  \displaystyle v^T ( y(\gamma) - x(\bar{\lambda}) ) \\ &amp;= \displaystyle v^T \left( \gamma v - ( x(\bar{\lambda}) - y_0 ) \right) \\ &amp;=\displaystyle \|v\|_2^2 \gamma - v^T ( x(\bar{\lambda}) - y_0 ).\\ \end{array}' class='latex' /></p>
<p>The first derivative of <img src='http://l.wordpress.com/latex.php?latex=C%28%5Ccdot%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C(\cdot)' title='C(\cdot)' class='latex' /> must vanish at extrema. From the geometry of the problem, we know that there are no maxima (note that the cost function is unbounded above). Therefore we can find minima by checking the first derivative alone, without having to check the second derivative. We have</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5Cfrac%7Bd+C%7D%7Bd+%5Cgamma%7D+%28%5Cgamma%5E%2A%29+%3D+0+%5CRightarrow+%5Cdisplaystyle+%5C%7Cv%5C%7C_2%5E2+%5Cgamma%5E%2A+-+v%5ET+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29+%3D+0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle \frac{d C}{d \gamma} (\gamma^*) = 0 \Rightarrow \displaystyle \|v\|_2^2 \gamma^* - v^T ( x(\bar{\lambda}) - y_0 ) = 0' title='\displaystyle \frac{d C}{d \gamma} (\gamma^*) = 0 \Rightarrow \displaystyle \|v\|_2^2 \gamma^* - v^T ( x(\bar{\lambda}) - y_0 ) = 0' class='latex' />,</p>
<p>and since <img src='http://l.wordpress.com/latex.php?latex=v+%5Cneq+0_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v \neq 0_n' title='v \neq 0_n' class='latex' />, the minimizer is</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cgamma%5E%2A+%3D++%5Cdisplaystyle+%5Cfrac%7Bv%5ET++%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29%7D%7B+v%5ET+v%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\gamma^* =  \displaystyle \frac{v^T  ( x(\bar{\lambda}) - y_0 )}{ v^T v}' title='\gamma^* =  \displaystyle \frac{v^T  ( x(\bar{\lambda}) - y_0 )}{ v^T v}' class='latex' />.</p>
<p>Note that this minimizer depends on the value of fixed parameter <img src='http://l.wordpress.com/latex.php?latex=%5Cbar%7B%5Clambda%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\bar{\lambda}' title='\bar{\lambda}' class='latex' />.</p>
<p style="text-align:center;">__________</p>
<p><strong>Appendix B</strong></p>
<p>We would like to show that vectors <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y( \gamma^*)' title='x(\bar{\lambda}) - y( \gamma^*)' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' /> are orthogonal. Recall that <img src='http://l.wordpress.com/latex.php?latex=y%28+%5Cgamma%5E%2A%29+%3D+%5Cdisplaystyle+y_0+%2B+P_v+%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y_0+%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='y( \gamma^*) = \displaystyle y_0 + P_v ( x(\bar{\lambda}) - y_0 )' title='y( \gamma^*) = \displaystyle y_0 + P_v ( x(\bar{\lambda}) - y_0 )' class='latex' />, and thus</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29+%3D+%28+I_n+-+P_v%29+%5Cleft%28x%28%5Cbar%7B%5Clambda%7D%29+-+y_0%5Cright%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle x(\bar{\lambda}) - y( \gamma^*) = ( I_n - P_v) \left(x(\bar{\lambda}) - y_0\right)' title='\displaystyle x(\bar{\lambda}) - y( \gamma^*) = ( I_n - P_v) \left(x(\bar{\lambda}) - y_0\right)' class='latex' />.</p>
<p>Multiplying both sides on the left by <img src='http://l.wordpress.com/latex.php?latex=P_v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v' title='P_v' class='latex' />, we obtain</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+P_v+%5Cleft%28x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29%5Cright%29+%3D+P_v+%5Cleft%28+I_n+-+P_v%5Cright%29+%5Cleft%28x%28%5Cbar%7B%5Clambda%7D%29+-+y_0%5Cright%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle P_v \left(x(\bar{\lambda}) - y( \gamma^*)\right) = P_v \left( I_n - P_v\right) \left(x(\bar{\lambda}) - y_0\right)' title='\displaystyle P_v \left(x(\bar{\lambda}) - y( \gamma^*)\right) = P_v \left( I_n - P_v\right) \left(x(\bar{\lambda}) - y_0\right)' class='latex' /></p>
<p>and since <img src='http://l.wordpress.com/latex.php?latex=P_v+%28I_n+-+P_v%29+%3D+P_v+-+P_v%5E2+%3D+O_%7Bn+%5Ctimes+n%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v (I_n - P_v) = P_v - P_v^2 = O_{n \times n}' title='P_v (I_n - P_v) = P_v - P_v^2 = O_{n \times n}' class='latex' /> (recall that <img src='http://l.wordpress.com/latex.php?latex=P_v%5E2+%3D+P_v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v^2 = P_v' title='P_v^2 = P_v' class='latex' />), then we finally have</p>
<p style="text-align:center;"><img src='http://l.wordpress.com/latex.php?latex=P_v+%5Cleft%28+x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29+%5Cright%29+%3D+0_n&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='P_v \left( x(\bar{\lambda}) - y( \gamma^*) \right) = 0_n' title='P_v \left( x(\bar{\lambda}) - y( \gamma^*) \right) = 0_n' class='latex' />,</p>
<p>which means that vectors <img src='http://l.wordpress.com/latex.php?latex=x%28%5Cbar%7B%5Clambda%7D%29+-+y%28+%5Cgamma%5E%2A%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x(\bar{\lambda}) - y( \gamma^*)' title='x(\bar{\lambda}) - y( \gamma^*)' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=v&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='v' title='v' class='latex' /> are orthogonal.</p>
<p style="text-align:center;">__________</p>
<p>Related:</p>
<ul>
<li><a href="http://softsurfer.com/Archive/algorithm_0102/algorithm_0102.htm" target="_blank">About Lines and Distance of a Point to a Line</a> (by Dan Sunday)</li>
</ul>
<ul>
<li><a href="http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm" target="_blank">Distance between Lines and Segments with their Closest Point of Approach</a> (by Dan Sunday)</li>
</ul>
Posted in Geometry, Mathematics, Optimization Tagged: Analytical Geometry, Geometry, Mathematics, Optimization <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stochastix.wordpress.com/2879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stochastix.wordpress.com/2879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stochastix.wordpress.com/2879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stochastix.wordpress.com/2879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stochastix.wordpress.com/2879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stochastix.wordpress.com/2879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stochastix.wordpress.com/2879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stochastix.wordpress.com/2879/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stochastix.wordpress.com/2879/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stochastix.wordpress.com/2879/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stochastix.wordpress.com&blog=300626&post=2879&subd=stochastix&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://stochastix.wordpress.com/2008/12/28/distance-between-two-lines/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">stochastix</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2008/12/distance-between-2-fixed-points.png" medium="image">
			<media:title type="html">Distance between 2 fixed points</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2008/12/distances-between-a-fixed-point-in-l1-and-three-points-in-l2.png" medium="image">
			<media:title type="html">Distances between a fixed point in L1 and three points in L2</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space.png" medium="image">
			<media:title type="html">Two lines in 3-space</media:title>
		</media:content>

		<media:content url="http://stochastix.files.wordpress.com/2008/12/two-lines-in-3-space-distance-between-fixed-point-in-l1-and-l2.png" medium="image">
			<media:title type="html">Two lines in 3-space - distance between fixed point in L1 and L2</media:title>
		</media:content>
	</item>
	</channel>
</rss>