<?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"
	>

<channel>
	<title>bit-player</title>
	<atom:link href="http://bit-player.org/feed" rel="self" type="application/rss+xml" />
	<link>http://bit-player.org</link>
	<description>An amateur's outlook on computation and mathematics.</description>
	<pubDate>Tue, 09 Mar 2010 15:44:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Home-baked graphics</title>
		<link>http://bit-player.org/2010/home-baked-graphics</link>
		<comments>http://bit-player.org/2010/home-baked-graphics#comments</comments>
		<pubDate>Tue, 09 Mar 2010 15:44:41 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=593</guid>
		<description><![CDATA[A couple of commenters have asked what software package I use to create the graphs that appear in bit-player posts&#8211;illustrations like the one below, which is a slightly improved version of something I posted last week. Let&#8217;s call it Figure 1.

Prompted by these inquiries, I immodestly ask myself: Why do my graphs look so darn [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of commenters have asked what software package I use to create the graphs that appear in bit-player posts&#8211;illustrations like the one below, which is a slightly improved version of something I posted last week. Let&#8217;s call it Figure 1.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/rms-graph2-revised.png" alt="rms-graph2-revised.png" border="0" width="450" height="327" /></p>
<p>Prompted by these inquiries, I immodestly ask myself: Why do my graphs look so darn good? I immodestly answer: It&#8217;s not because of any packaged software! I don&#8217;t need a cake mix, or even a recipe. These are home-baked graphs, made from scratch out of locally grown organic pixels.</p>
<p>I have strong opinions about the aesthetics of scientific illustrations, and I could certainly spout off about the design elements of Figure 1, such as that putty-colored background, just dark enough to allow drop-out white grid lines, yet neutral enough to avoid competing with the data curves, which also have a distinctive color scheme on which I could discourse at length. Yes, I can talk the Tufte talk. But I think the commenters were really asking <em>how</em> I create the graphs rather than <em>why</em> they&#8217;re so elegant, and so I&#8217;m going to focus here on the practical programming problem.</p>
<p>Most of my experience in drawing pictures with a computer comes from the world of print publishing, where the final product is ink on paper rather than pixels on a screen. Compared with the online environment, print has some advantages, notably higher resolution (up to 1,000 dots per centimeter) and precise control over typography and color. But print also has obvious limitations: On a magazine page, there are no mouseovers or clickable buttons, and you can&#8217;t make a square knot <a href="http://bit-player.org/bph-publications/AmSci-1997-11-Hayes-square-knots/compsci9711-F2anim.html">twirl in 3D</a>.</p>
<p>Thirty years ago, the big challenge for computer-generated illustrations was not how to draw the picture but how to get it out of the computer and onto the printing press. You couldn&#8217;t just export a PDF and place it in a Quark or InDesign document; none of those things existed. The only practical option was to print out the artwork, photograph it, and &#8220;strip&#8221; the negative into the page-size film that would be used to make the press plate. Because of this emphasis on printouts, most of the effort went into programming the printer rather than the computer.</p>
<p>The figure below is the first published computer-generated illustration I had a hand in creating. It appeared in <em>Scientific American</em> in 1983. </p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/03/epson-freq-table.png" alt="epson-freq-table.png" border="0" width="450" height="319" /></p>
<p>The array of 28<sup>2</sup> tiny bar graphs was produced with an Epson MX-80 dot-matrix printer, using escape codes to fire combinations of the eight pins in the printhead. Of course the MX-80 was a black-and-white device. The two-color illustration was created from two separate printouts. Also, the Epson letterforms were replaced with typeset characters.</p>
<p>The world of computer-generated illustrations changed dramatically with the arrival of PostScript, the &#8220;page description language&#8221; created by John Warnock and his colleagues at Adobe Systems (based in part on earlier work at Evans and Sutherland and Xerox PARC). PostScript was designed as a complete programming language rather than just a file format or a set of drawing commands. And something else set it apart as well: attention to details of graphic design. With most earlier software (such as programs based on the Apple Quickdraw library), trying to create publishable figures was an exercise in frustration. For example, the apparent weight of a line would vary depending on its orientation: lighter when vertical or horizontal, heavier when diagonal. PostScript allows very precise control over such niceties of presentation. To take another example, where lines meet the edge of a graph, you don&#8217;t want to have to choose between falling short and overshooting; PostScript provides the tools needed to make it look right.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/03/edge-effects.png" alt="edge-effects.png" border="0" width="440" height="158" /></p>
<p>(The version in the rightmost panel is created by allowing the colored lines to extend outside the background box, and then applying a clipping mask that cuts off all objects at the boundary of the box.)</p>
<p>Obsessing over minute details like these may seem comically fussy, but I believe that neatness counts in these matters. To some extent, illustration is an art of illusion. Graphs and diagrams work best when you can look <em>through</em> them rather than <em>at</em> them. The viewer should be seeing the underlying information or abstraction&#8211;the array of correlation coefficients, the function <em>y&nbsp;=&nbsp;f(x)</em>, or whatever&#8211;rather than noticing the mechanics of how the drawing was constructed. A ragged edge is the kind of distraction that destroys the illusion.</p>
<p>Although PostScript was a giant step forward from the MX-80 command set, in the early years it was still just another printer language, not a computer language. The only way I could execute a PostScript program was to send it to a laser printer and wait to see what came out. Sometimes it was a long wait. I had no way of running a PostScript program on the computer itself. (Ghostscript came later.)</p>
<p><img class="alignright" src="http://bit-player.org/wp-content/uploads/2010/03/chernofffaces.png" alt="ChernoffFaces.png" border="0" width="164" height="199" />My first PostScript illustrations were created as hand-written PostScript programs; the same language was used both for doing the computations and for presenting the results. The faces at right were created in this way. (They were inspired by the work of Herman Chernoff and drawn to illustrate an <em>American Scientist</em> article by Robert Levine in 1990.) The dual role of the language caused me a moment of disorientation just now when I went looking for my records of this project. I found an EPS (encapsulated PostScript) file, which I knew was the finished illustration, but where was the source code? And then I remembered: It&#8217;s the same file! Open it up in Ghostscript or Adobe Illustrator and you see those silly faces smiling or scowling at you; open the same file in a text editor, and you see procedures for drawing elements of the faces:</p>
<pre>
   /draweyes
     { newpath
       dx dy eyewidth eyeheight 0 360 ellipse stroke
       ex ey eyewidth eyeheight 0 360 ellipse stroke
     } bind def
   /drawpupils
     { fx fy pupilsize pupilsize 0 360 ellipse fill
       gx gy pupilsize pupilsize 0 360 ellipse fill
     } bind def
</pre>
<p>Bill Casselman, the graphics editor of the <em>Notices of the American Mathematical Society</em>, still favors this direct-to-PostScript methodology. He has written an <a href="http://www.math.ubc.ca/~cass/graphics/manual/">excellent guidebook</a>, taking you from the basics of PostScript through an elaborate library for rendering three-dimensional objects.</p>
<p>But here I part company from Casselman; I&#8217;d rather not do all my computing in PostScript. It&#8217;s not that I have anything against the language itself, but the development environment is not to my taste. I therefore adopted the modus operandi of writing a program in my language of choice (usually some flavor of Lisp) and having that program write a PostScript program as its output. After doing this on an ad hoc basis a few times, it became clear that I should abstract out all the graphics-generating routines into a separate module. The result was a program I named <code>lips</code> (for Lisp-to-PostScript). </p>
<p>Most of what <code>lips</code> does is trivial syntactic translation, converting the parenthesized prefix notation of Lisp to the bracketless postfix of PostScript. Thus when I write <code>(lineto&nbsp;x&nbsp;y)</code> in Lisp, it comes out <code>x&nbsp;y&nbsp;lineto</code> in PostScript. The <code>lips</code> routines also take care of chores such as opening and closing files and writing the header and trailer lines required of a well-formed PostScript program.</p>
<p>But the <code>lips</code> interface is low-level, confined to drawing individual dots, line segments, rectangles and the like. Assembling a complete graph out of these primitives is tedious. For example, the grid of white lines in Figure 1 would have to be drawn one line at a time, with each line specified by a sequence of commands such as </p>
<pre>
    (newpath)
    (moveto u v)
    (lineto x y)
    (stroke)</pre>
<p>Before you can issue those commands, you have to calculate <em>u</em>, <em>v</em>, <em>x</em> and <em>y</em>. Clearly, a higher-level front end is needed; like everyone else, I call mine <code>plot</code>.</p>
<p>At the core of any plotting program is a simple operation: mapping points from an abstract user space to coordinates in a rectangular pane, the page space. In Figure 1, the <em>y</em> axis runs from 0 to 5000; values in this range have to be scaled to the dimensions of the graph, which is about 300 PostScript points, or 11 centimeters. Mathematically, the transformation is straightforward. Indeed, if I wished I could leave all the arithmetic to the PostScript interpreter, simply passing in the appropriate matrix elements for scaling and translation. This is an attractive option; it would allow <code>plot</code> to work entirely in user space. But a few niggling details get in the way. Consider the tick marks along the <em>y</em> axis in Figure 1. Their vertical positions are conveniently expressed in user coordinates: one tick every 500 units. But what about the length of the ticks&#8211;their horizontal extent? This dimension is purely concerned with the appearance of the graph and has nothing to do with the content; it ought to be expressed in unscaled units of points or pixels.</p>
<p>Here&#8217;s a possible solution: Let everything <em>inside</em> the rectangular frame of the graph&#8211;the area with the putty-colored background in Figure 1&#8211;go through the scaling engine, but define everything <em>outside</em> the frame, including the tick marks and the axis labels, directly in page coordinates. If you think this is the final answer, take a look at Figure 2:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/03/figure21.png" alt="figure2.png" border="0" width="446" height="288" /></p>
<p>In this nonsensical graph (constructed just for this occasion), data points are indicated by stars, crosses and diamonds. The <em>positions</em> of those glyphs ought to be defined in user space, but the drawing commands that create the shapes are properly defined in page coordinates. If we tried to draw the glyphs in user space, their size and shape would vary with position in the graph.</p>
<p>What&#8217;s the best way to deal with this messy situation? Is there some tidy solution that will reconcile the two coordinate systems and allow all dimensions to be treated uniformly? I don&#8217;t believe so; it&#8217;s just in the nature of graphs to mix up elements from these two disparate realms. We look through a window into a world of data or mathematical abstractions, but we also draw our own little doodles on the window itself.</p>
<p>Of course there <em>are</em> solutions; they&#8217;re just not as pretty as I would like. My own strategy for coping is to attach extra information to each geometric point, indicating whether or not the <em>x</em> and <em>y</em> coordinates are to go through the scaling transformation. This is less troublesome than it might seem; from the user&#8217;s point of view, it&#8217;s almost always invisible.</p>
<p>In writing the <code>lips</code> and <code>plot</code> programs, I walk a path that is already worn smooth by many earlier footsteps. I don&#8217;t know who wrote the first computer program for plotting data, but it probably came soon after the first program for producing data. Today we have hundreds of clever, comprehensive, well-designed and well-maintained programs for plotting and graphing. <a href="http://www.gnuplot.info/">Gnuplot</a> is very capable; <a href="http://plasma-gate.weizmann.ac.il/Grace/">Grace</a> is one I&#8217;ve never used but I&#8217;ve heard good things about it; Mathematica, Sage, R, MATLAB, Octave and the like all have elaborate graphics facilities built in; the Python world, as usual, has an <a href="http://wiki.python.org/moin/NumericAndScientific/Plotting">overabundance</a> of options; there are a few libraries for my beloved Lisp; you can even <a href="http://www.google.com/publicdata/home">do dataviz online</a>. </p>
<p>All of which raises the question of why I bother to roll my own. I&#8217;ll never keep up&#8211;or even catch up&#8211;with the efforts of major software companies or the huge community of open-source developers. In my own program, if I want something new&#8211;treemaps? vector fields? the third dimension?&#8211;nobody is going to code it for me. And, conversely, anything useful I might come up with will never benefit anyone but me.</p>
<p>The trouble is, every time I try working with an external graphics package, I run into a terrible impedance mismatch that gives me a headache. Getting what I want out of other people&#8217;s code turns out to be more work than writing my own. No doubt this reveals a character flaw: Does not play well with others.</p>
<p>In any case, the time for change is coming. My way of working is woefully out of date and out of fashion. PostScript is a technology that even Adobe seems to regard as outmoded. And making ultraprecise PostScript graphs is quite silly when their destination is the web; before I can put them online, I have to convert them to low-res PNG images. Furthermore, a PostScript-based workflow loses out on all the interactive richness of the web. These are deathly still images. How can I expect to earn any web cred when my work is not even clickable, much less multitouch-enabled?</p>
<p>If I continue in my stubborn, do-it-yourself mode, I could replace the PostScript back end with one that generates SVG. This wouldn&#8217;t be a major undertaking. But is SVG the right answer? It&#8217;s been around for more than a decade and you still don&#8217;t see much of it in the wild. And there are horrid browser incompatibilities. I suspect that Javascript (and JQuery) has a brighter future. And if I can get over my abreaction to libraries, there are <a href="http://javascript.open-libraries.com/utilities/chart/20-best-javascript-charting-and-plotting-libraries/">plenty of options</a>. Advice anyone?</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/home-baked-graphics/feed</wfw:commentRss>
		</item>
		<item>
		<title>Herbert R. J. Grosch, 1918-2010</title>
		<link>http://bit-player.org/2010/herbert-r-j-grosch-1918-2010</link>
		<comments>http://bit-player.org/2010/herbert-r-j-grosch-1918-2010#comments</comments>
		<pubDate>Sat, 27 Feb 2010 03:38:24 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[modern life]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=582</guid>
		<description><![CDATA[Today I learned of the death of Herb Grosch, proud provocateur and mischief-maker of the computing industry. Anybody who ever knew Herb, however slightly or briefly, has a story to tell, so here&#8217;s mine.
Grosch held senior positions at major household-name companies (IBM, General Electric) as well as in the U.S. government; he also spent time [...]]]></description>
			<content:encoded><![CDATA[<p>Today I learned of the death of Herb Grosch, proud provocateur and mischief-maker of the computing industry. Anybody who ever knew Herb, however slightly or briefly, has a story to tell, so here&#8217;s mine.</p>
<p>Grosch held senior positions at major household-name companies (IBM, General Electric) as well as in the U.S. government; he also spent time at MIT and Columbia and was editor of <em>Computerworld</em>. But through it all he cultivated the role of the outsider, or even the outcast; he saw himself as a lone wolf; at IBM they labeled him a &#8220;wild duck.&#8221; He boasted that he was the second scientist ever hired at IBM (after Wallace Eckert) and, more important, was the first employee with facial hair. Even when he was an insider he was an outsider. Grosch was elected president of the Association for Computing Machinery&#8211;but as a dissident candidate, opposing the slate annointed by the nominating committee. </p>
<p>The free-spirited maverick is a celebrated figure in American culture, but not always a well-rewarded one. Wild ducks don&#8217;t get tenure, or a pension.</p>
<p>My brief encounter with Herb came ten years ago, when I was working on an article (<a href="http://bit-player.org/bph-publications/AmSci-2001-11-Hayes-ternary.pdf">PDF</a>) about the uses of ternary notation in computing. I read somewhere that Grosch had proposed a ternary architecture for the Whirlwind, Jay Forrester&#8217;s enormous early electronic computer. The idea of a base-three machine probably seems weirder today than it did in the early 1950s, but all the same the proposal was <em>not</em> adopted, and most histories of the Whirlwind project say little or nothing about the ternary option. I had no luck finding a copy of Grosch&#8217;s memo on the subject, so I tried getting in touch with him directly. With the help of friends I tracked him down, though not in the first place I looked. He was in Riga, Latvia.</p>
<p>Grosch couldn&#8217;t supply a copy of the memo; most of his papers, he said, were buried in a landfill in Switzerland. The best he could do was point me to a passage in his <a href="http://www.columbia.edu/acis/history/computer.html">autobiography</a>, summarizing a conversation with Forrester:</p>
<blockquote><p>I said what might be genuinely gainful would be to store a ternary digit in each core, and calculate in base-three rather than binary fashion. There were materials&#8211;some kinds of permalloy, as I remember&#8211;that had north, south and neutral stable magnetic states. I told him I had taught my Poughkeepsie evening classes at IBM about a special kind of base-three arithmetic I called &#8220;signed ternary,&#8221; in which zero was in the middle of the number range. In this curious system there was no need for algebraic signs, no problem about the sign of zero, and you rounded perfectly by dropping digits.</p>
<p>Jay being a stiff type, I refrained from calling the ternary digits &#8220;tits,&#8221; a name which had been the source of much boyish amusement in the Poughkeepsie classes.</p></blockquote>
<p>By the way, I&#8217;m still looking for a copy of that memo. Here&#8217;s the reference: Grosch, H. J. R. 1952. Signed ternary arithmetic. Memorandum M-1496, Digital Computer Laboratory, MIT.</p>
<p><img class="alignright" src="http://bit-player.org/wp-content/uploads/2010/02/herb-barcelona.jpg" title="Herb Grosch in Barcelona, circa 2001" alt="Herb Grosch in Barcelona, circa 2001" border="0" width="200" height="238" /></p>
<p>Of course I had to ask Herb how and why he&#8217;d found his way to Latvia. It was a long story, involving a small NSF grant, archives of <em>Datamation</em> magazine, a collection of Soviet-era computer hardware in an attic at Latvia University, and a romance that Herb hoped would develop into his fifth marriage. But the grant ran out, the marriage plans faltered, and Herb was heading back to U.S. in dire need of employment. His hopes, he said, were &#8220;not much above fast-foodery: editing, or tech writing, or even clerking at Barnes and Noble.&#8221; He was 82 at the time.</p>
<p>In the end, he did not have to stoop quite so far as editing or tech writing, or Barnes and Noble; he became Adjunct Distinguished Professor of Computer Science at the University of Nevada Las Vegas. But that posting didn&#8217;t last long. A few years later he turned up in Toronto, teaching the history of computing, but by then I&#8217;d lost touch with him.</p>
<p>In a &#8220;Dear Everybody&#8221; message some years ago, Grosch wrote:</p>
<blockquote><p>I begin this letter on the fourth of six recent Binary Days, 01.11.01&#8230;.  The next Binary Day will be nine years from now, 01.01.10, and I will write again then if I survive.  Shorter recipient list, I assume!</p></blockquote>
<p>Herb did make it until 01.01.10. He died January 25th. For more on his life and works, see the <a href="http://cacm.acm.org/news/70203-computing-pioneer-herbert-grosch-dead-at-91/fulltext">ACM obituary</a> and a <a href="http://www.columbia.edu/acis/history/grosch.html">web site at Columbia</a> maintained by Frank da Cruz.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/herbert-r-j-grosch-1918-2010/feed</wfw:commentRss>
		</item>
		<item>
		<title>The teetotaler&#8217;s walk</title>
		<link>http://bit-player.org/2010/the-teetotalers-walk</link>
		<comments>http://bit-player.org/2010/the-teetotalers-walk#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:38:59 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=579</guid>
		<description><![CDATA[Writing about P&#243;lya&#8217;s recurrence theorem led me to pick up Gerry Alexanderson&#8217;s book The Random Walks of George P&#243;lya. He tells a sweet anecdote about the origin of the theorem.
The random walk is sometimes called the drunkard&#8217;s walk, but P&#243;lya&#8217;s musings on the subject were not inspired by a disorienting pub crawl. On the contrary, [...]]]></description>
			<content:encoded><![CDATA[<p>Writing <a href="http://bit-player.org/2010/gruenbergers-prime-path#comment-2641">about P&oacute;lya&#8217;s recurrence theorem</a> led me to pick up Gerry Alexanderson&#8217;s book <em><a href="http://www.maa.org/reviews/randompolya.html">The Random Walks of George P&oacute;lya</a></em>. He tells a sweet anecdote about the origin of the theorem.</p>
<p>The random walk is sometimes called the drunkard&#8217;s walk, but P&oacute;lya&#8217;s musings on the subject were <em>not</em> inspired by a disorienting pub crawl. On the contrary, the idea came to him while he was living at the Kurhaus Z&uuml;richberg, which Alexanderson notes was founded as a temperance hotel. (It seems to be a <a href="http://www.zuerichberg.ch/de/home.asp">somewhat different establishment</a> now, and probably beyond the means of a Privatdozent.) </p>
<p>Alexanderson describes the incident that led P&oacute;lya to the recurrence theorem:</p>
<blockquote><p>There was a particular wooded area near the hotel where he enjoyed taking extended walks while thinking about mathematics. He would carry pencil and paper so he could jot down ideas as they came to him. Some students also lived at the Kurhaus and P&oacute;lya got to know some of them. One day while out on his walk he encountered one of these students strolling with his fianc&eacute;e. Somewhat later their paths crossed again and even later he encountered them once again. He was embarrassed and worried that the couple would conclude that he was somehow arranging these encounters. This caused him to wonder how likely it was that walking randomly through paths in the woods, one would encounter others similarly engaged. This led to one of his most famous discoveries, his 1921 paper on random walk, a phrase used for the first time by P&oacute;lya.</p></blockquote>
<p>It&#8217;s interesting that the question raised by those embarrassing woodland encounters differs from the usual statement of the recurrence theorem, which talks about a single walker&#8217;s return to the point of origin. The answer is the same, however. In an appendix to the Alexanderson book, K. L. Chung mentions an easy proof of this equivalence: Suppose two walkers begin together at <em>A</em> and run into each other again at <em>B</em>. Nothing about the statistics of a random walk changes if you reverse the direction of all the steps. Thus the probability of the <em>rencontre</em> at <em>B</em> is the same as that of one walker going from <em>A</em> to <em>B</em> and then back to <em>A</em> again.</p>
<p>The illustration below shows the paths of two random walkers that meet three times <em>(green circles)</em> after leaving the origin, supporting the plausibility of P&oacute;lya&#8217;s claim that he was not stalking those young lovers in the woods. </p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/rencontres-11.png" alt="rencontres-1.png" border="0" width="450" height="360" /></p>
<p>(What&#8217;s not so plausible is that <em>any</em> non-inebriated walker would follow a truly random path.)</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/the-teetotalers-walk/feed</wfw:commentRss>
		</item>
		<item>
		<title>Gruenberger&#8217;s prime path</title>
		<link>http://bit-player.org/2010/gruenbergers-prime-path</link>
		<comments>http://bit-player.org/2010/gruenbergers-prime-path#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:18:03 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[mathematics]]></category>

		<category><![CDATA[problems &#038; puzzles]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=573</guid>
		<description><![CDATA[Fred Gruenberger may well have been the first blogger on computational topics. When he was writing, back in the 1970s, there was no RSS, and so he distributed his musings in a monthly newsletter called Popular Computing. A typical issue was 16 or 20 typewritten pages&#8211;stapled, folded, stamped and delivered by mail. It was always [...]]]></description>
			<content:encoded><![CDATA[<p>Fred Gruenberger may well have been the first blogger on computational topics. When he was writing, back in the 1970s, there was no RSS, and so he distributed his musings in a monthly newsletter called <em><span title="Not to be confused with a later, slicker magazine of the same name, published in Peterborough, N.H.">Popular Computing</span></em>. A typical issue was 16 or 20 typewritten pages&#8211;stapled, folded, stamped and delivered by mail. It was always worth reading.</p>
<p>Gruenberger had been working and playing with computers since the 1940s. For a long stretch he was at the RAND Corporation, the famous think tank in Santa Monica. Later he taught at Cal State Northridge. In addition to <em>Popular Computing</em> he was involved in the startup of <em>Datamation</em> magazine and published at least a dozen books. I haven&#8217;t been able to learn much about his later years; he <a href="http://articles.latimes.com/1998/aug/28/news/mn-17497">died</a> in 1998.</p>
<p>A slogan that appeared in some issues of <em>Popular Computing</em> proclaimed: &#8220;The way to learn computing is to compute.&#8221; I took this advice to heart, although I was hampered by a total lack of hardware. Later on I acquired a programmable calculator, which helped on some of the problems and exercises.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/gruenberger-prime-path-page-450.png" alt="Problem 149, from Popular Computing Vol. 4 No. 12, December 1976" border="1px" border-color="#0a0a0a" width="450" height="530" /></p>
<p>The problem reproduced above appeared in the December 1976 issue of <em>Popular Computing</em> (Vol. 4, No. 12). At the time, I made no attempt to work this one out, but evidently the problem seemed interesting enough to be worth filing away. When I came upon the old clipping recently, I gave it a closer look and realized I have no idea how to answer Gruenberger&#8217;s question, though the impediment now is not lack of hardware.</p>
<p>Gruenberger asks us to trace a planar path whose steps are indexed by the odd integers starting at 3. For each number <em>N</em> we turn right 90 degrees before taking a step if <em>N</em> is a prime congruent to 1 mod 6; we turn left 90 degrees before moving one unit if <em>N</em> is a prime congruent to &minus;1 mod 6; otherwise we continue straight ahead in whatever direction we happen to be facing.</p>
<p>In his typewriter graphics, Gruenberger plotted the trajectory from <em>N</em>=3 through 97. Below I continue the path through <em>N</em>=199. </p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/trail201b.png" alt="trail201b.png" border="0" width="450" height="450" /></p>
<p>But something&#8217;s amiss here. Gruenberger wrote:</p>
<blockquote><p>Eventually the path will cross itself, so that the cell containing 111 will also contain 147. Similarly, one cell will contain both 91 and 179.</p></blockquote>
<p>Those two self-intersections are nowhere to be found in the diagram. When I first noticed this discrepancy, I assumed I must have made a mistake somewhere. (This eagerness to blame myself is not mere knee-jerk humility; I have years of experience to back it up.) Eventually, though, I concluded that it was Gruenberger who had made the wrong turn. I believe he mistakenly went left at 127, as shown in the brown trail below:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/trail201b-error.png" alt="trail201b-error.png" border="0" width="450" height="450" /> </p>
<p>The brown continuation of the red path includes the two coincidences mentioned in Gruenberger&#8217;s problem statement. But the left turn at <em>N</em>=127 is incorrect, because 127 is a prime equal to (6&times;21)+1, and thus it should specify a <em>right</em> turn. The error is of no great consequence, but it does reveal something interesting: Gruenberger must have been plotting these paths by hand. Most likely he wrote a program to compute the series of residue classes, then traced out the trajectory on squared paper.</p>
<p>Setting aside this anomaly, Gruenberger was quite right that the path does intersect itself. Here&#8217;s the trail continued through <em>N</em>=1,001:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/trail1001b.png" alt="trail1001b.png" border="0" width="450" height="450" /></p>
<p>And if that&#8217;s not tangled enough, here&#8217;s what it looks like at <em>N</em>=10,001:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/trail10001c.png" alt="trail10001c.png" border="0" width="450" height="450" /></p>
<p>Gruenberger asks for &#8220;a list of the contents of those cells containing more than one number, arranged in the order of the smallest number in the cell.&#8221; It&#8217;s not hard to identify some cells that belong on such a list. The table below includes all multiply-occupied cells discovered when tracing the path up to <em>N</em>=1,001, sorted as Gruenberger requests:</p>
<pre>
                   <strong>x    y    values of <em>N</em></strong>
                 -11   28    (137 337)
                 -15   27    (147 683)
                 -16   27    (149 349 685)
                 -18   26    (155 355)
                 -19   27    (159 691)
                 -19   28    (161 693)
                 -19   29    (163 695)
                 -17   31    (171 319)
                 -18   32    (175 315)
                 -19   32    (177 701)
                 -20   32    (179 703)
                 -22   31    (185 769)
                 -23   31    (187 771)
                 -24   31    (189 773)
                 -30   41    (245 269)
                 -30   42    (247 271)
                 -27   40    (281 733)
                 -26   40    (283 735)
                 -26   37    (289 725)
                 -23   35    (299 715)
                 -22   35    (301 761)
                 -21   35    (303 759)
                 -20   35    (305 757)
                 -17   27    (351 687)
                 -18   27    (353 689)
                 -17   24    (361 673)
                 -16   24    (363 675)
                 -15   24    (365 677)
                 -17   21    (379 667)
                 -17   22    (381 669)
                 -17   23    (383 671)
                 -20   22    (391 631)
                 -20   21    (393 633)
                 -20   20    (395 635)
                 -20   19    (397 637)
                 -22   19    (401 593)
                 -22   18    (403 591)
                 -22   17    (405 589)
                 -22   16    (407 587)
                 -27   15    (419 575)
                 -27   14    (421 573)
                 -28   14    (423 819)
                 -29   14    (425 549)
                 -32   14    (431 539)
                 -32   13    (433 537)
                 -26   10    (563 831)
                 -26   11    (565 829)
                 -27   13    (571 823)
                 -28   18    (607 811)
                 -22   32    (707 767)
                   4   -6    (923 971)
                   4   -7    (925 969)
                   4   -8    (927 967)
                   4   -9    (929 989)
                   5   -9    (931 991)
</pre>
<p>Is this list the answer to Gruenberger&#8217;s question? No, it&#8217;s not, because there&#8217;s no reason to stop at an arbitrary limit such as <em>N</em>=1,001. Indeed, the list above is not even a prefix of the complete answer. The smallest value of <em>N</em> appearing in the list is 137, but the trail will eventually revisit cells occupied by smaller values of <em>N</em>. For example, continuing the experiment to <em>N</em>=10,001 reveals a bunch of intersections quite close to the beginning of the path, including a site that&#8217;s visited five times:</p>
<pre>
                   <strong>x    y    values of <em>N</em></strong>
                   1    0    (5 1621)
                   1    1    (7 1623)
                   2    1    (9 4725)
                   3    1    (11 1263)
                   3    2    (13 1265)
                   5    3    (19 1635)
                   6    3    (21 1637)
                   7    4    (25 7537)
                   7    5    (27 7319 7539)
                   7    6    (29 7505 7541)
                   6    6    (31 1643 7323 7503 7543)
                   6    7    (33 1645 7325)
                   6    8    (35 1647 7327)
                   6    9    (37 1649 7329)
</pre>
<p>One point still missing from this list is the origin&#8211;the site at <em>x</em>=0, <em>y</em>=0, <em>N</em>=3. Does the path ever revisit its starting point?   If so, at what value (or values) of <em>N</em> does it come back home? Since I don&#8217;t know the answer to this question, I guess I&#8217;ll have to leave it as an exercise for the reader.</p>
<p>I suspect that the problem Gruenberger <em>meant</em> to pose (or thought he was posing) was to generate a list of self-intersection sites arranged in their natural order of occurrence&#8211;that is, the order in which the crossings are created when you construct the path starting from the origin. This natural-order list is not at all the same as a list &#8220;arranged in the order of the smallest number in the cell.&#8221; The natural-order list is easy to generate step by step. All you need to do is obey the <em>left/right/straight</em> rules, plot the resulting sequence of positions on the <em>xy</em> lattice, and leave behind a trail of breadcrumbs so you can check at each step to see if the site has been visited before. This task is a matter of straightforward computation&#8211;just the kind of assignment that Gruenberger favored. The natural-order list begins:</p>
<pre>
                   <strong>x    y    values of <em>N</em></strong>
                 -30   41    (269 245)
                 -30   42    (271 247)
                 -18   32    (315 175)
                 -17   31    (319 171)
                 -11   28    (337 137)
                 -16   27    (349 149)
                 -18   26    (355 155)
                 -32   13    (537 433)
                 -32   14    (539 431)
                 -29   14    (549 425)
                 -27   14    (573 421)
</pre>
<p>Thus the prime path first crosses itself when <em>N</em>=269, a value that shares the same coordinates as <em>N</em>=245, namely <em>x</em>=&minus;30, <em>y</em>=41. There are 56 such crossings up to <em>N</em>=1,001, and 112,988 self-intersections up to <em>N</em>=10<sup>6</sup>. </p>
<p class="centered">*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</p>
<p>There is a wilder, conjectural answer to Gruenberger&#8217;s challenge&#8211;which I&#8217;m pretty sure he did <em>not</em> have in mind. It goes like this: Maybe the complete list of revisited values of <em>N</em> is simply the list of <em>all N</em>. In other words, maybe the Gruenberger prime path fills up the entire lattice of integers, crossing over itself everywhere many times. </p>
<p>In 1921 George P&oacute;lya published a <a href="http://gdz.sub.uni-goettingen.de/dms/load/img/?PPN=PPN235181684_0084&#038;DMDID=dmdlog16">celebrated proof</a> that a random walk on the lattice of integers is <em>recurrent</em> in one or two dimensions, though not in higher dimensions. <em>Recurrent</em> means that the walk returns to each point along its length with probability 1, and indeed visits every point in its domain infinitely often. Is it possible that the prime path is also recurrent?</p>
<p>P&oacute;lya&#8217;s theorem is one of those mind-expanding results that seem impossible on first acquaintance, and then inevitable, and finally just so amazing that you want to go kiss a mathematician. I have to confess that I&#8217;ve never gotten all the way through P&oacute;lya&#8217;s original paper (it&#8217;s not long, but it&#8217;s in German). On the other hand, I can highly recommend a little book by Peter Doyle and Laurie Snell, <em>Random Walks and Electric Networks</em>, which gives several alternative proofs of the theorem; it was published in the MAA&#8217;s Carus Monograph series, and there&#8217;s a <a href="http://arxiv.org/abs/math.PR/0001057">postprint</a> available on the arXiv. </p>
<p>The key insight underlying P&oacute;lya&#8217;s result, as I understand it, is this: If you <em>never</em> revisit a former home, then you must be spending eternity somewhere else, and you can do that only if your universe has enough somewhere elses that you&#8217;ll never run out of new territories to visit. Suppose that, some eons after starting your journey, you find yourself at distance <em>r</em> from the origin. If you&#8217;re living in a one-dimensional universe, then there are just two places you could be at that moment, namely at +<em>r</em> or &minus;<em>r</em>. It doesn&#8217;t matter how far you run; there are still just two points at any given distance from the origin. In two dimensions, a fugitive at distance <em>r</em> has a little more room to maneuver; the number of available points grows in proportion to <em>r</em>, forming a circle of radius <em>r</em>. But this is still not enough room to get lost in. Only in three dimensions or more is there a nonzero probability of escape. In three dimensions, the space available at radius <em>r</em> is proportional to <em>r</em><sup>2</sup>. In this three-dimensional world, the volume of empty space grows faster than a random walker&#8217;s expected distance from home.</p>
<p>What does all this have to do with Gruenberger&#8217;s prime path? Well, it&#8217;s no secret that the distribution of prime numbers looks convincingly random&#8211;if you look at it in just the right way. And in particular the distribution of primes in various residue classes, such as 6<em>K</em>+1 and 6<em>K</em>&minus;1, <a href="http://arxiv.org/abs/math/0408319v1">seems to behave</a> at least approximately like a random variable. All this suggests we might consider viewing the Gruenberger prime trail as if it were a random walk through the two-dimensional lattice of integers. Because the space is two-dimensional, it&#8217;s a good guess that the walk should be recurrent.</p>
<p>The original recurrence results of P&oacute;lya refer to a <em>simple</em> random walk, where at each step the walker chooses randomly among the available directions and then moves one unit in that direction. For example, in the two-dimensional lattice of integers there are four possible directions: north, south, east, west. The simple random walk is not the best model of the Gruenberger process, which is more like a <em>nonreversing</em> random walk&#8211;a path where on each step the walker can turn left or turn right or go straight ahead but can never make a 180-degree about-face. We can further refine the random-walk model of the Gruenberger process by biasing the choice made at each step to reflect the changing abundance of prime numbers. Primes grow scarcer as their magnitude increases; in the vicinity of a given value of <em>N</em>, the probability that a randomly chosen number is prime is approximately 1/log <em>N</em>. Since the Gruenberger path goes straight for all composite numbers and turns only when <em>N</em> is prime, the trail will have longer and longer straight segments, and rarer turns, as <em>N</em> increases. A random walk can mimic this behavior by choosing an action at each step according to this logic:</p>
<pre>
    if random(1.0) &gt; 2/log(N)
       then go straight
       elseif randomboolean()
           then turn left
           else turn right
</pre>
<p>(The proportion of primes is given as 2/log(<em>N</em>) rather than 1/log(<em>N</em>) because the Gruenberger process is defined on odd numbers only, which immediately eliminates half of the composites.)</p>
<p>One way to compare the various kinds of random walks is to measure the root-mean-square displacement&#8211;the distance from the origin to the final position of the walker, averaged over many realizations of the random process. For a simple random walk, the RMS displacement for an <em>N</em>-step walk converges to \(\sqrt{N}\); for the nonreversing random walk the average displacement is \(\sqrt{2N}\). The biased random walk based on the distribution of primes also appears to yield an RMS distance proportional to the square root of the number of steps; numerically the curve looks something like \(\sqrt{10N}\). I&#8217;m not entirely sure that&#8217;s the true form of the curve, but the geometric details don&#8217;t really make much difference. If I understand correctly, all three of these random processes should be recurrent in the sense of P&oacute;lya.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/rms-graph5.png" alt="rms-graph5.png" border="0" width="450" height="328" /></p>
<p>Does the same reasoning apply to the Gruenberger prime path? There are two sides to this question. </p>
<p>The naysayer points out that P&oacute;lya&#8217;s theorem applies to <em>random</em> walks, but there&#8217;s nothing truly random about the sequence of primes. After all, we have a straightforward, deterministic algorithm for generating primes, as well as an efficient algorithm for testing whether any given integer is prime or composite. The essence of a random process is that every time you run it you get a different result, but there&#8217;s only one sequence of prime numbers, and so the Gruenberger prime path will come out exactly the same every time. According to this view of things, the kind of probabilistic reasoning that goes into the proof of P&oacute;lya&#8217;s recurrence theorem is out of bounds here. For randomness to make any sense, you need to average over some ensemble of independent instances. For example, you could average over the 50 salmon-pink paths in the graph below, which represent 50 independent realizations of a biased random walk; you can&#8217;t average over the prime path itself (<em>green</em>), because there&#8217;s only that one path.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/random-prime-paths-51.png" alt="random-prime-paths-51.png" border="0" width="441" height="328" /></p>
<p>The yeasayer retorts that a single path is all you need&#8211;<em>if</em> the path is infinitely long. Indeed, the salmon-colored trails above could be interpreted not as 50 distinct runs of a random process but as 50 segments of a single long path, which repeatedly loops around through the point at <em>x</em>=0, <em>y</em>=0, wanders off in various directions, and then comes back home yet again. In essence, everything that could possibly happen in an infinite set of random paths happens somewhere within a single infinite path; all possible variety is already present there.</p>
<p>I&#8217;m not sure how to settle this dispute between Dr. Yea and Professor Nay. When an argument hinges on the nature of randomness, the meaning of infinity and patterns in the distribution of the primes, I known I&#8217;m in over my head. </p>
<p>So I&#8217;ll leave that deep question unresolved and say a final word about a lesser curiosity. In the Gruenberger process, we&#8217;re using the congruence classes of prime numbers mod 6 as a kind of coin flip to decide which way to turn. Is it a <em>fair</em> coin flip? For small values of <em>N</em>, it certainly doesn&#8217;t <em>look</em> fair:</p>
<pre>
                               6x+1      6x&minus;1
       primes &lt;     100         11        12
       primes &lt;    1000         80        86
       primes &lt;   10000        611       616
       primes &lt;  100000       4784      4806
       primes &lt; 1000000      39231     39265
</pre>
<p>There&#8217;s a persistent excess of &minus;1 primes, and the imbalance seems to be getting steadily larger. As a result, the prime path has a &#8220;winding number&#8221; that reaches 8.5 at <em>N</em>=10<sup>6</sup>; that is, the path makes eight and a half net counterclockwise revolutions. Does the windup continue with still larger <em>N</em>? I gather that the definitive answer is &#8220;Yes and No.&#8221; For more see the <a href="http://arxiv.org/abs/math/0408319v1">masterful paper</a> by Andrew Granville and Greg Martin cited above.</p>
<p>[Correction 2010-02-19: reflected the accent on P&oacute;lya.]</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/gruenbergers-prime-path/feed</wfw:commentRss>
		</item>
		<item>
		<title>Yet another spam update</title>
		<link>http://bit-player.org/2010/yet-another-spam-update</link>
		<comments>http://bit-player.org/2010/yet-another-spam-update#comments</comments>
		<pubDate>Sun, 07 Feb 2010 19:27:37 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[modern life]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=555</guid>
		<description><![CDATA[
It seems the great spam tide of 2009 is ebbing. The graph records numbers of spam messages per month received by my email accounts; obviously this is just a personal tally and your milage may vary. The percentage of Russian-language spam in my inbox has fallen off somewhat, from more than half last fall to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2010/02/spam-2008-02-to-2010-01.png" alt="spam-2008-02-to-2010-01.png" border="0" width="450" height="300" /></p>
<p>It seems the great spam tide of 2009 is ebbing. The graph records numbers of spam messages per month received by my email accounts; obviously this is just a personal tally and your milage may vary. The percentage of Russian-language spam in my inbox has fallen off somewhat, from more than half last fall to less than 40 percent in January. (For context see my earlier bit-player spam reports: <a href="http://bit-player.org/2009/spammy-weather">Aug 2009</a>, <a href="http://bit-player.org/2009/the-village-spammer">May 2009</a>, <a href="http://bit-player.org/2009/more-mysteries-from-the-spamosphere">Mar 2009</a>, <a href="http://bit-player.org/2008/monthly-spam-update">Nov 2008</a>, <a href="http://bit-player.org/2008/spam-by-the-numbers">Oct 2008</a>, <a href="http://bit-player.org/2008/spam-stats">Jun 2008</a>. Also two <em>American Scientist</em> columns: <a href="http://www.americanscientist.org/issues/pub/how-many-ways-can-you-spell-v1gra">Jul-Aug 2007</a> and <a href="http://www.americanscientist.org/issues/pub/spam-spam-spam-lovely-spam">May-Jun 2003</a>.)</p>
<p>I would also like to draw attention to a recent article on the economics of spam: &#8220;Spamalytics: An Empirical Analysis of Spam Marketing Conversion,&#8221; by Chris Kanich, Christian Kreibich, Kirill Levchenko, Brandon Enright, Geoffrey M. Voelker, Vern Paxson and Stefan Savage, <em>Communications of the ACM</em> 52(9):99-107 (<a href="http://doi.acm.org/10.1145/1562164.1562190">available online</a> if you or your library is a subscriber). (<a href="http://www.icsi.berkeley.edu/pubs/networking/2008-ccs-spamalytics.pdf">Preprint link</a>, thanks to Arvind Narayanan in the comments.) Kanich et al. adopt a clever and mildly controversial strategy: They parasitize an existing spam botnet and alter outgoing emails so that embedded links point back to the investigators&#8217; own web servers, rather than those of the spammers. They write:</p>
<blockquote><p>Using this methodology, we have documented three spam campaigns comprising over 469 million emails. We identified how much of this spam is successfully delivered, how much is filtered by popular antispam solutions, and, most importantly, how many users &ldquo;click-through&rdquo; to the site being advertised (<em>response rate</em>) and how many of those progress to a &ldquo;sale&rdquo; or &ldquo;infection&rdquo; (<em>conversion rate</em>).</p></blockquote>
<p>Of the 469 million messages, 347 million were part of a campaign advertising pharmaceuticals. The bottom line: 28 &#8220;sales&#8221; (no money actually changed hands, and no products were delivered) with an average purchase price of about $100. This is a conversion rate of less than 1 in 10 million, which leaves some doubt about the profitability of the operation. Kanich et al. note that spam-for-hire services would charge roughly $25,000 to send 350 million emails, an order of magnitude more than the revenue generated in this campaign. Yet the mere continued existence of spam argues that the actual costs must be much lower. Kanich et al. speculate that the spammers are a vertically-integrated enterprise: They own both the botnet and the pharmacy.</p>
<p>Finally, I want to update my <a href="http://bit-player.org/2009/a-comment-on-comment-spam">comment on comment spam</a>. Three months ago I installed the Akismet filter to intercept spam comments submitted to bit-player. The filter has been performing fairly well, blocking about 200 spam comments so far, letting a dozen or so slip through, and falsely imprisoning a couple of legitimate comments. (Advice to commenters: Avoid ALL CAPS.) </p>
<p>Looking through the archive of impounded messages, I am more perplexed than ever about the social and economic basis of this phenomenon. The URLs that constitute the payload of the spam point to a weird miscellany of topics. Someone out there thinks that the readers of this blog are interested in hypnotism, in bathroom faucets and shower enclosures, in garage doors and currency conversion. Most of all we are a musical bunch: Fully a third of the spam comments promote merchandise related to pianos. </p>
<p>Unlike email spam, the comment spams are not generated by an automaton; there are living human beings at the other end of this communication channel. And apparently the spam writers are not hired merely for high-speed, wholesale captcha-solving. In many cases there is ample evidence that the commenter has read the article and understood it, and may even have something interesting to say about it.</p>
<p>It occurs to me that this circumstance gives me an opportunity to open a dialogue. So I now address myself directly to the comment spammers: If you are reading this post because you&#8217;ve been hired to plant comments and URLs here, or if you&#8217;re doing it for your own commercial gain, I have a proposition for you. Please leave a comment attached to this post, explaining what you&#8217;re doing and why&#8211;and, if possible, for whom. Tell us what a successfully planted link is worth, and how much you get out of it. If your comment is sufficiently interesting and informative, and if it seems genuine, I&#8217;ll let it through the Akismet filter, and you&#8217;ll have your chance to sell my readers a piano or a garage door. (This offer applies only to comments attached to <em>this</em> article, and I&#8217;ll be the sole judge of what&#8217;s interesting, informative and genuine.)</p>
<p>If you&#8217;d rather communicate privately, send me an email at brian@bit-player.org.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/yet-another-spam-update/feed</wfw:commentRss>
		</item>
		<item>
		<title>A molecular millisecond</title>
		<link>http://bit-player.org/2010/a-molecular-millisecond</link>
		<comments>http://bit-player.org/2010/a-molecular-millisecond#comments</comments>
		<pubDate>Sat, 06 Feb 2010 17:48:55 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[biology]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=552</guid>
		<description><![CDATA[It was not quite a century ago that we got our first glimpse of molecules. William Lawrence Bragg, with a little help from his dad, figured out how to get molecules to sit still long enough for a portrait. First you had to crystallize the substance, then shoot x-rays through the carefully mounted crystal, then [...]]]></description>
			<content:encoded><![CDATA[<p>It was not quite a century ago that we got our first glimpse of molecules. William Lawrence Bragg, with a little help from his dad, figured out how to get molecules to sit still long enough for a portrait. First you had to crystallize the substance, then shoot x-rays through the carefully mounted crystal, then record the lace-doily pattern of diffracted rays on photographic film. </p>
<p>After all that lab work came the really hard part: analyzing the pattern of bright dots in order to reconstruct the positions of atoms in three-dimensional space. This was a difficult <em>inverse problem</em>, something like deducing the shape of a musical instrument from the sounds it emits. (The EDSAC, the first working stored-program computer, was put to work deciphering x-ray diffraction patterns circa 1950.)</p>
<p>Finally it came time to build a model of the molecule&#8211;and in those days a model occupied physical rather than virtual reality. In the 1970s I visited Max Perutz, who had by then spent more than 30 years working out the structure of the hemoglobin molecule. His offices were cluttered with modeling artifacts: stacked sheets of transparent plastic, marked with hand-drawn contour maps of electron density, lumpy clay and plaster extrusions showing the overall form of the protein at low resolution, and the now-familiar tinker-toy assemblies of balls and sticks.</p>
<p>It was hard-won knowledge, and I thought it heroic science. I still do. And yet everyone knew all along&#8211;Perutz more emphatically than anyone else&#8211;that those rigid, static models of proteins were highly misleading. In the living cell, biological macromolecules do not sit immobile like bronze statues. They are machines with moving parts; they continually flex and wiggle, mesh and then disengage, spin, flap, bend, stretch; all day long they do a hyperkinetic hokey-pokey.</p>
<p>I have now seen a remarkable performance of that molecular dance. In a <a href="http://iic.harvard.edu/seminars/iic-colloquium-series-fall-2009-through-spring-2010/anton-specialized-machine-millisecond-s">talk at Harvard</a> earlier this week David E. Shaw showed two videos, each portraying about a millisecond in the life of a single protein molecule. A millisecond may not sound like much, but the video was created by computing atomic motions at roughly one step per femtosecond. That&#8217;s 10<sup>12</sup> steps in all. (If you included <em>all</em> the steps in the video, and displayed them at 60 frames per second, the show would go on for 500 years.)</p>
<p>Shaw was once a computer scientist at Columbia, then he went off to make some billions on Wall Street. (He was introduced to the Harvard audience as &#8220;King Quant.&#8221;) He has now turned to computational molecular biology, setting up <a href="http://www.deshawresearch.com/index.html">his own lab</a> and building a series of special-purpose computers designed for molecular-dynamics simulations. The machines are called Anton, in honor of Leeuwenhoek. Shaw&#8217;s group has built eight of them so far, each with 512 processors. A kiloprocessor model is expected to come on line in a few weeks.</p>
<p>The basic idea behind the computations is simple. Start with the initial positions and velocities of all the atoms. Calculate the force that each atom exerts on every other atom, and the resulting acceleration. Wash, rinse, repeat. For a system of <em>N</em> atoms, the naive version of this algorithm has performance proportional to <em>N</em><sup>2</sup>; this quadratic growth is a bit of a problem, because the model includes not only several hundred atoms in the protein itself but also up to 50,000 atoms in the surrounding solvent. So Anton takes some shortcuts. The big one is to do a full accounting of pairwise interactions only for atoms within a limited radius; the distribution of more-distant atoms is remapped to a mesh of discrete points. But even after this winnowing of the problem, the calculation of pairwise forces remains the principal bottleneck. It is solved by throwing hardware at it: 32 &times; 512 parallel pipelines implemented on custom silicon. There&#8217;s more on Anton&#8217;s architecture and algorithms <a href="http://www.cs.utah.edu/hpca08/papers/6A_1_Larson.pdf">here</a>; the Shaw Research web site lists <a href="http://www.deshawresearch.com/publications.html">lots of other publications</a> as well, but most of them are not accessible without payment.</p>
<p>As far as I can tell, the videos of proteins in motion are not yet available anywhere, and that&#8217;s really too bad. They might well be <a href="http://www.wherethehellismatt.com/">the next dance sensation</a> on YouTube. Watching them in the lecture hall, I was so bedazzled that I neglected to note the identity of the molecules. One was an ion channel, a protein that spans the width of a membrane and controls the passage of some specific ion (potassium, I think, in this case). We watched the six polypeptide strands twisting closed like the blades of a camera iris, shutting off the channel. Another simulation showed an even more dramatic reconfiguration. For many microseconds of biological time, and perhaps half a minute of wall-clock time, the protein sat nervously quivering and fidgeting, hunched up in a compact globule, with occasional minor adjustments to various loops and corners. And then suddenly the whole molecule opened up like a flower blooming; a moment later it closed again. If I understand correctly what Shaw was telling us, the existence of this alternative state had been known from experimental evidence, but the transformation had never been seen before. And, as he remarked early in the talk, &#8220;seeing what it looks like&#8221; brings a level of understanding that would be hard to achieve by more analytic methods.</p>
<p>Which brings me to my one gripe. The truth is, we still don&#8217;t know what a protein <em>really </em>looks like, and we never will, because &#8220;looking&#8221; is not a well-defined notion for objects smaller than the wavelength of light. Color, for example, is just not meaningful in this realm, and surface texture is also problematic. Thus schemes for depicting molecules are necessarily a matter of convention. It&#8217;s worth giving some careful thought to those conventions, choosing graphic forms that convey as much as possible about what we <em>do</em> know without inviting spurious inferences about what we <em>don&#8217;t</em> know (such as color and texture).</p>
<p>Some of Shaw&#8217;s illustrations use a ribbon-and-sheet scheme invented 30 years ago by <a href="http://kinemage.biochem.duke.edu/teaching/anatax/index.html">Jane Richardson</a>, which still seems to work well for showing the overall architecture of a protein. But other diagrams and videos use a ball-and-stick model to represent atomic detail, and this strikes me as a less-happy choice. Watching that jiggling assembly of balls and sticks (black for carbon, red for oxygen, etc.), I kept seeing a shiny, brittle, plastic model of a protein rather than the protein itself. Surely there are better graphic devices.</p>
<p>Update: Thanks to Ron Dror of D. E. Shaw Research for pointing out an error in my description of the Anton algorithm: Distant charges are not mapped to a continuum distribution but to a mesh of discrete points. (I&#8217;ve made a correction above.) Ron also notes that an article on Anton in <em>Communications of the ACM</em> is available in the <a href="http://mags.acm.org/communications/200807/?folio=91">CACM digital edition</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2010/a-molecular-millisecond/feed</wfw:commentRss>
		</item>
		<item>
		<title>17 x 17: A nonprogress report</title>
		<link>http://bit-player.org/2009/17-x-17-a-nonprogress-report</link>
		<comments>http://bit-player.org/2009/17-x-17-a-nonprogress-report#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:38:00 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=544</guid>
		<description><![CDATA[The question again: Is there a four-coloring of the 17-by-17 grid in which none of the 18,496 rectangles have the same color at all four corners? As I said last time, Bill Gasarch would not have put a bounty on this problem if it had an easy solution. Over the past couple of weeks I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>The question again: Is there a four-coloring of the 17-by-17 grid in which none of the 18,496 rectangles have the same color at all four corners? As I said <a href="http://bit-player.org/2009/the-17x17-challenge">last time</a>, Bill Gasarch would not have put a bounty on this problem if it had an easy solution. Over the past couple of weeks I&#8217;ve invested some 10<sup>14</sup> CPU cycles in the search, and a few neural cycles too. I have nothing to show for the effort, except maybe a slightly clearer intuition about the nature of the problem.</p>
<p>If you generate a bunch of four-colored <em>n</em>-by-<em>n</em> grids at random, the average number of monochromatic rectangles per grid increases quite smoothly with <em>n</em>:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/12/random-grid-stats.png" alt="random-grid-stats.png" border="0" width="450" height="287" /></p>
<p>This gradual progression might lead you to suspect that the difficulty of finding or producing an <em>n</em>-by-<em>n</em> grid that is totally devoid of monochrome rectangles would also be a smooth function of <em>n</em>. The truth is quite different. </p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/12/success-graph.png" alt="success-graph.png" border="0" width="450" height="282" /></p>
<p>Finding a solution is easy for square grids of any size up to 15 by 15. The task suddenly becomes very hard at size 16 by 16. As for 17 by 17, it&#8217;s much harder still&#8211;and indeed is not yet known not to be impossible. (Details on the data behind this graph: For each size class from <em>n</em>=8 to <em>n</em>=17 I started with 1,000 randomly four-colored <em>n</em>-by-<em>n</em> grids. Then I applied a simple heuristic search (the first of the algorithms listed below) to each grid, running the program for 1,000 &times; <em>n</em><sup>2</sup> steps. The graph records the number of times this procedure succeeded&#8211;i.e., produced a grid with no monochrome rectangles&#8211;at each grid size. Up to <em>n</em>=14, the search never failed; at <em>n</em>=16 and beyond, it never succeeded.)</p>
<p>This kind of sudden transition from easy to hard is a familiar feature in the realm of constraint satisfaction. Well-known intractable problems such as graph coloring and boolean satisfiability have the same structure. That doesn&#8217;t bode well for any of the simple-minded computational methods I&#8217;ve tried. Here&#8217;s a brief catalog of my failures. These are algorithms that I&#8217;m pretty sure are never going to pay off.</p>
<ul>
<li><strong>Biased random walk.</strong> Start with a randomly colored grid. Repeatedly choose a site at random, then try changing its color; accept the move if it reduces the overall number of monochrome rectangles. This is the simplest of all the algorithms. None of the more-elaborate schemes is decisively better. </li>
<li><strong>Whack-a-mole.</strong> Find all the monochrome rectangles in the grid; choose one of them and alter the color of one corner, thereby eliminating the rectangle. In the simplest version of this algorithm, you choose the rectangle and the corner and the new color at random; in more sophisticated versions, you might evaluate the alternatives and take the one that offers the greatest benefit.</li>
<li><strong>Steepest descent.</strong> Examine all possible moves (for the 17-by-17 grid there are 867 of them) and choose one that minimizes the rectangle count.</li>
<li><strong>Lookahead steepest descent.</strong> Examine all possible moves, and then all possible sequels to each such move (for the 17-by-17 grid there are 751,689 two-move sequences); choose a sequence that minimizes the rectangle count. In principle this  method could be extended to chains of three or more moves, but the cost soon gets out of hand. (The lookahead technique is the mirror image of backtrack search; it explores the tree of possible moves breadth-first instead of depth-first.)</li>
<li><strong>Color-balanced search.</strong> Allow only moves that maintain the overall balance of colors in the grid. For example, in a 16-by-16 four-colored grid, color balance implies 16 sites in each color. One way to maintain balance is to make moves that swap the colors of two sites. (There is no reason to think that a rectangle-free grid will have exact color balance; on the other hand, a solution for a large grid cannot depart too far from perfect balance. Thus a color-balanced search might be an effective trick for finding a neighborhood where solutions are more common.) </li>
<li><strong>Row-and-column-balanced search.</strong> Allow only moves that maintain the balance of colors within each row and each column of the grid. In a 16-by-16 grid, each row and column should have four sites in each of four colors. A simple way to maintain this detailed color balance is to search for &#8220;harlequin rectangles&#8221; with the color pattern \(\begin{array}{cc}a &#038; b\\b &#038; a\end{array}\) and permute them to \(\begin{array}{cc}b &#038; a\\a &#038; b\end{array}\).</li>
</ul>
<p>Most of these techniques are <em>greedy</em>: At each stage the algorithm chooses an action that maximizes some measure of progress. On hard instances, a pure greedy strategy almost always fails; the search gets stuck in some local optimum. Thus it&#8217;s usually best to temper the greediness to some extent, occasionally choosing a move other than the one that yields the best immediate return. (The family of methods known as simulated annealing are more elaborate variations on this idea, based on insights from thermal physics.)</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/12/greediness-traces.png" alt="greediness-traces.png" border="0" width="450" height="287" /></p>
<p>Here we see traces of three runs of the algorithm identified above as <strong>steepest descent</strong>, with differing values of a greediness parameter <em>m</em>. (The grid size is 15 &#038;times 15.) At <em>m</em>=0 (no greediness at all), all moves are equally likely to be chosen, and the algorithm executes a random walk on the space of grid colorings. At <em>m</em>=1 (maximum greediness), the program always chooses the highest-ranked move, which works well until the system stumbles into a state where no move can reduce the rectangle count. A value of <em>m</em>=0.3 seems to be a good compromise. (I&#8217;ll say a little more below on the greediness parameter; indeed, I have a question about how best to define and implement it.)</p>
<p>After all this fussing with a dozen variations on local-search algorithms, I&#8217;m afraid the outlook for success is not promising. With a little patience and some tuning of parameters, any one of these algorithms can solve grids up to 15 &#038;times 15. With a lot more patience and tuning, they&#8217;ll eventually yield answers for 16 &#038;times 16. But none of the algorithms come even close to cracking the 17 &#038;times 17 barrier. Solving that one is going to require a fundamentally new idea. Perhaps someone will find an analytic approach to constructing a solution, rather than blindly searching for one. Or perhaps someone will prove that no solution exists.</p>
<p>On the computational front, I suspect the best hope is a family of algorithms known in various contexts as belief propagation, <a href="http://bit-player.org/bph-publications/AmSci-2003-01-Hayes-survey-propagation.pdf">survey propagation</a> and the cavity method. I&#8217;ve been hoping that friends who are expert in these techniques might swoop in and solve the problem for me, but if not I may have to give it a try myself.</p>
<p>In the meantime, here&#8217;s the thing about greediness (an apt subject for this time of year?). We want to define a function <em>greedy</em> whose arguments are a vector of alternative moves ranked from best to worst and a number <em>m</em> such that 0 &le; <em>m</em> &le; 1. If the greediness parameter <em>m</em> is 0, the function returns a random element of the vector. If <em>m</em> = 1, the returned value is always the first (highest-ranked) move. Otherwise, we must somehow interpolate between these behaviors. One attractive notion is to return the first element of the vector with probability <em>m</em>, the second choice with probability <em>m</em>(1&nbsp;&minus;&nbsp;<em>m</em>), and so on. Thus for <em>m</em>&nbsp;=&nbsp;1/2 the series of probabilities would begin 1/2, 1/4, 1/8&#8230;. For <em>m</em>&nbsp;=&nbsp;1/3 the first few values are 1/3, 2/9, 4/27&#8230;.</p>
<p>This scheme works just fine for a vector of infinite length, but there&#8217;s a problem with shorter vectors. Consider what happens with the procedure call <code>greedy(v=[1, 2, 3, 4], m=0.5)</code>. We have the following table of probabilities:</p>
<pre>
     1 --> 1/2
     2 --> 1/4
     3 --> 1/8
     4 --> 1/16
</pre>
<p>But on adding up those values, we come up 1/16th short of 1. What happens to the missing probability? I took an easy way out, distributing the &#8220;extra&#8221; probability equally over all the elements of the vector. The code looks something like this:</p>
<pre>
function greedy(v, m)
  for i=0 to length(v)
     if (i==length(v))
        return v[random(length(v))]
     elseif (random(1.0) < m)
        return v[i]
</pre>
<p>This procedure seems to give sensible results, but I wonder if there might be a better or more natural definition of greedy probabilities. Also, the running time for my code is logarithmic in the length of the vector (assuming <em>m</em> &lt; 1). Is there a constant-time algorithm that gives the same results? (We don&#8217;t know the length of the vector in advance, so merely precomputing the table of probabilities is not an option.)</p>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/17-x-17-a-nonprogress-report/feed</wfw:commentRss>
		</item>
		<item>
		<title>The 17&#215;17 challenge</title>
		<link>http://bit-player.org/2009/the-17x17-challenge</link>
		<comments>http://bit-player.org/2009/the-17x17-challenge#comments</comments>
		<pubDate>Sat, 05 Dec 2009 15:49:10 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=530</guid>
		<description><![CDATA[William Gasarch is not the Clay Mathematics Institute. He isn&#8217;t paying a million bucks for proofs of famous conjectures. But Gasarch is putting up 172 of his own dollars for the solution to an intriguing little stumper. And the prize problem appears to be somewhat easier than the Riemann hypothesis or the P=NP question. (Unless [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cs.umd.edu/~gasarch/">William Gasarch</a> is not the <a href="http://www.claymath.org/">Clay Mathematics Institute</a>. He isn&#8217;t paying <a href="http://www.claymath.org/">a million bucks</a> for proofs of famous conjectures. But Gasarch <em>is</em> putting up 17<sup>2</sup> of his own dollars for the solution to an intriguing little stumper. And the prize problem appears to be somewhat easier than the Riemann hypothesis or the P=NP question. (Unless it&#8217;s impossible!)</p>
<p>Gasarch sets forth his prize challenge in <a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">a blog post</a>, with further background in a <a href="http://www.cs.umd.edu/~gasarch/papers/grid.pdf">paper</a> and in the <a href="http://www.cs.umd.edu/~gasarch/papers/gridtalk.pdf">slides</a> from a talk. All of those works are well worth reading, but for those who don&#8217;t want to chase down the references, here&#8217;s the gist. Our mission, should we choose to accept it, is to color the nodes of an <em>n</em>-by-<em>m</em> grid, using only a specified number of colors, and observing a particular constraint: Nowhere in the grid may the four corners of a rectangle all have the same color. (Only rectangles with sides parallel to the <em>x</em> and <em>y</em> axes are considered.) For example, here is a four-colored 15-by-15 grid that satisfies the no-monochromatic-rectangles constraint:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/12/grid15r0a.png" alt="grid15r0a.png" border="0" width="360" height="360" /></p>
<p>In this array of dots there are \( {15 \choose 2}^2=11025\) distinct rectangles. If you care to check through all of them one by one, you&#8217;ll find that in no case do all four corners have the same color. In contrast, here is a 16-by-16 grid that is almost but not quite rectangle-free:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/12/grid16r2a.png" alt="grid16r2a.png" border="0" width="384" height="384" /></p>
<p>Gasarch offers his $289 bounty for any four-colored 17-by-17 grid with no monochromatic rectangles. Why is that grid of particular interest? It&#8217;s a border case. Among square grids, all those up through 16-by-16 have been shown to have rectangle-free four-colorings. <del datetime="2009-12-06T13:44:07+00:00">For the 18-by-18 grid and all larger squares, rectangle-free four-coloring has been proved impossible.</del> For squares larger than 18-by-18, four-coloring has been proved impossible. The status of the 17-by-17 and 18-by-18 grids remains unsettled, but Gasarch believes that both are four-colorable.</p>
<p>Gasarch has much more to say about the mathematics behind this problem. Here I would like to muse on some computational aspects of searching for a 17-by-17 four-coloring.</p>
<p>To state the obvious first, this is not a problem we can expect to solve by exhaustive enumeration. There are 4<sup>289</sup> possible colorings of the grid. Casting out symmetries brings that down only to 2 &times; 4<sup>287</sup>. There&#8217;s not world enough or time for checking them all.</p>
<p>Testing grids at random is also hopeless in the 17-by-17 case. This nonstrategy actually works quite well for small grids. For example, you can readily find a four-coloring of an 8-by-8 grid just by generating a few hundred thousand random colorings. But the method fails for larger grids because the proportion of all colorings that are rectangle-free falls steeply with grid size. (Consider the 2-by-2 grid: There are 256 four-colorings, and all but four of them are rectangle-free.)</p>
<p>To make any progress toward the 17-by-17 case, we&#8217;ll have to do at least a little thinking, rather than expecting the computer to do all the work. Here&#8217;s one idea that&#8217;s very easy to implement: Find a monochrome rectangle somewhere within the grid, change the color of one of its corners, and repeat until you can&#8217;t find any more rectangles. This algorithm works reasonably well for grids up to about 12-by-12, but then it runs out of steam. On larger grids, changing the color of a node to eliminate one rectangle is likely to create another rectangle elsewhere (or several more of them). As a result, the system merely takes a random walk, with trendless fluctuations in the number of rectangles at any given moment. You discover a rectangle-free coloring only if the walk happens to stumble on the zero point. </p>
<p>I found the 15-by-15 four-coloring shown above with an algorithm that&#8217;s a little more effective even thought it&#8217;s no more sophisticated than the corner-twiddling method. The program repeatedly chooses a node at random and tries assigning it all four possible colors, tallying up the number of rectangles for each color choice. Some color or set of colors must minimize the rectangle count; from among these optimal colors the program chooses one at random and sets the node to that color before repeating the loop. This is a &#8220;greedy&#8221; method: At each step the number of rectangles can decrease or remain constant but can never increase. Greedy methods are notorious for getting stuck in local optima that are inferior to the global optimum. Maybe that&#8217;s what happens to my program when I try it on 16-by-16 and 17-by-17 grids. Or maybe the search space is just too large. In any case, when I woke up this morning and checked the results of an overnight run, I did not find a rectangle-free four-colored 17-by-17 grid awaiting me.</p>
<p>Of course I really didn&#8217;t have to do any algorithm analysis at all to know that I wasn&#8217;t going to win $289 and eternal fame with a day or two of idle hacking. If the problem were <em>that</em> easy, Gasarch and his students would have solved it for themselves long ago.</p>
<p>In spite of these various failures and frustrations, the grid-coloring problem still looks tantalizingly solvable. If a four-coloring of the Gasarch grid exists, it seems like we should be able to find it by <em>some</em> practical computation. </p>
<p>There are certainly lots of approaches more powerful than the blind dart game I&#8217;ve been playing. For example, if local optima are the major impediment, some variation on simulated annealing might help.</p>
<p>A more radical possibility is to try to <em>construct</em> an instance rather than merely search for it. If we assume that the four colors are represented as evenly as possible, then the 17-by-17 grid must have 72 nodes in each of three colors and 73 nodes in the fourth color. Starting from a blank grid, it&#8217;s easy to mark off 73 nodes in a single color without creating a forbidden rectangle. Adding 72 nodes of a second color is only a little harder. But then the job gets tricky. When you try to fill in a third color, you also by default choose nodes for the fourth color at the same time, and conflicts pile up in a hurry. Some kind of backtracking approach is probably needed here. Gasarch links to a <a href="http://www.cs.umd.edu/~gasarch/BLOGPAPERS/bethk.pdf">paper</a> by Elizabeth Kupin of Rutgers that explores these ideas in more detail. (If you want to prove the <em>non</em>existence of a four-coloring, this is presumably the way to go.)</p>
<p>Gasarch mentions two other promising avenues: integer programming (the discrete variant of linear programming) and SAT solvers&#8211;algorithms for the satisfiability problem. Having spent some time hanging out with a few master SAT solvers, I&#8217;m intrigued by the latter possibility. You can almost encode the grid-coloring problem as an instance of NAE-SAT, or not-all-equal SAT. Each node of the grid is represented by a variable that can take on any of four values. We group subsets of variables four at a time into clauses, where each clause includes the variables representing the four corners of a rectangle somewhere in the grid. For the 17-by-17 grid there are \({17 \choose 2}^2=18496\) clauses of this kind. The entire formula is satisfied if we can assign values to the 289 variables in such a way that none of the 18496 clauses has all four of its variables with the same value. After 40 years of work on SAT, there&#8217;s a highly developed technology for solving such problems. However, there&#8217;s a hitch. SAT problems are formulated in terms of boolean variables, with just two values each, but the grid-color variables have four values. Thus a further layer of encoding is likely to be needed, bringing a further explosion in the size of the problem instance.</p>
<p>One final hackerish note: What&#8217;s the best way to detect the presence of a monochromatic rectangle in a grid? My candidate goes like this. We encode the rows of the grid in a set of bit vectors&#8211;four vectors for each row, representing the four possible colors. For example, the red vector for a row has a 1 at each position where the corresponding node is red, and zeroes elsewhere. The blue vector has 1s for blue nodes, and so forth. Now we can detect a rectangle merely by taking the logical AND of two rows (an operation that could be a single machine instruction). A rectangle exists if and only if <del datetime="2009-12-06T13:44:07+00:00">the result of the AND is nonzero.</del> at least two bits are set in the resulting vector. </p>
<p>[Thanks to all the commenters for corrections and elaborations.]</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/the-17x17-challenge/feed</wfw:commentRss>
		</item>
		<item>
		<title>El Farol Highway</title>
		<link>http://bit-player.org/2009/el-farol-highway</link>
		<comments>http://bit-player.org/2009/el-farol-highway#comments</comments>
		<pubDate>Fri, 27 Nov 2009 15:04:57 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[modern life]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=524</guid>
		<description><![CDATA[
I got caught Wednesday night in the national pre-Thanksgiving traffic jam. As I was approaching Baltimore, an electronic signboard announced:
Delays on I-95 and I-895
Suggest I-695
Of course I immediately thought: But everyone will read the sign and take I-695, so that road will be jammed too. Then I thought: But everyone who reads the sign will [...]]]></description>
			<content:encoded><![CDATA[<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/traffic-jam-9146.jpg" alt="traffic-jam-9146.jpg" border="0" width="450" height="247" /></p>
<p>I got caught Wednesday night in the national pre-Thanksgiving traffic jam. As I was approaching Baltimore, an electronic signboard announced:</p>
<div style="text-align:center">Delays on I-95 and I-895</p>
<p>Suggest I-695</p></div>
<p>Of course I immediately thought: But everyone will read the sign and take I-695, so that road will be jammed too. Then I thought: But everyone who reads the sign will realize that everyone else will also read the sign, and so they&#8217;ll <em>not</em> choose 695. Then I thought&#8230;.</p>
<p>Hmm. There&#8217;s <a href="http://www.santafe.edu/~wbarthur/Papers/El_Farol.html">something familiar</a> about this problem.</p>
<p>I&#8217;m not telling which road I took, but I can report that it was the only congestion-free segment of my trip.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/el-farol-highway/feed</wfw:commentRss>
		</item>
		<item>
		<title>The birth of the giant component</title>
		<link>http://bit-player.org/2009/the-birth-of-the-giant-component</link>
		<comments>http://bit-player.org/2009/the-birth-of-the-giant-component#comments</comments>
		<pubDate>Fri, 20 Nov 2009 22:38:48 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=519</guid>
		<description><![CDATA[The waste product of my document scanning project is a slag heap of extracted staples:

The other day I made a discovery: If you grab one of the discarded staples and lift it, the whole ball of tangled, mangled metal comes along, leaving behind only a few stragglers in the bottom of the bowl.

When I noticed [...]]]></description>
			<content:encoded><![CDATA[<p>The waste product of my <a href="http://bit-player.org/2009/information-is-physical">document scanning project</a> is a slag heap of extracted staples:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/staples-in-bowl-2667.jpg" alt="staples-in-bowl-2667.jpg" border="0" width="450" height="383" /></p>
<p>The other day I made a discovery: If you grab one of the discarded staples and lift it, the whole ball of tangled, mangled metal comes along, leaving behind only a few stragglers in the bottom of the bowl.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/ball-of-old-staples-closer-2691.jpg" alt="ball-of-old-staples-closer-2691.jpg" border="0" width="450" height="633" /></p>
<p>When I noticed this, my first thought was &#8220;Hmm, that&#8217;s funny.&#8221; My second thought was &#8220;Oh, of course: Erd&#337;s-R&eacute;nyi.&#8221; And my third thought&#8211;well, I&#8217;m still working on my third thought, as well as thoughts four, five and six.</p>
<p>Erd&#337;s and R&eacute;nyi are Paul Erd&#337;s and Alfr&eacute;d R&eacute;nyi, who wrote a big paper on &#8220;The Evolution of Random Graphs&#8221; 50 years ago (<em>Publications of the Mathematical Institute of the Hungarian Academy of Sciences</em>, 1960, 5:17&#8211;61). Their paper wasn&#8217;t quite the <a href="http://projecteuclid.org/DPubS?service=UI&#038;version=1.0&#038;verb=Display&#038;handle=euclid.aoms/1177706098"> debut appearance</a> of random graphs in the mathematical literature, but it&#8217;s usually cited as the theory&#8217;s point of origin. </p>
<p>In one version of the Erd&#337;s-R&eacute;nyi process, you start with a set of <em>n</em> isolated vertices and then add random edges one at a time; specifically, at each stage you choose two vertices at random from among all pairs that are not already connected, then you draw an edge between them. It turns out there&#8217;s a dramatic change in the nature of the graph when the number of edges reaches <em>n</em>/2. Below this threshold, the graph consists of many small, isolated components; above <em>n</em>/2, the fragments coalesce into one giant component that includes almost all the vertices. &#8220;The Birth of the Giant Component&#8221; was later described in greater detail in an even bigger paper&#8211;it filled an entire issue of <em>Random Structures and Algorithms</em> (1993, 4:233&#8211;358)&#8211;by Svante Janson, Donald E. Knuth, Tomasz Luczak and Boris Pittel.</p>
<p>What made me think of a connection between Erd&#337;s-R&eacute;nyi graphs and my hairball of staples? What I had in mind was something like this: The long, straight, middle part of a staple corresponds to an edge of a graph, and the bent end pieces, which can grab on to each other, are the vertices. Thus a single staple is a graph consisting of two vertices connected by one edge. When two staples hook up, two of their vertices merge and we&#8217;re left with a connected graph of three vertices and two edges. Since each staple contributes one edge and at most two vertices to the graph, the number of edges must be at least half the number of vertices. Thus the graph is always over the threshold for forming a giant component, according to Erd&#337;s and R&eacute;nyi.</p>
<p>The counting part of this analysis seems okay, but I&#8217;m afraid the rest of it doesn&#8217;t hold up very well. Whatever is going on in the staple ball, the evolution of the system is not well modeled by the Erd&#337;s-R&eacute;nyi process of adding edges to a fixed set of vertices. Instead, each staple brings both an edge and two vertices. The crucial event that makes the cluster hang together is the merging of vertices when staples link hands; this merging has no counterpart in the Erd&#337;s-R&eacute;nyi process. </p>
<p>The underlying problem here is that Erd&#337;s-R&eacute;nyi graphs are purely topological&#8211;there&#8217;s no concept of distance, and any two vertices are equally likely to have an edge joining them. But the staple graph has important geometric constraints. Two vertices can be joined by an edge only if the distance between them is approximately equal to the length of a staple. </p>
<p>The geometric structure suggests trying a different kind of model&#8211;perhaps the kind that describes the molecular structure of liquids and solids. Water molecules, for example, are linked together by a network of hydrogen bonds; each hydrogen atom in one molecule can bond to the oxygen atom in another molecule. But the bonds cannot extend over arbitrary distances; they reach only between neighboring molecules. In the resulting three-dimensional structure the basic motif is a tetrahedron with an oxygen atom at its center and hydrogen atoms at the four corners. (There&#8217;s also a schematic two-dimensional model known as <em>square ice</em>.) We might imagine something similar going on with the staples, where the two bent ends can form hydrogen-bond-like links to other nearby staples.</p>
<p>But there&#8217;s a problem with such chemical models as well. Atoms have a fixed valence (more or less&#8211;let&#8217;s not quibble); <img class="alignright" src="http://bit-player.org/wp-content/uploads/2009/11/old-staples-detail-2697.jpg" alt="old-staples-detail-2697.jpg" border="0" width="200" height="221" />in water, for example, each hydrogen atom can form a hydrogen bond with only one oxygen atom. But we have no reason to suppose that the hooked ends of a staple can attach to only one other staple. As a matter of fact, if such a restriction were enforced, then the staples could form only chains and rings, not dense clusters. In a close look at the actual clusters, it&#8217;s easy to find places where three or more staples are all hooked together at the same point. By carefully teasing apart the cluster, I have spotted vertices that appear to have a degree of at least six.</p>
<p>Yet another physical process that might provide a model for the staple graph is diffusion-limited aggregation. This is the mechanism responsible for the filigree pattern in the banner at the top of the bit-player web page. It is generated by sticky particles that drift at random until they wander onto the substrate or touch another particle that is already in contact (directly or indirectly) with the substrate. For staples, I suppose the drifters would be tumbling dumbbells with sticky ends&#8211;somewhat harder to simulate.</p>
<p>Another factor to keep in mind is that spatial dimensions are surely important here. For one thing, there&#8217;s just more room to maneuver in three dimensions, with more opportunities to glom onto a neighbor. But in the specific case of staples, there&#8217;s another reason: Confined to a plane, they have a hard time linking up:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/staples-on-plate-detail-2681.jpg" alt="staples-on-plate-detail-2681.jpg" border="0" width="450" height="318" /></p>
<p>Dispersed on a flat plate, they refuse to coagulate even when swirled vigorously. The reason, presumably, is that secure links form only when the staples can turn 90 degrees and interlock.</p>
<p>In this connection it would seem significant that these are <em>used</em> staples, somewhat varied in shape, with hooked ends that had been bent approximately 180 degrees in the process of stapling and that mostly retained an angle greater than 90 degrees after being pried out the papers. I wondered how shiny new staples would behave, and so I tried the experiment. (Materials and methods: 630 Stanley Bostitch chisel-point staples, model SBS191/4CP, freshly dispensed from an open-jaw Swingline stapler.)</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/ball-of-new-staples-crop-2700.jpg" alt="ball-of-new-staples-crop-2700.jpg" border="0" width="450" height="710" /></p>
<p>I was mildly surprised at the result. Although the aggregation was somewhat looser and more delicate, it really wasn&#8217;t that much different. Again we witness the birth of a giant component.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/the-birth-of-the-giant-component/feed</wfw:commentRss>
		</item>
		<item>
		<title>Information is physical</title>
		<link>http://bit-player.org/2009/information-is-physical</link>
		<comments>http://bit-player.org/2009/information-is-physical#comments</comments>
		<pubDate>Wed, 11 Nov 2009 20:06:14 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=509</guid>
		<description><![CDATA[I&#8217;m still busy digitizing a lifetime&#8217;s accumulation of clippings from magazines and journals, along with heaps of old tech reports, memos, and miscellaneous other cruft. There&#8217;s something slightly eerie about the process. So far I&#8217;ve emptied out a dozen file drawers, run several hundred pounds of paper through the scanner, and created thousands of PDFs. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bit-player.org/2009/bits-from-its">I&#8217;m still busy</a> digitizing a lifetime&#8217;s accumulation of clippings from magazines and journals, along with heaps of old tech reports, memos, and miscellaneous other cruft. There&#8217;s something slightly eerie about the process. So far I&#8217;ve emptied out a dozen file drawers, run several hundred pounds of paper through the scanner, and created thousands of PDFs. Yet my laptop is not a gram heavier. The glib explanation is that I&#8217;m just scraping pure information off the pages, leaving behind the ink and cellulose; I&#8217;m saving the bits and recycling the atoms. But is information so readily dematerialized? One of the manila folders I have just dredged up out of a filing cabinet is bulging with publications by the late Rolf Landauer, including several papers on the theme &#8220;Information is physical!&#8221;</p>
<p>I first met Rolf circa 1980. I had written a brief <em>Scientific American</em> article about some recent developments in optical computing technologies, and Rolf called to tell me I should never do anything so reckless and foolish and tasteless again. He took a dim view of photonics. This initial encounter was not a promising start to a friendship, but we got over it. He put me on his mailing list, which meant that I got a fat envelope once or twice a year, with reprints or preprints of his own latest work and often copies of other papers he thought I should being paying attention to.</p>
<p>Four of the articles in my Landauer folder have very similar titles:</p>
<ul>
<li>Information is Physical (<em>Physics Today</em>, 1991).</li>
<li>The Physical Nature of Information (<em>Physics Letters A</em>, 1996).</li>
<li>Information is a Physical Entity (<em>Physica A</em>, 1999).</li>
<li>Information is Inevitably Physical (In <em>Feynman and Computation</em>, 1999).</li>
</ul>
<p>If Landauer had lived longer (he died in 1999), I like to think that the next installment in the series would have been titled even more emphatically: Information is Physical, Damn It!</p>
<p>In all of these essays, Landauer&#8217;s thesis is straightforward:</p>
<blockquote title="from: Landauer, Rolf. 1999. Information is inevitably physical. In Feynman and Computation: Exploring the Limits of Computers, pp. 77&#8211;92. Cambridge, Mass.: Perseus Books."><p>Information is inevitably tied to a physical representation. It can be engraved on stone tablets, denoted by a spin up or down, a charge present or absent, a hole punched in a card, or many other alternative physical phenomena. It is not just an abstract entity; it does not exist except through a physical embodiment. It is, therefore, tied to the laws of physics and the parts available to us in our real physical universe.</p></blockquote>
<p>This notion is obvious and totally uncontroversial&#8211;except to those who think it&#8217;s totally wrong. Doubters tend to focus on mathematical entities. Surely the integers exist as abstractions, independent of stone tablets and punchcards, no? And triangles would have three sides even if all the matter in the universe were annihilated&#8211;right? When it comes to numbers like &pi; and <em>e</em>, one might well argue that they can exist <em>only</em> as abstractions; they can never be given a complete physical representation.</p>
<p>Landauer did not argue strenuously for his constructivist position within mathematics itself, but he did take a hard line about mathematical methods in the physical sciences:</p>
<blockquote title="from: Landauer, Rolf. 1999. Information is a physical entity. Physica A 263:63&#8211;67."><p>There is a tendency to think of mathematics as a tool which somehow existed before and outside of our physical world. Mathematics, in turn, allowed the formulation of physical laws which then run the world, much as a process control computer runs a chemical plant. Here, instead, we emphasize that information handling has to be done in the real physical world, and the laws of physics exist as instructions for information handling in that real world. It, therefore, makes no sense to invoke operations, in the laws of physics, which are not executable, at least in principle, in our real physical world. </p>
<p>Our accepted laws of physics invoke continuum mathematics, which is, in turn, based on the notion that any required degree of precision can be obtained by invoking enough successive operations. But our real universe is unlikely to allow an unlimited sequence of totally reliable operations. The memory size is likely to be limited, perhaps, because the universe is limited. Even in an unlimited universe it is a strong presumption to invoke the possibility of assembling an arbitrarily large organized memory structure. Furthermore, in a world full of deleterious processes including noise, corrosion, electromigration, incident alpha particles and cosmic rays, earthquakes and spilled cups of coffee, it would be unreasonable to assume that each step in an unlimited sequence of operations can be carried out infallibly.</p></blockquote>
<p>Those alpha particles and spilled cups of coffee bring me back to my little document-scanning project&#8211;my kitchen-table version of Google Books. I am well aware that my digitized archives are not disembodied abstractions, that the information I&#8217;ve scanned from Rolf&#8217;s preprints is still physical even if it&#8217;s less tangible, and that the bits remain vulnerable to all the perils of a material world. Indeed, the thought of losing all the files I&#8217;ve scanned&#8211;now that the paper originals are beyond recall&#8211;makes me itchy to plug in the back-up drive.</p>
<p>But the process of replicating the bits&#8211;which is even easier than capturing them in the first place&#8211;sends my mind off on another tangent. As Rolf said, we can represent information in many physical forms: as marks on paper, as magnetized domains on a metal-coated disk, as packets of electric charge, as base pairs in a DNA molecule, as beads on an abacus. When we build machinery to process this information, we can choose among many different computing technologies: transistors, brass gears, neurons, rubber bands and tinker toys, quantum dots, even photons in optical waveguides (though Rolf despised that last possibility, and he was skeptical about the quantum dots).</p>
<p>Somehow, this proliferation of physical embodiments for information does <em>not</em> strengthen the conviction that information is subordinate to its physical representation. When we can write the same message in so many forms&#8211;everything from lines in the sand to holograms&#8211;the message itself begins to seem just as substantial as the physical medium, and perhaps more enduring. I have digital documents that began life on eight-inch floppy disks 20 years ago. The files have migrated a dozen times or more to other media: five-and-a-quarter-inch floppies, three-and-a-half-inch floppies, Zip drives, digital audio tapes, CD-ROMs, a succession of hard disks. Most of the physical objects making up that long chain of transmission have long since succumbed to coffee spills, corrosion and other hazards, or else they have simply gotten lost. Yet the data persists, a sort of standing wave in the river of hardware rushing toward obsolescence and oblivion. Under the circumstances, it can be hard to keep in mind that the information depends for its very existence on those delicate shards of matter. It goes against the grain of the whole apparatus of computer science, where automata theory, the Church-Turing thesis, and the Turing equivalence of programming languages all encourage us to think that abstractions come first, and implementation is secondary.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/11/euclid1703.png" alt="Euclid1703.png" border="0" width="450" height="480" /></p>
<p>These musings are not meant as an attempt to refute Landauer&#8217;s assertion. I still have to concede that I cannot record or express a pattern of bits without resorting to <em>some</em> physical medium, if only the gray matter in my own head. But the notion sits uncomfortably; it&#8217;s a conundrum. I wish I had a chance to chat with Rolf about it. But, sadly, Rolf Landauer is no longer physical.</p>
<p>Note: As far as can tell, none of the four Landauer papers I mention above are available online without payment. I am therefore taking the liberty of posting <a href="http://bit-player.org/wp-content/uploads/2009/11/Landauer1999.pdf">my scan of Rolf&#8217;s preprint</a> of the information-is-a-physical-entity paper. I would also like to call attention to two recent articles about Landauer: a <a href="http://arxiv.org/abs/0910.0993v1">discussion</a> of his contributions to solid-state physics by Bertrand I. Halperin and David J. Bergman,  and a <a href="http://books.nap.edu/html/biomems/rlandauer.pdf">biographical memoir</a> by Charles H. Bennett and Alan B. Fowler.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/information-is-physical/feed</wfw:commentRss>
		</item>
		<item>
		<title>A comment on comment spam</title>
		<link>http://bit-player.org/2009/a-comment-on-comment-spam</link>
		<comments>http://bit-player.org/2009/a-comment-on-comment-spam#comments</comments>
		<pubDate>Fri, 06 Nov 2009 16:31:16 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[modern life]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=504</guid>
		<description><![CDATA[Someone out there is being paid to post comments on bit-player.org&#8211;and doubtless on tens of thousands of other blogs as well. The comments are mostly bland and inoffensive, sometimes effusive, always hastily composed. &#8220;Thanks for article..good work,&#8221; they say. &#8220;Amazing!!&#8221;  &#8220;i like your article and i will be wating your net article&#8230;.&#8221;
The payload attached [...]]]></description>
			<content:encoded><![CDATA[<p>Someone out there is being paid to post comments on bit-player.org&#8211;and doubtless on tens of thousands of other blogs as well. The comments are mostly bland and inoffensive, sometimes effusive, always hastily composed. &#8220;Thanks for article..good work,&#8221; they say. &#8220;Amazing!!&#8221;  &#8220;i like your article and i will be wating your net article&#8230;.&#8221;</p>
<p>The payload attached to each of these comments is a link to a web site that someone wants to promote. Some of the sites are selling goods or services; others are billboards full of pay-per-view ads; a fair number are mysterious to me, being written in languages I don&#8217;t understand. I would not be astonished to learn that some of the sites are distributing malware.</p>
<p>Years ago, the first wave of comment spam was powered by scripts that flooded blogs and wikis and forums with hundreds of postings full of program-generated gibberish and long lists of links. That abuse was stopped by captchas and other simple filters, like <a href="http://bit-player.org/2006/stupid-questions">the one</a> I&#8217;ve been using here on bit-player. Another important defense is the &#8220;<a href="http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html">nofollow</a>&#8221; tag, which instructs search engines to ignore links in comments, thereby eliminating the incentive of gaining PageRank points.</p>
<p>The comment spam arriving now is not generated by a Perl script. Somewhere in the world a person is being paid to read these very sentences, then to prove his or her humanity to the Turing-test filter, and finally to write a few words in response and sneak in a paid link. I&#8217;m both fascinated and appalled to learn that the Internet economy can support this activity. What&#8217;s the going rate for writing comment spam? Is it worth a penny to get your link briefly exposed to the vast daily readership of bit-player.org? How about a tenth of a penny?</p>
<p>I have a sinking feeling that the people doing this work are themselves victims of a scam, and that they&#8217;ll never see even the tenth of a penny. They have probably succumbed to a 21st-century version of the ads I used to see on matchbook covers: &#8220;Work at home! Make $500 a week stuffing envelopes in your spare time!&#8221;</p>
<p>Of all the ways that poor and desperate people are exploited, this is not the worst. Presumably the work is safe and sanitary, and it even rewards literacy. Some of my comment spammers would surely have interesting ideas to contribute if only they had the luxury of time.</p>
<p>All the same, this kind of commercial graffiti is not something I want to encourage. The available countermeasures include prohibiting all links in comments, holding all comments until a moderator approves them, or requiring commenters to register with a verifiable email address. None of these options appeals to me, but I may have to consider them if the problem persists. For now, though, I&#8217;m going to continue the human approach&#8211;manually deleting spammy comments as quickly as I can get to them. I am also closing comments on all but the 10 most-recent items on bit-player; the spammers seem to favor older posts.</p>
<p>I have to add that spotting comment spam is not always as easy as you might think. Consider this comment, which came in response to a story about editorial changes at <em>Scientific American</em> magazine:</p>
<blockquote><p>Many times, when i read your American Scientist columns, I have asked myself that is any other country&#8217;s scientist  didn&rsquo;t give anything to the world?</p></blockquote>
<p>The text of the comment is pertinent to the topic; it raises a question that&#8217;s entirely appropriate in this context; and there&#8217;s clear evidence that the author has actually been reading bit-player (and even my <em>American Scientist</em> columns) rather than merely spewing comments at random. This is someone I would like to be able to welcome into the community. But the link associated with the comment was an ad for a web-hosting service, and another comment from the same IP number advertised a different service. Was I wrong to hit the delete button?</p>
<p>You&#8217;re welcome to comment below, but without spammy links, please.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/a-comment-on-comment-spam/feed</wfw:commentRss>
		</item>
		<item>
		<title>Flights of fancy</title>
		<link>http://bit-player.org/2009/flights-of-fancy</link>
		<comments>http://bit-player.org/2009/flights-of-fancy#comments</comments>
		<pubDate>Tue, 27 Oct 2009 17:33:25 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[biology]]></category>

		<category><![CDATA[computing]]></category>

		<category><![CDATA[mathematics]]></category>

		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=498</guid>
		<description><![CDATA[
As I have mentioned in the past, I&#8217;m fascinated by the acrobatics of bird flocks, especially the big congregations of European starlings that gather in the evening at this time of year. Evidently I&#8217;m not the only one with such an interest. In the past few years the subject has attracted the attention of quite [...]]]></description>
			<content:encoded><![CDATA[<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/10/starlings-closeup-2058.jpg" alt="starlings-closeup-2058.JPG" border="0" width="450" height="300" /></p>
<p>As I have <a href="http://bit-player.org/2007/boidland">mentioned in the past</a>, I&#8217;m fascinated by the acrobatics of bird flocks, especially the big congregations of European starlings that gather in the evening at this time of year. Evidently I&#8217;m not the only one with such an interest. In the past few years the subject has attracted the attention of quite a large flock of scientists, including not only biologists but also various luminaries in physics, mathematics and computer science.</p>
<p>Below are some notes on a few of the recent papers, but first I have to mention a classic from 20 years ago:</p>
<blockquote><p>Reynolds, Craig W. 1987. Flocks, herds, and schools: a distributed behavioral model. <em>Computer Graphics</em> 21(4):25&#8211;33. <a href="http://www.red3d.com/cwr/papers/1987/boids.html">Author archive</a>.</p></blockquote>
<p>This is the paper that began the modern era of flocking studies by proposing that animals could coordinate and synchronize their movements without any need for a leader or external cues. Others were thinking along the same lines at about the same time, but it was Reynolds who attracted wide notice with his <a href="http://www.red3d.com/cwr/boids/">enchanting computer animations</a> of &#8220;boids&#8221; soaring through an imaginary three-dimensional space. Each individual in the flock acts according to simple, local, fixed rules, and the synchronized maneuvers emerge spontaneously.</p>
<p>Reynolds suggested three particular rules that might guide the behavior of each bird:</p>
<ul>
<li>Avoid collisions.</li>
<li>Try to match the speed and heading of nearby birds.</li>
<li>Move toward the center of the group in which you are flying.</li>
</ul>
<p>Reynolds was working in computer graphics, and his ideas were soon taken up by movie studios and by the makers of video games. In a sense, his simulations only had to <em>look</em> right; they didn&#8217;t have to reflect what actually goes on in a starling&#8217;s head. But whether or not the birds were paying attention, students of animal behavior certainly were.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/10/starlings-wide-2064.jpg" alt="starlings-wide-2064.jpg" border="0" width="450" height="198" /></p>
<p>Much of the recent activity arises out of new field studies, conducted mainly by physicists. </p>
<blockquote><p> Cavagna, Andrea, Irene Giardina, Alberto Orlandi, Giorgio Parisi, Andrea Procaccini, Massimiliano Viale and Vladimir Zdravkovic. 2008. The STARFLAG handbook on collective animal behaviour. 1: Empirical methods. <em>Animal<br />
Behaviour</em> 76:217&#8211;236. <a href="http://arxiv.org/abs/0802.1668v1">Preprint</a>.</p>
<p>Cavagna, Andrea, Irene Giardina, Alberto Orlandi, Giorgio Parisi and Andrea Procaccini. 2008. The STARFLAG handbook on collective animal behaviour. 2: Three-dimensional analysis. <em>Animal Behaviour</em> 76:237&#8211;248. <a href="http://arxiv.org/abs/0802.1674">Preprint</a>.</p></blockquote>
<p>This group, coordinated by Andrea Cavagna and Irene Giardina of the University of Rome La Sapienza, has been photographing starling flocks near the city&#8217;s main railroad station (the Termini), which is just a few blocks from the university. Using pairs of synchronized cameras, the observers have captured stereoscopic images and then applied special image-analysis software to reconstruct the three-dimensional trajectory of each bird. Similar techniques have been tried in the past, but only with small flocks (a few dozen birds). The Italian group has traced the motions of individual birds in groups of up to 2,600. The two papers cited above give technical details on how the data were gathered and analyzed.</p>
<blockquote><p>Ballerini, Michele, Nicola Cabibbo, Raphael Candelier, Andrea Cavagna, Evaristo Cisbani, Irene Giardina, Alberto Orlandi, Giorgio Parisi, Andrea Procaccini, Massimiliano Viale and Vladimir Zdravkovic. 2008. Empirical investigation of starling &#64258;ocks: a benchmark study in collective animal behaviour. <em>Animal Behaviour</em> 76:201&#8211;215. <a href="http://arxiv.org/abs/0802.1667">Preprint</a>.</p>
<p>Ballerini, Michele, Nicola Cabibbo, Raphael Candelier, Andrea Cavagna, Evaristo Cisbani, Irene Giardina, Vivien Lecomte, Alberto Orlandi, Giorgio Parisi, Andrea Procaccini, Massimiliano Viale and Vladimir Zdravkovic. 2008. Interaction ruling animal collective behavior depends on topological rather than metric distance: Evidence from a field study. <em>Proceedings of the National Academy of Science of the USA</em>  105:1232&#8211;1237. <a href="http://www.pnas.org/content/105/4/1232">Open access</a>.</p></blockquote>
<p>And here the same authors (with a few additions) report their results and conclusions. They base their interpretation on a computational model that is recognizably a descendant of the Reynolds scheme, but with one crucial modification. Reynolds and others assumed that each bird is influenced by all other birds within some fixed distance (a &#8220;metric neighborhood&#8221;); Ballerini et al. get a closer match to the data by assuming that a bird attends to the motions of a fixed number of near neighbors, regardless of distance (a &#8220;topological neighborhood&#8221;). In other words, the graph of interacting birds has nearly constant vertex degree; the typical degree is probably six or seven. The main significance of this algorithmic change is that it helps maintain the cohesion of the flock in spite of large variations in density.</p>
<blockquote><p>Hildenbrandt, Hanno, Claudio Carere and Charlotte K. Hemelrijk. 2009. Self-organised complex aerial displays of thousands of starlings: a model. <a href="http://arxiv.org/abs/0908.2677">arXiv:0908.2677v1</a></p></blockquote>
<p>Those same flocks at Termini have a role in this study as well; the model presented here draws on data from Ballerini et al. as well as videotapes made at Termini by Carere. (Carere is another physicist at Sapienza; Hildenbrandt and Hemelrijk are biologists at the University of Groningen.)</p>
<p>The model works on the same essential principles, but it differs in intellectual style and emphasis. Hildenbrandt et al. want to account for specific details of a flock&#8217;s behavior&mdash;not just the general tendency to fly in close formation but also the particular shapes of starling flocks, the maneuvers they perform, the altitudes they prefer, and so on. Reaching for this verisimilitude leads to a rather complicated model with many parameters in need of fine tuning, such as aerodynamic properties of the bird&#8217;s wing and body and banking angles in turns. Hildenbrandt et al. report some success in explaining the geometry of flocks (they tend to be horizontally flattened rather than spherical). They do less well in an attempt to account for an extra-dense layer of birds observed at the periphery of a flock.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/10/starlings-landing-2072.jpg" alt="starlings-landing-2072.jpg" border="0" width="450" height="345" /></p>
<blockquote><p>Cucker, Felipe, and Steve Smale. 2007. Emergent behavior in flocks. <em>IEEE Transactions on Automatic Control</em> 52:852&#8211;862.</p>
<p>Chazelle, Bernard. 2009. Natural algorithms. <em>Proceedings of the 20th Symposium on Discrete Algorithms</em>, pp. 422-431. <a href="http://www.cs.princeton.edu/~chazelle/pubs/soda09.pdf">Preprint</a>.</p>
<p>Chazelle, Bernard. 2009. The convergence of bird flocking. <a href="http://arxiv.org/abs/0905.4241">arXiv:0905.4241v1</a></p></blockquote>
<p>Leaving behind the breathy wing-beats of living starlings, we enter a world of mathematical abstractions. </p>
<p>Cucker and Smale, peripatetic mathematicians currently at the City University of Hong Kong, take a stripped-down model of flocking and ask this question: Is it guaranteed that all the birds in the flock will eventually settle on the same velocity, and thus fly together forever? Chazelle, a theoretical computer scientist at Princeton, asks a follow-on question: If the birds do converge on the same speed and heading, how long might it take for them to do so, in the worst case?</p>
<p>The answer to the Cucker-Smale question turns out the be <em>yes</em>: Given certain preconditions and parameter values, convergence is certain. But Chazelle shows that it can take quite a while for the flock to reach consensus. For <em>n</em> birds adjusting their velocities in discrete steps, the upper bound is 2 &uarr;&uarr; (4 log <em>n</em>) steps. As I was saying <a href="http://bit-player.org/2009/a-wiki-proof">just the other day</a>, this  up-arrow notation denotes an exponential tower of 2s with, in this case, 4 log<sub>2</sub> <em>n</em> levels. In other words, in a flock of a thousand birds, the convergence time is roughly</p>
<p>\[2^{2^{2^{\cdot^{\cdot^{\cdot^2}}}}}\]</p>
<p>with 40 levels of exponentiation. This is a ridiculous number, far exceeding the lifetime of a starling (or of a universe, for that matter). As Chazelle notes: &#8220;Our bounds obviously say nothing about physical birds in the real world. They merely highlight the exotic behavior of the mathematical models.&#8221;</p>
<p>It <em>is</em> rather wonderful to reflect&mdash;as you stand in a field of corn stubble admiring the flocks of birds wheeling overhead in the evening sky&mdash;that these avian entertainments should be the starting point for a line of reasoning that ventures so far into the wild blue yonder of inexpressible numbers.</p>
<blockquote><p> Lebar Bajec, Iztok, and Frank H. Heppner. 2009. Organized &#64258;ight in birds. <em>Animal Behaviour</em> 78:777&#8211;789. <a href="http://lrss.fri.uni-lj.si/people/ilbajec/papers/ilb_ab09.pdf">Preprint</a>.</p></blockquote>
<p>I mention this piece last, but it would actually be a good place to start if you want a primer on flocking. Frank Heppner, a biologist at the University of Rhode Island, is one of the pioneers of flocking-and-swarming studies; here, with a mathematical colleague from the University of Ljubljana, he reviews many of the recent contributions and puts them in historical context. The review includes a discussion of the more crystalline flying formations of large birds such as geese as well as the amorphous flocks of starlings.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/flights-of-fancy/feed</wfw:commentRss>
		</item>
		<item>
		<title>A Wiki proof</title>
		<link>http://bit-player.org/2009/a-wiki-proof</link>
		<comments>http://bit-player.org/2009/a-wiki-proof#comments</comments>
		<pubDate>Wed, 21 Oct 2009 21:26:07 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=491</guid>
		<description><![CDATA[This morning&#8217;s list of new submissions to the mathematics section of the arXiv brings a paper signed by &#8220;D. H. J. Polymath.&#8221; The name is too good to be true, of course. The paper is the first fruit of a project instigated by Timothy Gowers of Cambridge. In a blog post last January, Gowers asked [...]]]></description>
			<content:encoded><![CDATA[<p>This morning&#8217;s list of new submissions to the mathematics section of the arXiv brings <a href="http://arxiv.org/abs/0910.3926">a paper</a> signed by &#8220;D. H. J. Polymath.&#8221; The name is too good to be true, of course. The paper is the first fruit of a project instigated by Timothy Gowers of Cambridge. In a <a href="http://gowers.wordpress.com/2009/01/27/is-massively-collaborative-mathematics-possible/">blog post last January</a>, Gowers asked &#8220;Is massively collaborative mathematics possible?&#8221; and proposed a problem that might serve as a test case. There were more than 100 responses, and soon the game was on. Discussion began in the comments section of Gowers&#8217;s blog and was later supplemented and summarized in a <a href="http://michaelnielsen.org/polymath1/index.php?title=Main_Page">Wiki</a> maintained by <a href="http://michaelnielsen.org/blog/michael-a-nielsen/">Michael Nielsen</a>.</p>
<p>The problem under attack is known as the density Hales-Jewett theorem (hence Dr. Polymath&#8217;s initials). The ordinary version of the Hales-Jewett theorem states that if you play tic-tac-toe on a board of high enough dimension, the game can never end in a draw. When you have filled in all the boxes, some row or column or diagonal in the multidimensional grid must consist entirely of <em>x</em>&#8217;s or <em>o</em>&#8217;s&mdash;even if you&#8217;ve been trying to reach a stalemate position. The theorem also holds with more than two players and more than two symbols, provided the dimension of space is high enough. The &#8220;density&#8221; version of the theorem says that sometimes you can&#8217;t avoid a winning play even if you stop before filling in all the boxes: A grid-spanning line of solid <em>x</em>&#8217;s or <em>o</em>&#8217;s is certain to appear as soon as the density, or fraction of filled boxes, reaches a threshold level.</p>
<p>The density version of the Hales-Jewett theorem was proved almost 20 years ago by Hillel Furstenberg and Yitzhak Katznelson, so this is not an open problem. But the Furstenberg-Katznelson proof drew on some results from ergodic theory, a branch of mathematics that seems slightly exotic for a problem stated in such simple, finite terms. Gowers asked if there might be a purely combinatorial proof. And he focused attention specifically on the case where each row and column of the tic-tac-toe board has three positions and there are three players. In other words, the grid is a 3&nbsp;&times;&nbsp;3&nbsp;&times;&nbsp;3&nbsp;&times;&nbsp; . . . &nbsp;&times;&nbsp;3 hypercube where each vertex is to be marked with one of three symbols.</p>
<p>The combinatorial proof is given in the Polymath paper, which also puts a bound on how high a dimension is needed. The bound is 2 &uarr;&uarr; <em>O</em>(1/&delta;<sup>3</sup>), where &delta; is the density and the double-arrow notation indicates an &#8220;exponential tower&#8221; of  2s &mdash; namely <em>O</em>(1/&delta;<sup>3</sup>) of them.</p>
<p>A collective pseudonym such as Polymath immediately brings to mind the famous Nicolas Bourbaki. As in the writings of that French group, the Polymath paper includes no listing of contributors. But there&#8217;s a difference: The Bourbakists were a secretive bunch, a sort of sleeper cell within mathematics, and historians have pieced together who did what only in retrospect. The Polymath group describes their style of work as &#8220;open source&#8221; mathematics. It&#8217;s all there on the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/a-wiki-proof/feed</wfw:commentRss>
		</item>
		<item>
		<title>In the long run we&#8217;re all dead</title>
		<link>http://bit-player.org/2009/in-the-long-run-were-all-dead</link>
		<comments>http://bit-player.org/2009/in-the-long-run-were-all-dead#comments</comments>
		<pubDate>Tue, 20 Oct 2009 01:49:31 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=484</guid>
		<description><![CDATA[So said John Maynard Keynes, but what did he know about the long run? He was a swell who spent his mornings in bed, trading international currencies over tea and crumpets. 
Yesterday was my day for the long run: I ran a marathon for the first time in my life. The race was the Baystate [...]]]></description>
			<content:encoded><![CDATA[<p>So said John Maynard Keynes, but what did <em>he</em> know about the long run? He was a swell who spent his mornings in bed, trading international currencies over tea and crumpets. </p>
<p>Yesterday was <em>my</em> day for the long run: I ran a marathon for the first time in my life. The race was the Baystate Marathon in Lowell, Massachusetts. I finished in 5:11:23, good enough for 1,494th place. (<a href="http://www.coolrunning.com/results/09/ma/Oct18_Baysta_set1.shtml">Complete results here.</a>) Except for the leaden skies, the blustery wind, the temperatures falling from the 40s into the 30s, and the steady rain that later turned to &#8220;wintry mix&#8221; and then a bit of snow, it was a perfectly lovely day for a run along the Merrimack River. I had a splendid time. Really. And yet it would have been even more fun if it hadn&#8217;t gone on quite so long.</p>
<p>Somewhere around mile 20, I began reflecting on the fact that the leaders of the race had already finished more than an hour earlier, and by now they were probably showered and dressed and having something hot to eat. I had to ask myself: Why hadn&#8217;t <em>I</em> been running faster, so that I too could now be sitting somewhere comfortable and dry and warm? A mile later, as I slogged on, it dawned on me that surviving a marathon is basically an optimization problem. The essential task is to balance the pain of running faster against the suffering of staying on your feet longer. There&#8217;s a mathematical function to be minimized here. But what&#8217;s the form of that function?</p>
<p>Splashing on through the puddles, I didn&#8217;t make a lot of progress on that question, but several hours later, wrapped in a blanket and enjoying a grilled-cheese sandwich, I realized that a simple candidate function is just 1/<em>t</em> + <em>t</em>, where <em>t</em> is the total time of the run. This function clearly has the right boundary behavior. It diverges at <em>t</em> = 0, reflecting the common-sensical notion that running infinitely fast is infinitely painful. The function is also unbounded as <em>t</em> goes to infinity, since taking forever to complete the course would also be very unpleasant. In between these extremes, there must be at least one <em>t</em> of minimal misery.</p>
<p>To get quantitative results from this function, we need to plug in some constants and coefficients. Marathon times near zero are unrealistic, so we ought to replace <em>t</em> with <em>t</em>&#8211;<em>a</em>, where <em>a</em> is the best plausible finishing time. Then we need a coefficient <em>b</em> that sets the scaling between the two kinds of discomfort. The full expression becomes:</p>
<p>\[f(t)=\frac{b}{(t-a)} + (t-a)\]</p>
<p>The value of <em>a</em> in this expression is somewhat arbitrary, but a good guideline might be the current world record marathon time of about 2:04. If we set <em>a</em> = 120 minutes, there&#8217;s no need to worry that I&#8217;ll ever do better than that (and thereby flip over onto the negative branch of the hyperbola, where everyone runs backwards). With this parameter fixed, the location of the least-arduous marathon time depends only on the value of <em>b</em>, which defines the cost of speed vs. the cost of endurance. If my run in Lowell was a correct solution of the optimization problem, then my personal value of <em>b</em> is 36,481.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/10/marathongraph.png" alt="marathongraph.png" border="0" width="452" height="294" /></p>
<p>This line of reasoning has a curious corollary. If I want to improve my marathon time, I don&#8217;t have to learn to run faster; all I have to do is become less tolerant of prolonged standing or walking. This impatience will shift the point of minimum pain leftward, toward higher speeds and shorter elapsed  times. For example, if I can just get my value of <em>b</em> down to 14,400, I&#8217;ll be running four-hour marathons. I don&#8217;t think I&#8217;ve ever heard of a training program based on this principle. </p>
<p><strong>Update 2009-10-20</strong>: This morning it occurred to me that the same graph, relabeled, could also serve to predict the future course of my geriatric athletic career. I&#8217;ve been running for only a few years, and I never attempted distances greater than 10K until this summer. Thus it seems reasonable to suppose that with further effort I might improve somewhat. On the other hand, I&#8217;m about 30 years beyond the age at which distance runners tend to reach their peak, which argues that I&#8217;m running against the wind, so to speak. (In the long run, Keynes was right after all.)</p>
<p>Here&#8217;s a fancifully relabeled version of the graph that I find rather cheering.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2009/10/marathonagegraph.png" alt="marathonagegraph.png" border="0" width="445" height="294" /></p>
<p>Unfortunately, there&#8217;s no good reason to believe that either of these phenomena are truly described by a law of the specific form 1/<em>t</em> + <em>t</em>. The second term could be <em>t</em><sup>2</sup>, or even <em>e<sup>t</sup></em>. (The marathon &#8220;<a href="http://www.usatf.org/groups/RoadRunning/rankingstandards.asp">ranking standards</a>&#8221; published by USA Track and Field appear to increase quadratically with age.)</p>
<p><strong>Update 2009-10-23</strong>: Perhaps someone at <em>The New York Times</em> reads bit-player. In today&#8217;s paper there&#8217;s a <a href="http://www.nytimes.com/2009/10/23/sports/23marathon.html">story</a> under the headline &#8220;Plodders Have a Place, but Is It in a Marathon?&#8221; <a href="http://topics.nytimes.com/topics/reference/timestopics/people/m/juliet_macur/index.html?inline=nyt-per">Juliet Macur</a> writes:</p>
<blockquote><p>Purists believe that running a marathon should be just that &mdash; running the entire course at a relatively fast clip. They point out that a six-hour marathoner is simply participating in the event, not racing in it. Slow runners have disrespected the distance, they say, and have ruined the marathon&rsquo;s mystique.</p></blockquote>
<p>Thick-skinned as I am, this stings. My apologies to the purists, and to the mystique. I&#8217;ll just note that the hundreds of volunteers who put on the race in which I &#8220;participated&#8221; were marvelously supportive of us plodders. The high school students at the water stations did not abandon their posts, or lose their enthusiasm, after the fleet-footed runners passed by. And when I arrived at the finish line, hours after the winners, there were still fans applauding in the grandstand, and volunteers to wrap me in a blanket, bring me water, offer congratulations. They had been out in the rain as long as I had, and they weren&#8217;t done yet. Three cheers for them.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2009/in-the-long-run-were-all-dead/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
