<?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>Mon, 14 May 2012 16:49:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Light-field photography</title>
		<link>http://bit-player.org/2012/light-field-photography</link>
		<comments>http://bit-player.org/2012/light-field-photography#comments</comments>
		<pubDate>Mon, 14 May 2012 16:49:25 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1217</guid>
		<description><![CDATA[Beyond digital photography lies computational photography, which holds out the promise of extracting more bits from every photon. When I wrote about this idea a few years ago, I had no hands-on experience with computational cameras. The first widely available &#8220;light-field camera,&#8221; called the Lytro, was announced last fall. Mine finally arrived last week. So [...]]]></description>
			<content:encoded><![CDATA[<p>Beyond digital photography lies computational photography, which holds out the promise of extracting more bits from every photon. When I <a href="http://www.americanscientist.org/issues/pub/computational-photography">wrote about</a> this idea a few years ago, I had no hands-on experience with computational cameras. The first widely available &#8220;light-field camera,&#8221; called the <a href="http://www.lytro.com">Lytro</a>, was announced last fall. Mine finally arrived last week. So far I&#8217;ve taken only a few dozen pictures, so this is a very preliminary report. But the camera itself is a very preliminary product, so perhaps it&#8217;s appropriate to treat it as a preview of things to come.</p>
<p>Here are a couple of pictures to play with. First, <a href="http://bit-player.org/2012/statistical-mechanics-of-magnet-balls">more magnet balls</a>, with evidence that I&#8217;ve finally figured out how to stack them up in something resembling a hexagonal close-packed configuration.</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/156075/embed?token=2e7015d0-9cf1-11e1-9411-12313940809d" frameborder="0" allowfullscreen></iframe></p>
<p>And some flowers, which seem to be the front-running subject matter for Lytro photos. These are orchids at a street-corner stand, with extra inventory on display for mother&#8217;s day.</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/156512/embed?token=b396e1c4-9d11-11e1-bbbd-123139406dbd" frameborder="0" allowfullscreen></iframe></p>
<p>I trust that you&#8217;ve figured out the trick: Clicking on a point in the image refocuses on the depth of the scene at that point. (You can also double-click to zoom.)</p>
<p>How is this magic accomplished? The Stanford <a href="http://www.lytro.com/renng-thesis.pdf">doctoral dissertation</a> of Ren Ng sets forth the basic idea. Ng is the founder and CEO of Lytro Inc.</p>
<blockquote><p>This dissertation introduces a new approach to everyday photography, which solves the longstanding problems related to focusing images accurately. The root of these problems is missing information. It turns out that conventional photographs tell us rather little about the light passing through the lens. In particular, they do not record the amount of light traveling along individual rays that contribute to the image. They tell us only the <em>sum total</em> of light rays striking each point in the image. To make an analogy with a music-recording studio, taking a conventional photograph is like recording all the musicians playing together, rather than recording each instrument on a separate audio track.</p></blockquote>
<blockquote>
</blockquote>
<blockquote><p>In this dissertation, we will go after the missing information. With micron-scale changes to its optics and sensor, we can enhance a conventional camera so that it measures the light along each individual ray flowing into the image sensor. In other words, the enhanced camera samples the total geometric distribution of light passing through the lens in a single exposure. The price we will pay is collecting much more data than a regular photograph. However, I hope to convince you  that the price is  a very fair one  for a solution to a problem as pervasive and long-lived as photographic focus. In photography, as in recording music, it is wise practice to save as much of the source data as you can.</p></blockquote>
<p>So we have a radically different kind of camera here. It has a lens, but there&#8217;s no focusing ring. Focusing is left to the computational post-processing of the image.</p>
<p>The after-the-fact refocusing is most dramatic in close-up shots, with a wide ratio between the distances of near and far objects. You can see the effect by clicking around in this image of pine tree putting out some exuberant spring growth.</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/156518/embed?token=a1670e7c-9d14-11e1-9cec-123139406dbd" frameborder="0" allowfullscreen></iframe></p>
<p>The camera is capable of coming in even closer, as in this macro shot of some lichens and mosses on rocks in western Massachusetts. (The gray stalks are wo or three millimeters tall.)</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/156516/embed?token=70d42944-9d13-11e1-bbe5-12313922cd53" frameborder="0" allowfullscreen></iframe></p>
<p>Getting much of a focal range is harder when you&#8217;re dealing with more distant subjects. This was my best attempt to catch a red-wing blackbird in a marsh below Danehy Park in Cambridge.</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/156517/embed?token=4c8f40ea-9d14-11e1-a161-12313922cd53" frameborder="0" allowfullscreen></iframe></p>
<p>When you pull back even farther, the camera optics have enough depth of field that everything is in focus at once. Ordinarily, that high depth of field would be a virtue, but it strangely takes the fun out of Lytro pictures.</p>
<p><iframe width="450" height="415" src="https://pictures.lytro.com/bit-player/pictures/158233/embed?token=89c1685e-9d6d-11e1-9624-12313940809d" frameborder="0" allowfullscreen></iframe></p>
<p>The <a href="http://www.lytro.com/living-pictures/111771">gallery</a> on the Lytro web site includes lots more examples, including some classic pull-focus tricks like spider webs and raindrops on windowpanes.</p>
<p class="centered">•&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;•</p>
<p>Just a few years ago, the immediate reaction to the Lytro camera would have been: &#8220;How do you refocus after you print your pictures? You can&#8217;t click on paper.&#8221; Times change. The Lytro makes more sense in an age when people share their pictures on Facebook or Twitter instead of printing and framing them. Yet I still have misgivings about Lytro&#8217;s scheme for distributing and publishing images. The Lytro photographs displayed above are not hosted on bit-player.org, as this text is; they are embedded &lt;iframe&gt; tags, providing a window onto content hosted at lytro.com. That&#8217;s the only way I can post them here. This is an annoyance to a curmudgeonly control freak like me; I want to retain possession of my own work, as well as control its presentation.</p>
<p>There is no fundamental reason the images have to be hosted at lytro.com. The refocusing algorithms are <em>not</em> running on the Lytro servers. What&#8217;s embedded in the iframes is essentially a stack of images with different focal points, along with a Flash application that responds to clicks by displaying the appropriate image from the stack. (The use is Flash is another annoyance. Lytro evidently has a non-Flash version of the software, since the photos are viewable with Flashless devices such as the iPad, but there&#8217;s no readily accessible way to choose the non-Flash version on other platforms.)</p>
<p>The camera itself has an unconventional tubular design, but it fits the hand well enough and has a satisfying heft and solidity. The only physical controls are power, zoom and the shutter botton. The one severe problem with the camera hardware is that the viewing screen is too small (1 square inch) and too coarse; also, it&#8217;s useless in bright sunlight. Often, you can&#8217;t see what you&#8217;re about to photograph, and afterwards you can&#8217;t see what you&#8217;ve captured until you upload the image to a computer.</p>
<p>The software that runs on the computer has its own issues. For now it is  Macintosh-only; a Windows version is promised, but there&#8217;s no mention of Linux. When importing images, the software hogs the CPU, setting off a tremendous whoosh of fan noise. And once you have the images loaded into the software, there&#8217;s not actually much you can do with them, other than add metadata or send them to the Lytro web site. There are no tools for cropping, correcting colors, sharpening, etc. You can export a JPEG version, but it&#8217;s of course merely a static pixel array. (The JPEGs are 1080 by 1080 pixels, with quality in the range you&#8217;d expect from a good cell-phone camera.)</p>
<p>The full light-field photos are stored in 16-megabyte &#8220;.lfp&#8221; files, but there&#8217;s no public documentation on the format of those files. As far as I know, no software other than Lytro&#8217;s own can read the files. If there are any plans for, say, a Photoshop plugin or a software development kit, they are not discussed publicly.</p>
<p>Is the Lytro the first chapter in the future of photography, or a novelty that will fade after a year or two? I suspect the answer will depend on how quickly Lytro is able to develop and release new features for the software and new models of the camera. At the moment, what the camera offers is a single trick: focusing <em>after</em> rather than <em>before</em> you press the shutter button. It&#8217;s a neat trick, but probably not neat enough to support a whole new photographic infrastructure. The light-field technique could offer more. Lytro has promised that a future version of the software will allow control not just of focus but of depth of field, so that you can choose a version of the image in which everything is in focus at once. There are still more possibilities, even including shifting the camera&#8217;s apparent point of view after the picture is taken. But it remains to be seen whether such features can be brought to market before people lose patience or interest.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/light-field-photography/feed</wfw:commentRss>
		</item>
		<item>
		<title>Statistical mechanics of magnet balls</title>
		<link>http://bit-player.org/2012/statistical-mechanics-of-magnet-balls</link>
		<comments>http://bit-player.org/2012/statistical-mechanics-of-magnet-balls#comments</comments>
		<pubDate>Fri, 04 May 2012 21:26:52 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1212</guid>
		<description><![CDATA[They come out of the can in a gleaming 6 &#215; 6 &#215; 6 cubic crystal. It took me a day to figure out how to get them back into the can. But that&#8217;s not the deepest mystery about these curiously powerful little ferromagnetic balls.

A web search turns up lots of sites that sell the [...]]]></description>
			<content:encoded><![CDATA[<p>They come out of the can in a gleaming 6 &times; 6 &times; 6 cubic crystal. It took me a day to figure out how to get them back into the can. But that&#8217;s not the deepest mystery about these curiously powerful little ferromagnetic balls.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/05/cube-and-can-1467.jpg" alt="216 jumbo magnet balls in a cubic array" border="0" width="450" height="464" /></p>
<p>A web search turns up lots of sites that sell the magnets under various brand names, and a few more web pages that warn of their <a href="http://www.uspirg.org/blogs/blog/usp/buckyball-magnets-still-danger-children">dangers</a>. There are also videos and picture galleries of interesting<img class="alignright" src="http://bit-player.org/wp-content/uploads/2012/05/mobius-band-1465.jpg" alt="about 100 magnet balls arranged to form a Mobius strip" border="0" width="200" height="281" /> constructions, such as polyhedra or a M&ouml;bius band. But I haven&#8217;t been able to find anything on the questions that intrigue me most: For a set of <em>N</em> magnet balls, what is the ground-state configuration&mdash;the geometric arrange&shy;ment of lowest energy? How about the state of lowest <em>free energy</em>? Informally: Given a handful of magnet balls, what is the shape they most &#8220;want&#8221; to assume?</p>
<p>You can get some rough intuition about these matters by using your fingertips. Take a random clump of magnet balls and try to pull them apart. How much force do you have to apply when you tug in various directions? How does the cluster break apart? I find that the balls usually peel off in long strings of pearls, going directly from a three-dimensional aggregate to a one-dimensional chain. This behavior is not entirely surprising. After all, the magnets are dipoles, and so they can reduce their total energy by lining up north-south-north-south-north-south&#8230;. </p>
<p>Once you have a long chain, you can reduce its energy a little bit further by connecting head to tail to form a closed loop. But then, when you play around with the resulting bracelet of beads, you soon discover that the circular configuration is not at the bottom of the energy spectrum. The loop&mdash;if it&#8217;s long enough&mdash;tends to collapse on itself, with the strands on opposite sides zipping together in the middle, forming what RNA chemists would call a double-ended hairpin structure.</p>
<p><img class="aligncenter" src="http://bit-player.org/wp-content/uploads/2012/05/bracelet-and-zippered-hairpin.jpg" alt="Bracelet and zippered hairpin" border="0" width="450" height="144" /></p>
<p>Note the alignment of the beads in the zippered region: The arrangement is rectilinear, as in a square lattice. By bringing together more strands of beads, we can grow this zippered arrangement into a fully two-dimensional, planar pattern. However, when you try this experiment with half a dozen short strands, you quickly discover that there&#8217;s more than one way of combining them. The dipoles give each strand an orientation, and so adjacent chains can be either parallel or antiparallel. The rectilinear habit of the zippered loop comes from antiparallel alignments. Parallel strands assume a quite different pattern, with triangular or hexagonal symmetry. It&#8217;s the difference between Kansas and Tennessee:</p>
<p><img class="aligncenter" src="http://bit-player.org/wp-content/uploads/2012/05/kansas-and-tennessee.jpg" alt="Kansas and tennessee" border="0" width="450" height="120" /></p>
<p>It might look as though you could convert one of these arrangements into the other just by squeezing and skewing, but that&#8217;s not the case at all. If you could see the north and south poles of each ball magnet, they would look something like this:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/05/kansas-and-tennessee-dipoles.png" alt="Kansas and tennessee dipoles" border="0" width="450" height="120" /></p>
<p>Which of these arrangements lives in the deeper energy well? Kansas is stabilized by a multitude of local rectangular flux loops, which link adjacent antiparallel rows. (There may be weak longer-range attractions as well.) The parallel strands in Tennessee, in contrast, form one big global flux tube, with highly favorable interactions within the fabric of the layer but with nothing to help close the flux loops that exit one end of the state and re-enter the other.</p>
<p>Both kinds of planar sheets are happy to roll up into hollow cylinders. The resulting tubes (which can also be made by stacking rings) <img class="alignleft" src="http://bit-player.org/wp-content/uploads/2012/05/cylinders-1476.jpg" alt="hollow cylinders with rectangular and triangular symmetry in the wall fabric" border="0" width="250" height="165" />are notably sturdy, stable and stiff. More than any other structures I&#8217;ve discovered in playing with the magnet balls, the tubes seem to have the quality that Buckminster Fuller used to call <em>tensegrity</em>. The Tennessee roll-up is slightly stronger than the Kansas model. (I&#8217;ve tried constructing hemispherical endcaps for the tubes, without success.)</p>
<p>What about a fully three-dimensional, space-filling lattice? We already know about the simple cubic lattice, because that&#8217;s the configuration that comes out of the shipping container. But my attempts to build multiple layers of the hexagonal close-packed lattice have all failed. A two-layered Tennessee will not lie flat. Or, looking at it another way, magnetic cannonballs cannot be stored in the classic Keplerian heap. Even a tetrahedral pile with just four balls is violently unstable and spontaneously rearranges itself into a linear chain or a flat square.</p>
<p>Looking at all these forms, I see an analogy with carbon chemistry. [Warning: half-baked ideas ahead!] According to the analogy, the cubic lattice of magnet balls is like diamond. Not that it has the same geometry as diamond, but it is the most symmetrical arrangement, and the only one that fills three-dimensional space. The Tennessee pattern with its hexagonal symmetry is analogous to graphene or graphite&mdash;a substance that is actually more stable than diamond but has reduced symmetry. Continuing in this scheme, the Tennessee roll-up has to be a buckytube. </p>
<p class="centered">•&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;•&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;•</p>
<p>Whatever the true identity of the lowest-energy configuration, it&#8217;s a state you would expect to see emerge spontaneously only after an eternity of gradual cooling toward zero temperature. For those of us with a shorter attention span, the state of lowest <em>free energy</em> might be of greater interest. Let&#8217;s define free energy as</p>
<p class="centered"><em>A = U &ndash; TS</em></p>
<p>where <em>U</em> is the ordinary internal energy&mdash;the stuff we were trying to minimize in the paragraphs above&mdash;<em>T</em> is the temperature and <em>S</em> is entropy. In this context, temperature is not what the thermometer in the room reads. It&#8217;s a measure of how vigorously we agitate the system of balls, for example by shaking them in a box. As for the entropy, let&#8217;s think of it as counting the number of microstates per macrostate. The free-energy formula, as I understand it, implies the following: If we take random samples from a population at temperature <em>T</em>, then the configurations we&#8217;re most likely to see are those that balance the imperatives to minimize <em>U</em> and to maximize <em>S</em>. The value of <em>T</em> determines the relative weight assigned to energy and entropy.</p>
<p>I tried the obvious experiment. I put some magnet balls in a Tupperware box and shook vigorously. The result was noisy and uninformative. The magnetic forces are so strong that it would take a whole of shaking to have any observable effect. Indeed, I think the box might disintegrate before the cluster of magnet balls did.</p>
<p>So I tried a different approach. I looked at very small clusters, typically two or three balls, and watched what happened when they collided. I arranged the collisions by having the balls slide or roll down the walls of a large china bowl, meeting at the bottom. In effect, the height and steepness of the walls play the role of temperature in this procedure. Here are my notes from the first series of experiments, in which each pairing was repeated 20 times:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/05/small-clusters-of-magnet-balls-notes-p1-2012-05-04.jpg" alt="results of collisions between pairs, trios, quads" border="0" width="450" height="563" /></p>
<p>I thought I noted a bias toward small, open rings. To explore this possibility a little further, I tried colliding individual balls with progressively larger rings or ringlike clusters.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/05/collisions-of-single-balls-with-small-rings-generally-making-larger-rings.jpg" alt="Collisions of single balls with small rings generally making larger rings" border="0" width="450" height="577" /></p>
<p>These results also suggested a preference for symmetrical <em>n</em>-gons, especially pentagons and hexagons, with diminishing effects as <em>n</em> gets smaller than 5 or larger than 6. Again it&#8217;s tempting to interpret the results in light of organic chemistry, where the bond angles of carbon atoms favor 5- or 6-member rings (cyclopentane, cyclohexane, benzene); smaller rings are very hard to make, while larger ones are floppy and fragile.</p>
<p>But perhaps I&#8217;m a little too eager to believe these chemical analogies. After all, when you start with ring-shaped ingredients, you might expect to get ring-shaped products. Here&#8217;s what I saw after colliding various small linear chains:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/05/products-of-collisions-of-linear-molecules-450.jpg" alt="Products of collisions of linear molecules 450" border="0" width="450" height="600" /></p>
<p>The preference for rings has largely disappeared; noncyclic clusters predominate. Bashing together five-bead strands produces quite a zoo of exotic shapes, hinting at still more diversity as the size of the molecules increases.</p>
<p>Performing these experiments is tedious, and the results are probably not trustworthy. When dumping balls into a bowl, many factors are hard to control, and some of them cannot easily be randomized either. An important example is the impact geometry when two chains meet in a collision. Coming together end-to-end might well produce a different outcome than meeting broadside. </p>
<p>Rather than work on refining my experimental techniques, I would like to try simulating the system. Doing all this inside a computer allows for greater control, better statistics and better randomness; besides, we can do some tricks that would be difficult in the physical world, such as turning magnetism on and off whenever it&#8217;s convenient. However, creating an accurate simulation looks difficult and messy. Magnetic forces are harder to calculate than the simple inverse-square-law forces of most <em>n</em>-body simulations. Moreover, the program might also have to include friction and angular momentum. (Some clusters of beads can roll, whereas others slide.)</p>
<p>I&#8217;ve been able to find just one example of such a program, mentioned in a <a href="http://www.physicsforums.com/showthread.php?p=3866527">thread at Physics Forum.</a> Perhaps there are others. </p>
<p>I have the persistent sense that I am retracing the footsteps of others, but I have not been able to spot their tracks. The arXiv, the <em>American Journal of Physics</em> and the IOP journals all seemed like good prospects, but my searches have come up empty. I&#8217;ll be grateful for any pointers. </p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/statistical-mechanics-of-magnet-balls/feed</wfw:commentRss>
		</item>
		<item>
		<title>Kepler&#8217;s snowflake</title>
		<link>http://bit-player.org/2012/keplers-snowflake</link>
		<comments>http://bit-player.org/2012/keplers-snowflake#comments</comments>
		<pubDate>Sat, 28 Apr 2012 22:39:32 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1183</guid>
		<description><![CDATA[The Kepler conjecture&#8212;the one about stacking cannonballs or oranges&#8212;is now the Hales theorem, though with a cruelly lingering asterisk. Thomas C. Hales announced his proof in 1998, and it was published in 2005 and 2006 (links). But the referees were unable to fully verify all the details, including some 5,000 nonlinear optimization problems solved by computer. Hales has [...]]]></description>
			<content:encoded><![CDATA[<p>The Kepler conjecture&#8212;the one about stacking cannonballs or oranges&#8212;is now the Hales theorem, though with a cruelly lingering asterisk. Thomas C. Hales announced his proof in 1998, and it was published in 2005 and 2006 (<a href="https://sites.google.com/site/thalespitt/kepler-conjecture">links</a>). But the referees were unable to fully verify all the details, including some 5,000 nonlinear optimization problems solved by computer. Hales has continued to work on refinements to the proof, both simplifying the arguments and exploring formal methods of verification. </p>
<div class="fig-and-cap-left" style="width: 225px;"><img src="http://bit-player.org/wp-content/uploads/2012/04/johannes-kepler-1610-225px.jpg" alt="Johannes Kepler 1610 225px" width="225" height="309" border="0" /></p>
<p class="figure-caption">Johannes Kepler in 1610, an age of fanciful extravagance in collars and mustaches; from <a href="http://en.wikipedia.org/wiki/File:Johannes_Kepler_1610.jpg">Wikipedia</a>.</p>
</div>
<p>Over the years I&#8217;ve read parts of Hales&#8217;s proof, but I realized the other day that I had never looked at Johannes Kepler&#8217;s much earlier contribution to this discussion. It turns out that Kepler&#8217;s essay on the subject is a little gem, an amiable work by an affable fellow, showing a lively mind at play. The conjecture appears in <em>The Six-Cornered Snowflake</em>, a pamphlet pub&shy;lished in 1611 and offered as a New Year gift to Johann Matth&auml;us Wacker von Wackenfels, who was then Kepler&#8217;s patron. Apparently Wacker was more than a moneybags; he had studied law in Strasbourg and Geneva, took a doctoral degree in Padua, and had literary interests. Kepler&#8217;s essay includes a lot of learned banter addressed to Wacker, suggesting the two men may have been genuine friends. Some of the jokes involve bilingual puns&#8212;Latin and German.
</p>
<p>Kepler&#8217;s main subject, as you might well guess from his title, is the hexagonal symmetry of snowflakes. He writes:</p>
<blockquote>
<p>There must be some definite cause why, whenever snow begins to fall, its initial formations invariably display the shape of a six-cornered starlet. For if it happens by chance, why do they not fall just as well with five corners or with seven? Why always with six&#8230;?</p>
</blockquote>
<p><img class="alignright" src="http://bit-player.org/wp-content/uploads/2012/04/kepler-hexagons2.png" alt="Kepler hexagons" border="0" width="200" height="344" />
<p>The idea we now know as the Kepler conjecture is introduced in one of several speculative attempts to solve this puzzle. Kepler describes the familiar stack-of-cannonballs geometry for packing spheres and then makes a bold claim about it, phrased not as a conjecture but as a fact that stands on its own, without need of demonstration: &#8220;The pack&shy;ing will be the tightest possible, so that in no other arrangement could more pellets be stuffed into the same container.&#8221; The only alter&shy;native he considers is the simple cubic lattice. He does not calculate the actual density of either lattice (\(\pi/\sqrt{18}\) <em>vs.</em> \(\pi/6)\). In the woodcut above, Kepler deconstructs a tetrahedral heap of 35 spheres into five horizontal layers; he clearly understood that the packing could be extended throughout an unbounded volume of space.</p>
<p>From the cannonball packing, Kepler passes on to other themes, including the arrangement of seeds in a pomegranate, the hexagonal cells of honeycombs and the symmetries of flowers (often fivefold); this last subject presents an opportunity for a further digression on the golden ratio and the Fibonacci numbers. But when Kepler finally returns to the snowflake, none of these ideas offers much help, and he is left with still more questions:</p>
<blockquote><p>I will grant that, as flakes fall from above through steamy air, some incrustation on the plumes can occur from the vapor that comes in contact with them. But why at six points? What is the origin of the number six? Who carved the nucleus, before it fell, into six horns of ice? What cause is it that prescribes in that surface, which is now in the very act of condensing, six points in a circle for six prongs to be welded to them?</p>
</blockquote>
<p>At this point Kepler comes up with a charming and highly creative idea, which also happens to be utterly preposterous. He proposes that snowflakes have six points because space has three dimensions:</p>
<blockquote><p>While these starlets are falling, they consist of three feathered diameters, joined crosswise at one point, with their six extremities equally distributed in a sphere; consequently they fall on only three of the feathered prongs, and tower aloft with the remaining three, opposite those on which they fall, on the same diameters prolonged, until those, on which they rested, buckle, and the remainder, until then upright, sag onto the level in the gaps between them.</p>
</blockquote>
<p>In other words, a pristine snowflake is not a planar hexagonal shape but a three-dimensional structure rather like a toy jack, with components aligned along three Cartesian coordinate axes. The flake collapses into a flat, six-pointed configuration only when it falls to earth. According to this theory, the number six is not something arbitrary or accidental but a direct consequence of the way the universe is put together. </p>
<p>Kepler did not have the vocabulary of Cartesian coordinate systems to describe his idea&#8212;Descartes would not invent it until 20 years later, incidentally after reading <em>The Six-Cornered Snowflake</em>&#8212;and so Kepler had to adopt a more roundabout description:</p>
<blockquote><p>But is this perhaps the cause of the three diameters, that there is the same number of dimensions in animals? After all they have upper and lower parts, front and back, left and right.</p>
</blockquote>
<p>Almost half of Kepler&#8217;s essay is given to the defense of this three-dimensional hypothesis, and then, at the end, all of his speculation is spoiled by a conflict with cold, wet reality:</p>
<blockquote><p>For as I write it has again begun to snow, and more thickly than a moment ago. I have been busily examining the little flakes. Well, they have been falling, all of them, in radial pattern, but of two kinds: some very small with prongs inserted all the way round&#8230; But scattered among them were the rarer six-cornered starlets of the second kind, and not one of them was anything but flat, whether it was floating or coming to earth, with the plumes in the same plane as their stem.</p>
</blockquote>
<p>In the end Kepler abandons his inquiry without reaching any conclusion. He throws the problem out for the chemists and physicists to solve&#8212;which they did, three centuries later.</p>
<p>Scientific discourse has changed a great deal in the past 400 years. When Hales wrote up his proof of the Kepler conjecture, he did not include jocular asides to his program officer at the National Science Foundation. And we don&#8217;t see a lot of published papers these days that end with the admission, &#8220;I have not yet got to the bottom of this.&#8221; The <a href="http://www.keatsian.co.uk/negative-capability.htm">negative capability</a> that Kepler embraces is part of what makes his essay so appealing.</p>
<p>I read the Kepler essay in an edition published in 1966, which prints the Latin text and an English translation on facing pages:</p>
<p class="biblio">Kepler, Johannes. 1966. <em>The Six-Cornered Snowflake</em>. Edited and translated from the Latin by Colin Hardie, with essays by L. L. Whyte and B. F. J. Mason. Oxford, U.K.: Oxford University Press.</p>
<p>There&#8217;s also a more recent edition, which I have not seen,  from a small publishing house in Philadelphia:</p>
<p class="biblio">Kepler, Johannes. 2010. <em>The Six-Cornered Snowflake</em>. Translation by Jacques Bromberg, with essays by Owen Gingerich and Guillermo Bleichmar. Philadelphia, Penna.: <a href="http://pauldrybooks.com/mm5/merchant.mvc?Screen=PROD&#038;Store_Code=PDB&#038;Product_Code=214&#038;Category_Code=PM">Paul Dry Books</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/keplers-snowflake/feed</wfw:commentRss>
		</item>
		<item>
		<title>World3, the video</title>
		<link>http://bit-player.org/2012/world3-the-video</link>
		<comments>http://bit-player.org/2012/world3-the-video#comments</comments>
		<pubDate>Sun, 15 Apr 2012 18:03:08 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<category><![CDATA[social science]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1176</guid>
		<description><![CDATA[Still more on World3 and The Limits to Growth. Two weeks ago I gave a talk at Harvard on all this, and the video is now online. Look for the Brian Hayes&#8211;March 30 link near the bottom of the page.
The slides are here.
And, by the way, the slides were done with deck.js, a JavaScript-and-HTML framework [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bit-player.org/2012/world3-the-public-beta">Still more</a> on World3 and <em>The Limits to Growth</em>. Two weeks ago I gave a talk at Harvard on all this, and the <a href="https://www.seas.harvard.edu/news-events/video/iacs-seminar-series">video is now online</a>. Look for the Brian Hayes&ndash;March 30 link near the bottom of the page.</p>
<p>The slides are <a href="http://bit-player.org/deck.js/limits-to-growth-Harvard-2012-03-30/ltg-talk.html">here</a>.</p>
<p>And, by the way, the slides were done with <a href="http://imakewebthings.com/deck.js/">deck.js</a>, a JavaScript-and-HTML framework I had never tried. Both preparing the slides and presenting them went very smoothly. Running the talk from within a browser has obvious advantages when you&#8217;re talking about Internet things; you don&#8217;t have to break out of Powerpoint or Keynote to go to a web page. Using Mathjax for TeX stuff is effortless. So is posting your slides on the web. On the other hand, navigation may not be obvious at a glance. Use the arrow keys. The M and G keys also do helpful things.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/world3-the-video/feed</wfw:commentRss>
		</item>
		<item>
		<title>World3, the public beta</title>
		<link>http://bit-player.org/2012/world3-the-public-beta</link>
		<comments>http://bit-player.org/2012/world3-the-public-beta#comments</comments>
		<pubDate>Sun, 15 Apr 2012 13:51:20 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1172</guid>
		<description><![CDATA[Forty years ago I had my first close encounter with mathematical models of doomsday. The Limits to Growth, published in the spring of 1972, offered a grim vision of environmental and economic collapse, based on the implacable logic of a computer simulation called World3. For extra nerd-cred authenticity, the results of the simulation were set [...]]]></description>
			<content:encoded><![CDATA[<p>Forty years ago I had my first close encounter with mathematical models of doomsday. <em>The Limits to Growth</em>, published in the spring of 1972, offered a grim vision of environmental and economic collapse, based on the implacable logic of a computer simulation called World3. For extra nerd-cred authenticity, the results of the simulation were set forth in crude black-and-white graphs reproduced directly from line-printer output.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/std-run-ascii-infographics.png" alt="ASCII infographics from The Limits to Growth" border="0" width="450" height="452" /></p>
<p>I <a href="http://bit-player.org/bph-publications/AmSci-1993-11-Hayes-Limits-to-growth.pdf">wrote about</a> <em>The Limits to Growth</em> and World3 back in 1993. Now I have revisited the subject in my <a href="http://www.americanscientist.org/issues/pub/computation-and-the-human-predicament">newly published <em>American Scientist</em> column</a>. Buried deep within the new column is a note mentioning that I&#8217;ve been working to re-implement the World3 model in JavaScript. &#8220;The result of this exercise is at <a href="http://bit-player.org/limits">http://bit-player.org/limits</a>,&#8221; the column says.</p>
<p>If you follow that link, you&#8217;ll find it&#8217;s true: There&#8217;s a rudimentary version of the model you can play with (if you have the right browser).</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/world3js-screen-grab.png" alt="Screen image of the JavaScript Wortld3 model" border="0" width="450" height="406" /></p>
<p>But I have to tell you, it was a near thing. When the magazine was shipped to the printers three weeks ago, the program was unfinished. Two weeks ago, it was finally running but giving weird results. A week ago the output was still nonsense. Since then I&#8217;ve had more anxious moments, late nights, and occasions to ponder the foolishness of publicly announcing vaporware. For a while it looked like I might have to admit defeat and write a sheepish apology for promising something I couldn&#8217;t deliver. Never again, I said to myself. And yet, when it&#8217;s all over, I get such a kick out of building a thing like this.</p>
<p>Herewith a few notes, mostly technical, on the building process.</p>
<p><strong>What the model models</strong>. For background on World3&#8212;where the project came from, who did it, and whether you should worry about the model&#8217;s bleak predictions&#8212;please see either of my columns. Very briefly, the model traces interactions among five main components of the global ecosystem and economy: the human population, agriculture, industry, nonrenewable resources and pollution. If you could strip the model down to its mathematical essentials, it would be a system of coupled differential equations, something like the Lotka-Volterra equations for predator-prey populations. But the model is actually formulated in the language of &#8220;system dynamics,&#8221; a simulation methodology invented in the 1950s by Jay W. Forrester of MIT, with heavy influence from control theory and servomechanisms. </p>
<p>The key elements of a system dynamics  model are represented by <em>levels</em> and <em>rates</em>, or less formally <em>vats</em> and <em>valves</em>. Here&#8217;s the population section of the World3 model:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/levels-and-flows.png" alt="vats and valves in the population section of the World3 model" border="0" width="450" height="186" /></p>
<p>The orange rectangles are levels, which integrate the inflow and outflow of people. The rates of flow are determined by the valves, represented here as hourglass-shaped icons (a graphic device borrowed from control theory and industrial engineering). </p>
<p><strong>Twiddling the knobs</strong>. If you go and play with the model, most of the controls should be pretty obvious. The original World3 model extended over 200 years, from 1900 to 2100; the <em>model duration</em> slider can extend the horizon out to 2400. The <em>time step</em> slider controls the integration interval (the variable <em>dt</em> within the model); if you set it to a value greater than 1 year, you&#8217;re likely to see spurious short-period oscillations caused by undersampling. The <em>initial resources multiplier</em> affords control over a variable that turns out to be crucial in determining the fate of World3. Note that the resources curve in the graph shows the fraction of resources remaining, so it always begins at the same initial value; the slider setting effectively determines the rate of depletion. The final slider, <em>output consumed</em>, provides access to another variable that can greatly alter the outcome of the simulation. This quantity is the fraction of industrial output that is diverted into consumption, defined as anything nonproductive; the output <em>not</em> consumed is reinvested in agriculture, industry and the extraction of natural resources. High consumption acts as a damping or friction term, curtailing the positive feedbacks that lead to much of the future unpleasantness in the model. As I snidely commented in 1993: &#8220;The model seems to be telling us to invest less in farms and factories and to spend more on frippery and fast cars. Armaments also fall into the category of nonproductive spending, so perhaps we need a good vigorous war every few decades.&#8221;</p>
<p><strong>A few snapshots of model behavior</strong>. My purpose in writing this program was not really to explore the behavior of the World3 model; for that there are several more versatile and more trustworthy implementations out there (<a href="http://live.simgua.com/World">including at least one that runs within a web page</a>). I just wanted to understand what&#8217;s inside the box. Nevertheless, now that the model is running, I may as well point out a few of its tricks.</p>
<p>Here&#8217;s the spurious oscillation mentioned above, with <em>dt</em> = 2:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/aliasing.png" alt="spurious oscillations caused by setting the integration interval to too large a value" border="0" width="450" height="253" /></p>
<p>A quite different kind of oscillation appears when the initial stock of natural resources is set to a very high value (32&times;):</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/150-year-oscillations.png" alt="oscillations with a period of about 150 years, observed when the resource base is very large" border="0" width="450" height="250" /></p>
<p>These oscillations, with complex waveforms and a period of roughly 150 years, are <em>not</em> caused by integration error but probably represent a natural behavioral mode of the model itself (analogous to the population cycles seen in predator-prey models).</p>
<p>We get a much calmer vision of the future by setting the consumption fraction to 0.51, rather than the World3 default of 0.43:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/high-consumption.png" alt="Setting consumption to a higher value tames the overshoot phenomenon" border="0" width="450" height="252" /></p>
<p>Siphoning off some of the capital that would otherwise fuel rapid growth tames the overshoot-and-collapse regime of the standard run. However, the outcome is hardly utopian. Life expectancy and food per capita remain permanently low; so does industrial output, which can be taken as a proxy for wealth.</p>
<p><strong>Putting World3 in a web browser</strong>. The original World3 model ran on mainframe hardware&#8212;IBM 360 and 370 machines. Now it fits into a web browser on a laptop or an iPad. I try to keep my <em>sang froid</em> about such things, but the fact is I&#8217;m just plain astounded by the march of progress.</p>
<p>I should emphasize that the entire JavaScript computation is happening on <em>your</em> computer, not my server. The program is downloaded once and then executed locally each time you press the <em>Run</em> button. And it&#8217;s not even much of a computational burden. The gradual unfolding of the graphs across the years is a deliberate animation effect, not a reflection of actual computation speed. (The <em>Run Fast</em> button is meant to eliminate artificial delays, but it doesn&#8217;t quite achieve that yet.)</p>
<p><strong>DYNAMO and toposorting</strong>. The 1972 version of World3 was written in a language called DYNAMO, created a decade earlier by Phyllis Fox and Alexander Pugh, who were then part of Forrester&#8217;s group at MIT. In lexical and syntactic structure DYNAMO is what you&#8217;d expect of a language from the punch-card era&#8212;six-letter variable names and ALL CAPS&#8212;but in other respects it&#8217;s an interesting early experiment, with a programming style that falls somewhere between procedural and declarative.</p>
<p>One feature is particularly noteworthy. In DYNAMO a model is defined by a set of &#8220;equations&#8221; (really assignment statements) that can be written down in any order but have to be executed in a sequence that takes into account the way one equation depends on others, so that every variable is evaluated before it is used. The DYNAMO compiler reordered the equations automatically. This was an early application of <a href="http://en.wikipedia.org/wiki/Topological_sorting">topological sorting</a>; the first efficient algorithms for this process were developed circa 1960, in connection with PERT project-scheduling methods.</p>
<p>Topological sorting takes a directed graph and reduces it to a linear list of nodes satisfying the following constraint: If the graph includes a directed edge <em>u</em> &rarr; <em>v</em>, then <em>u</em> appears before <em>v</em> in the list. This ordering is possible only if the graph is acyclic, with no loops of directed edges. As it happens, the network of equations for the World3 model is <em>not</em> acyclic. Here&#8217;s one section of the network that violates the no-loops rule:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/causal-loop-marked.png" alt="Causal loop marked" border="0" width="450" height="358" /></p>
<p>If you try to assign a value to Labor Utilization Fraction (near the upper left), you&#8217;ll see that you first have to know the value of Jobs; before you can evaluate Jobs, you need to know Potential Jobs in Service Sector; etc. Continuing to trace through the red arrows reveals that before you can calculate Labor Utilization Fraction, you need to know Labor Utilization Fraction. Uh oh. The model can be made computable only by artificially interrupting such loops. In this instance the break is made by assigning an arbitrary initial value to the variable Labor Utilization Fraction Delayed.</p>
<p><strong>From DYNAMO to JavaScript</strong>. In <a href="http://leml.asu.edu/jingle/Web_Pages/EcoMod_Website/Readings/SD+STELLA/Forrester-Begin'g-SD_1989.pdf">a 1989 memoir</a>, Forrester tells this story about the origins of system dynamics:</p>
<blockquote><p>An expert computer programmer, Richard Bennett, worked for me when I was writing the 1958 article, &#8220;Industrial Dynamics&mdash;A Major Breakthrough for Decision Makers,&#8221; for the <em>Harvard Business Review</em>…. For that article I needed computer simulations and asked Bennett just to code up the equations so we could run them on our computer. However, Dick Bennett was a very independent type. He said he would not code the program for that set of equations but would make a compiler that would automatically create the computer code.</p></blockquote>
<p>Bennett&#8217;s policy in this matter was sensible and wise; I foolishly ignored it. I didn&#8217;t want a general-purpose compiler for system-dynamics models; I just wanted to implement this particular model. So I didn&#8217;t bother to structure the code in a way that would separate the model equations from the algorithms that process those equations. Big mistake.</p>
<p>My original plan was to write a prototype version in Lisp (my native tongue) and then redo it in JavaScript for wider distribution. I abandoned that idea when I ran short of time&#8212;another mistake. I was ignoring a <a href="http://en.wikiquote.org/wiki/Fred_Brooks">Brooksism</a>: Plan to throw one away; you will anyhow. The program now running is the one I need to throw away. The code is a mess. Please avert your eyes.</p>
<p>I don&#8217;t blame JavaScript for this situation. This is the third Javascript project I&#8217;ve taken on in the past few months, and I&#8217;m finding the whole ecosystem&#8212;JavaScript itself plus HTML5 and CSS3, along with the developer tools built into Google Chrome&#8212;quite a pleasant place to work and play. </p>
<p>My basic strategy was to make a line-for-line translation of DYNAMO statements into JavaScript. A typical DYNAMO equation looks like this:</p>
<p class=centered><code>SC.K = SC.J + (DT)(SCIR.JK - SCDR.JK)</code>.</p>
<p>SC is service capital, a level (or vat) variable; SCIR and SCDR are rate (or valve) variables representing the service capital investment rate and the service capital depreciation rate; DT is the numerical integration period; juxtaposed parentheses indicate multiplication. And what about the appended letters J, K and JK? They are &#8220;timescripts&#8221;: J designates the previous moment, K the current moment and JK the interval between J and K. All this notation carries over into JavaScript with remarkably little fuss. If we represent a variable such as SC as a JavaScript object, the timescript notation is unchanged, with SC.J and SC.K denoting properties of the object SC.</p>
<p>Apart from transcribing the equations, it&#8217;s also necessary to provide half a dozen special operations such as smoothing, delaying and clipping signals. And there is a kludgy &#8220;table&#8221; facility for piecewise linear approximations of arbitrary functions.</p>
<p><strong>Canvas vs. SVG</strong>. My <a href="http://bit-player.org/2012/pdf-vs-html">last JavaScript project</a> used Scalable Vector Graphics, so for this one I decided to try the main alternative, the HTML &#8220;canvas&#8221; element. Drawing on the canvas is very fast, but that&#8217;s about the only nice thing I can find to say about it. The canvas is simply a rectangular array of pixels, and drawn objects have no structure apart from the pixels that compose them. The curves making up a World3 graph cannot be moved or rescaled or otherwise altered without redrawing the entire graph. The animation effect, in which all the curves seem to gradually elongate, is an illusion: At each time step the entire curve is redrawn from the beginning. Thus drawing a curve of 400 segments actually calls for 80,200 operations.</p>
<p>SVG offers friendlier facilities. Not only can you draw objects piece by piece, but the objects retain their identity as objects; they become part of the DOM, the document object model. You can address them individually, change their colors and other properties, transform their geometry. It would be easy, for example, to highlight and label a curve on mouseover.</p>
<p><strong>Firefox is the new Internet Explorer</strong>. (But so is the new Internet Explorer.) Making stuff for the web has become a lot more fun in the past year or two, thanks in large measure to the <a href="http://www.whatwg.org/">WHATWG</a> process. There&#8217;s an accelerated pace of change in the standards community, and browser makers have been quickly implementing the latest proposals. For this project I needed not only the canvas element but also the &#8220;range&#8221; input element, which is supposed to create a slider-type control widget. In the Chrome, Safari and Opera browsers both of these components worked out of the box. Missing from that list of compatible browsers is Internet Explorer&#8212;the perennial Think Different browser. Also missing is Firefox, which is a little more surprising. It turns out that sliders have been <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=344618">on the agenda</a> of the Firefox development crew for six years, but they remain unimplemented.</p>
<p>With mixed feelings, I installed a <a href="https://github.com/fryn/html5slider">polyfill</a> that allows the slider code to run in Firefox. (Thanks Frank Yan!) My feelings are mixed because this sort of <a href="http://www.2ality.com/2011/12/shim-vs-polyfill.html">spackling</a> does nothing to encourage the Firefox developers to address the problem.</p>
<p><strong>The big bug</strong>. Getting the program to the point where it would run at all was a tedious chore (150 equations to be retyped from a marginally legible printout), but was otherwise unremarkable. After I fixed a few typos and misplaced semicolons, the code compiled and ran without throwing error messages. Then the real challenge began. The output looked nothing like the graphs published in <em>The Limits to Growth</em>. My World3 was a much nicer place, with gradual population growth and a slow but steady gain in industrial output and food production. Try as I might, I could not get the world system to collapse in ruins the way it&#8217;s supposed to.</p>
<p>This went on for more than a week.</p>
<p>Yes, I did consider the possibility that my program was correct and the dozens of other implementations over the past 40 years were all wrong. But I&#8217;m not <em>quite</em> that much of an egomaniac.</p>
<p>What was the bug that caused me so much grief? JavaScript experts will see the error immediately. In one of those initialization routines needed to break a cycle in the graph of dependencies, I had written something like this:</p>
<p class=centered><code>if (typeof(v) == Number) { return v }</code>.</p>
<p>The problem is that <code>(typeof(v) == Number)</code> will return <code>false</code> no matter what the type of <code>v</code> happens to be. If <code>v</code> is <em>not</em> a number, the predicate is obviously false. If <code>v</code> <em>is</em> a number, the result of <code>typeof(v)</code> is not <code>Number</code> but <code>"number"</code>. As a Lisp guy, I just can&#8217;t get used to JavaScript&#8217;s stringiness. (I could have said <code>(v.constructor == Number)</code>, but I didn&#8217;t.)</p>
<p><strong>Glitches</strong>. Given this evidence of my slapdash coding and testing practices, it&#8217;s fair to ask how many bugs infest the rest of the program and whether any of the results should be trusted.</p>
<p>An obvious validation strategy is to set all parameters to default values and then compare the output of the program with that of the original 1972 model. That&#8217;s not so easy. The graphs published in <em>The Limits to Growth</em> have no numerical scales (apart from markers for the endpoints of the time axis). Hence all I can do is check that the peaks and valleys have the right phase relationships. My eyeball says most of them match reasonably well, but this methodology does not inspire great confidence.</p>
<p>Some smaller-scale features of the curves also demand attention.</p>
<p>One conspicuous oddity is <em>not</em> a bug&mdash;or at least not <em>my</em> bug. Take a look at this detail of a graph of population <em>(orange)</em>, birth rate <em>(yellow)</em>, death rate <em>(purple)</em> and life expectancy <em>(gray)</em>:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/04/glitch-in-1940.png" alt="Glitch in 1940" border="0" width="450" height="263" /></p>
<p>It looks like something really strange happened in 1940. And in World3 something did: There&#8217;s an abrupt switch between two table functions, changing the effect of health services on lifespan. The death rate plunges; there&#8217;s a brief blip in the birth rate; life expectancy ratchets upward and then keeps growing steadily. The abruptness of the transition looks highly unrealistic, but this is not the result of a programming error. It&#8217;s part of the model specification. </p>
<p>On the other hand, the little blips in the birth and death curves at the very start of the simulation are <em>not</em> part of the model specification. I think I understand where they come from: It&#8217;s an initialization problem. The initial birth and death rates are not in equilibrium with other elements of the model, and it takes several iterations to eliminate the imbalances. As far as I can tell, however, these glitches do not appear in the 1972 output, so I must have misunderstood something about the model structure or the initialization procedure. I&#8217;m still looking into it.</p>
<p>It&#8217;s in the nature of writing software&#8212;or writing English prose, for that matter&#8212;that as soon as you finish a project, you see all the mistakes and missed opportunities with great clarity, and you feel that if you could just start over and do it all again, you&#8217;d finally get it right. I&#8217;m feeling that impulse right now, and I may act on it. But in light of my recent experience, I&#8217;m not making any promises.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/world3-the-public-beta/feed</wfw:commentRss>
		</item>
		<item>
		<title>Painting the world with pixels</title>
		<link>http://bit-player.org/2012/painting-the-world-with-pixels</link>
		<comments>http://bit-player.org/2012/painting-the-world-with-pixels#comments</comments>
		<pubDate>Sun, 04 Mar 2012 17:09:49 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1160</guid>
		<description><![CDATA[You are guiding your cart down the aisles of the supermarket when the price tag on the Cheerios beckons to you. Literally. An animated figure on the shelf tag waves and signals for you to come closer. When the array of cameras embedded in the shelf gets a better look at you, the tag offers [...]]]></description>
			<content:encoded><![CDATA[<p>You are guiding your cart down the aisles of the supermarket when the price tag on the Cheerios beckons to you. Literally. An animated figure on the shelf tag waves and signals for you to come closer. When the array of cameras embedded in the shelf gets a better look at you, the tag offers you a deal, lowering the posted price. Enjoy your breakfast.</p>
<p>This fantasy of &#8220;dynamic pricing&#8221; is not a product of my own fevered imagination. I heard about it the other day at the March meeting of the American Physical Society, in a <a href="http://meetings.aps.org/Meeting/MAR12/sessionindex2/?SessionEventID=167000">session</a> on reflective color displays. Animated and interactive price tags were suggested as a motivating application for this technology. According to a speaker from Hewlett-Packard, the other components of the personalized pricing system (the cameras, the image-processing software, the communications network) are already available or soon will be; the main constraint is the display, which needs to provide reasonable image quality (comparable to newspapers) at low cost and low power. HP is at work on meeting this need (and so are several other companies and research groups). For some details of the Hewlett-Packard work, see <a href="http://www.hpl.hp.com/techreports/2011/HPL-2011-67.pdf">this technical report</a>.</p>
<p>I yield to no one in my technophilic ardor, but I have to say that the prospect of animated, haggling grocery-store price tags does not fill me with yearning for the future. And I suspect the idea might meet with a certain amount of legal and social resistance. (What are the acceptable criteria for adjusting prices offered to a given customer? Age? Gender? Race?)</p>
<p>But if the underlying display technology succeeds&#8212;and the demos already look pretty impressive&#8212;it&#8217;s not just price tags that I worry about. We could find ourselves up to our eyeballs in pixels. The aim is to manufacture the display material by a high-volume, roll-to-roll process. If they can get the cost down to $100 per square meter, a supermarket shelf tag might cost a dime or a quarter, a bumper sticker would be a dollar or two, an advertising card in the subway might be worth $10, and a billboard by the highway $20,000. Wrapping an entire Wal-Mart in digital ads could be done for roughly $1 million. Each of these surfaces would present a moving, video-like image&#8212;a window onto another world, covering up some fraction of this one.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/03/positively-no-signs-sign.jpg" alt="Sign reading "Positively no signs are to be placed on this property"" border="0" width="450" height="416" /></p>
<p><small class="wp-caption-text">Opelousas, La., 14 January 2001</small></p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/painting-the-world-with-pixels/feed</wfw:commentRss>
		</item>
		<item>
		<title>Security theater on the web</title>
		<link>http://bit-player.org/2012/security-theater-on-the-web</link>
		<comments>http://bit-player.org/2012/security-theater-on-the-web#comments</comments>
		<pubDate>Sat, 03 Mar 2012 21:33:06 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1157</guid>
		<description><![CDATA[
Perhaps the most important security concept within modern browsers is the idea of the same-origin policy. The principal intent for this mechanism is to make it possible for largely unrestrained scripting and other interactions between pages served as a part of the same site (understood as having a particular DNS host name, or part thereof), [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<blockquote><p>Perhaps the most important security concept within modern browsers is the idea of the same-origin policy. The principal intent for this mechanism is to make it possible for largely unrestrained scripting and other interactions between pages served as a part of the same site (understood as having a particular DNS host name, or part thereof), whilst almost completely preventing any interference between unrelated sites.</p></blockquote>
<p>That&#8217;s Michal Zalewski of Google, in his <a href="http://code.google.com/p/browsersec/wiki/Part2">Browser Security Handbook</a> (now also available in expanded form as a book, <a href="http://lcamtuf.coredump.cx/tangled/"><em>The Tangled Web</em></a>). I had thought I understood the same-origin policy, both how it works and what it&#8217;s for. Turns out I was totally wrong about the how-it-works part&#8212;about how the policy is enforced by the browser. Now that I&#8217;ve been straightened out on that point, I&#8217;m more confused than ever about the purpose of the policy.</p>
<p>This uncomfortable episode in my education began with <a href="http://bit-player.org/2012/the-knowl-post">my post about knowls</a>, the little drawers full of knowledge that I look upon as a step toward footnotes on the web. In that article I pointed out a problem with the concept of a &#8220;knowlpedia,&#8221; a public repository of knowls: the same-origin policy won&#8217;t allow a web page loaded from one server to incorporate HTML content from another server. Thus when you are reading a web page hosted at bit-player.org, code within that page can freely access knowls that are also stored at bit-player.org, but it cannot retrieve knowls from aimath.org.</p>
<p>Harald Schilly, the author of the knowl code, wrote back that he had a one-line fix for the same-origin problem. The one line is &#8220;Access-Control-Allow-Origin: *&#8221;; it&#8217;s an HTTP header to be returned by the server of the &#8220;foreign&#8221; content. I was skeptical of this solution. In fact, I was absolutely certain it could not work. Let me explain why.</p>
<p>If a web browser is going to prevent illicit cross-site communication, how can it do so? Easy! Your browser knows the origin of the page you&#8217;re looking at right now: It came from http://bit-player.org:80 (where &#8220;http&#8221; designates the Hypertext Transport Protocol, &#8220;bit-player.org&#8221; is the host name, and &#8220;80&#8243; is the port number). If code within this page tries to access foreign HTML&#8212;say by requesting a knowl at http://aimath.org:80&#8212;the browser detects the mismatched host names and refuses to allow the request. I had always assumed that in a case like this the requesting packets are never sent from your computer to the foreign server. That&#8217;s why I was so sure that no amount of fiddling with server configurations could have any effect on the same-origin policy, because the request would be blocked long before it reached the server.</p>
<p>This was my mental model of same-origin enforcement, and it still strikes me as the most efficient, sensible and even obvious solution. However, the model is totally wrong. Browsers do <em>not</em> block a request that violates the cross-origin rules. The browser merrily sends the request to the foreign server, awaits the response, and then dumps the content of the response without inserting it into the displayed document or otherwise showing it to the user. This behavior seems so pointless and wasteful, and possibly risky, that I had to confirm for myself that it really happens. It&#8217;s not hard to do so. The debugging tools built into modern browsers will show you the headers of each request and response. Here&#8217;s what Firefox reports when I try to get a knowl from aimath.org:</p>
<blockquote>
<pre><strong>Request headers:</strong>
Accept:text/html, */*; q=0.01
Accept-Encoding:gzip, deflate
Accept-Language:en-us,en;q=0.5
Connection:keep-alive
DNT:1
Host:aimath.org
Origin:http://bit-player.org
Referer:http://bit-player.org/2012/the-knowl-post
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac
     OS X 10.7; rv:10.0.2)
     Gecko/20100101 Firefox/10.0.2

<strong>Response headers:</strong>
Accept-Ranges:bytes
Connection:close
Content-Length:489
Content-Type:text/html
Date:Sat, 03 Mar 2012 16:34:53 GMT
Server:Apache/2.0.64 (Red Hat)</pre>
</blockquote>
<p>Note that the response headers indicate a content length of 489 bytes. None of that content is actually loaded into the page or displayed to the reader, but the server <em>is</em> sending it. I confirmed this with a packet sniffer (<a href="http://www.wireshark.org/">Wireshark</a>) that intercepts data moving over the network connection. The full content of the requested knowl is sent back to the browser, but then it&#8217;s deep-sixed before anybody sees it.</p>
<p>What I don&#8217;t get is <em>why</em> browsers implement the same-origin policy in this roundabout way. What&#8217;s the point of sending the request if you know you&#8217;re going to ignore the response? I suppose web-site redirection is one scenario where sending the message might not be futile: If aimath.org redirects the request back to bit-player.org, then the transaction can be allowed to proceed. But how common is that?</p>
<p>Very likely there&#8217;s some other good reason for doing it this way. (Having been persuaded that my first hypothesis was totally bogus, I&#8217;m willing to entertain the possibility that I still don&#8217;t understand clearly.) But none of the tutorials and reference documents I&#8217;ve consulted (see list below) have explained it to me.</p>
<p>The &#8220;Access-Control-Allow-Origin: *&#8221; header that Schilly mentioned is part of a recent W3C draft standard called Cross-Origin Resource Sharing, or CORS, that lifts some of the strictures imposed by the same-origin policy. For simple requests, the browser will accept and display results from a foreign site if the appropriate header is included in the response. Thus the third-party site is given a measure of control over whether or not cross-origin requests are allowed. The CORS proposal goes back to 2005, but browsers began supporting it only in 2009 or 2010. (Opera hasn&#8217;t caught up yet; Internet Explorer does it a little differently.)</p>
<p>I don&#8217;t pretend to understand all the implications of this change in the way the web works. Presumably, the scenario the designers have in mind is something like this:</p>
<p>Naive User visits sneakthief.com, a web site that plays amusing videos of kittens while running a JavaScript program that requests cross-origin access to fortknox.com, sending along the cookies that authenticate Naive User as an acount holder at Fort Knox. If fortknox.com responds with the keys to the vault, they will be transmitted back to sneakthief.com. The protection against this outcome is our faith that fortknox.com will not carelessly set the Access-Control-Allow-Origin header. I would have felt a little safer if the response from fortknox.com were blocked unconditionally, regardless of header flags. And safer still if the web worked <em>my</em> way, and the request were blocked before it could even be sent.</p>
<p>Zalewski comments that the main rationale for introducing CORS is that there are so many other ways of undermining or circumventing the same-origin policy (iframes, server-side proxies, JSONP, hidden forms, Flash, Java) that we might as well build a well-structured and well-documented facility for doing what everybody is doing anyway. In other words, leave the doors unlocked so nobody will smash a window while breaking in.</p>
<p>This may well be the wisest policy. Zalewski offers this meditation in the epilogue to his book:</p>
<blockquote><p>I am haunted by the uncomfortable observation that in real life, modern societies are built on remarkably shaky ground. Every day, each of us depends on the sanity, moral standards, and restraint of thousands of random strangers&#8212;from cab drivers, to food vendors, to elevator repair techs&#8230;. In this sense, our world is little more than an incredibly elaborate honor system that most of us voluntarily agree to participate in. And that&#8217;s probably okay&#8230;.</p>
<p>It&#8217;s difficult to understand, then, why we treat our online existence in such a dramatically different way&#8230;. The only explanation I can see is that humankind has had thousands of years to work out the rules of social engagement in the physical realm&#8230;. Unfortunately for us, we have difficulty transposing these rules to the online ecosystem, and this world is so young, it hasn&#8217;t had the chance to develop it&#8217;s own, separate code of conduct yet.
</p></blockquote>
<p>Other resources on this topic:</p>
<ul>
<li>Michal Zalewski&#8217;s <a href="http://code.google.com/p/browsersec/wiki/Part2">Browser Security Handbook, part 2</a></li>
<li><a href="http://www.w3.org/Security/wiki/Same_Origin_Policy">W3C on same-origin policy</a></li>
<li><a href="http://en.wikipedia.org/wiki/Same_origin_policy">Wikipedia on same-origin policy</a></li>
<li><a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing">Wikipedia on cross-origin resource sharing</a></li>
<li><a href="http://www.w3.org/TR/cors/">W3C on cross-origin resource sharing</a></li>
<li><a href="http://enable-cors.org/">a manifesto promoting cross-origin resource sharing</a></li>
<li><a href="http://dev.opera.com/articles/view/dom-access-control-using-cross-origin-resource-sharing/">Tiffany Brown essay on cross-origin resource sharing</a></li>
</ul>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/security-theater-on-the-web/feed</wfw:commentRss>
		</item>
		<item>
		<title>PDF vs. HTML</title>
		<link>http://bit-player.org/2012/pdf-vs-html</link>
		<comments>http://bit-player.org/2012/pdf-vs-html#comments</comments>
		<pubDate>Sat, 18 Feb 2012 13:10:03 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1133</guid>
		<description><![CDATA[  

The March&#8211;April American Scientist has been out for a couple of weeks. My &#8220;Computing Science&#8221; column looks at the future of scientific illustration in a world where we do most of our reading not on paper but on a screen of some kind&#8212;a screen that has a  computational engine behind it.
My hope [...]]]></description>
			<content:encoded><![CDATA[<p><script src='/poppyramid/modernizr.custom.85156.js' type='text/javascript'></script> <script src="/poppyramid/d3.js" type="text/javascript"></script> <script src='/poppyramid/d3.csv.js' type='text/javascript'></script>
<link href="/poppyramid/pyramid.css" rel="stylesheet" type="text/css" />
The March&ndash;April <em>American Scientist</em> has been out for a couple of weeks. My &#8220;Computing Science&#8221; column looks at the future of scientific illustration in a world where we do most of our reading not on paper but on a screen of some kind&#8212;a screen that has a  computational engine behind it.</p>
<p>My hope for those future illustrations is that they won&#8217;t just sit on the page looking pretty. They&#8217;ll do stuff. They&#8217;ll make good use of the available computing machinery. They&#8217;ll invite the reader to interact and explore. Below is my attempt to give an example of the kind of illustration I have in mind. It&#8217;s an interactive version of the familiar population pyramid, based on <a href="http://esa.un.org/unpd/wpp/">data from the U.N.</a> and built with HTML, CSS, SVG and the <a href="http://mbostock.github.com/d3/">d3.js</a> JavaScript library from Michael Bostock. Please play.</p>
<div id="fallback" style="display: none">
<p>This illustration relies on Scalable Vector Graphics, a format that your browser does not seem to recognize. Browsers that are believed to work include Internet Explorer 9 and the most recent versions of Firefox, Safari, Opera and Chrome.</p>
<p>Methods for testing browser compatibility are not always reliable, so you may want to click the button below to see for yourself.</p>
<p><button onclick="hideFallback(); showSVG(); return false;">Try it anyway!</button></p>
<p><img align="middle" src="/poppyramid/pyramid-thumbnail.png" alt="The population pyramid, sadly without animation or interaction." /></p>
</div>
<div id="illustration"> </div>
<p><script src='/poppyramid/pyramid.js' type='text/javascript'></script></p>
<p>I&#8217;m optimistic and enthusiastic about the digital future of science publishing. The digital <em>present</em> is another matter. One indicator of how far we still have to go is that some of you have no idea what that population-pyramid illustration is supposed to look like, because it doesn&#8217;t appear on your screen. If you&#8217;re reading this with an older web browser, you may see a static placeholder illustration or an error message or nothing at all. If you&#8217;re reading the RSS feed, I offer my apologies, but there&#8217;s nothing I can do to help.</p>
<p>Apart from problems of accessibility and compatibility, there&#8217;s a deeper issue I want to address here. If the aim is to enhance the literature of science, we have to keep in mind that very little of that literature takes the form of HTML, CSS, SVG and JavaScript. Almost all journal articles and preprints are distributed as PDFs. I have no idea how to make my little animated population pyramid work inside a PDF.</p>
<p>&#8220;PDF&#8221; stands for Faux Paper Document. PDFs look just like their printed prototypes, with all the typographical niceties&#8212;justification, hyphenation, kerning of letter pairs, ligatures. It&#8217;s as if the words and pictures had been skimmed off the page and pasted onto the screen (which is in fact pretty close to how the process works). This fidelity to the print tradition follows directly from the history of PDF: It was an outgrowth of PostScript, which was an outgrowth of <a href="http://groups.google.com/group/fa.laser-lovers/msg/5d0df32a0e91f1fa?rnum=2&#038;pli=1">InterPress</a>, which was developed as software for use in the printing trades. The successful imitation of paper documents is a laudable achievement. As a culture, we have several hundred years of effort invested in learning how to present information effectively and attractively on the printed page; we shouldn&#8217;t let that go to waste. However, using a multigigahertz, multigigabyte computing machine as a standin for a sheet of dried cellulose seems a bit of a waste. It&#8217;s rather like early printers striving to reproduce the stylistic quirks of scribes writing with quill pens.</p>
<p>HTML can&#8217;t  match the designerly refinement of PDF, but it is more versatile, livelier, and even playful. HTML documents do tricks. Where PDF is for the suits, HTML/CSS/JavaScript is the home of hackers.</p>
<p>But, again, few scholarly papers are published in HTML. There are a number of reasons for this, but to me the one that seems most salient is a certain lack of <em>thinginess</em>. In my column I write:</p>
<blockquote><p>Why do authors and readers prefer PDFs for this kind of publication? One factor may be this: A PDF is something you possess. You download it from a server, give it a name, store it in a folder. It’s yours; it stays put. A website built out of HTML has a different character. It’s not a thing you own but a place you visit. You can’t take it home with you&#8212;although perhaps you can send a postcard or keep a small souvenir in the form of a bookmark.</p></blockquote>
<p>&#8220;HTML&#8221; is an abbreviation for Highly Temporary Markup Language.</p>
<p>If we take this view seriously, then what the world needs is a way to encapsulate HTML documents so that they become first-class, discrete objects&#8212;things you can keep, rename, pass around, copy, delete, annotate, modify. For years I thought that this capability should be built into web browsers&#8212;that you should be able to press a button to download and store a fully functional and totally self-contained local copy of any web page. My favorite browser of the 1990s, called iCab, came pretty close to this ideal, but for many modern web pages the client-side approach is either unworkable or undesirable. With pages that rely on technologies such as AJAX, it&#8217;s not possible to make a fully self-sufficient local copy. And often there are page elements you don&#8217;t really want to include in your private copy, such as navigational menus and &#8220;Like&#8221; buttons and comment forms.</p>
<p>An alternative strategy is to let the author of the HTML document take responsibility for creating a downloadable, autonomous version, with content tailored for that environment. A technology for doing this sort of thing already exists: It&#8217;s the <a href="http://www.daisy.org/epub/">EPUB</a> format used by various eBook readers. An EPUB document is essentially a collection of HTML files, CSS stylesheets and various forms of metadata wrapped up in a zip archive. SVG is supported, along with MathML. The <a href="http://idpf.org/epub/30/spec/epub30-contentdocs.html#sec-scripted-content">3.0 standard</a> says JavaScript is also acceptable, but that statement is accompanied by a list of warnings that sound like the side-effect disclosures in a pharmaceutical ad.</p>
<p>Apple&#8217;s new iBooks Author program also produces some kind of encapsulated HTML, but of course it works only in the Apple sector of the universe. If you&#8217;d rather affiliate with a different proprietary dominion, there&#8217;s something called CDF from Wolfram Research. (The initials stand for &#8220;<a href="http://blog.wolfram.com/2011/07/21/launching-the-computable-document-format-cdf-dont-compress-the-idea-expand-the-medium/">Conrad&#8217;s Document Format</a>.&#8221;)</p>
<p>Still another approach would be to stick with PDF but make it more fun. According to the PDF 1.7 specification (which, as you might guess, <a href="http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf">comes in the form of a PDF</a>), a JavaScript compiler is supposed to be available within PDF documents, and Adobe has an <a href="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf">Acrobat JavaScript API</a> document. But as far as I can tell scripting is commonly used only for validating forms and playing slideshows.</p>
<p>The latest version of Acrobat does have a pretty cool interactive viewer for three-dimensional objects. Three years ago Alyssa Goodman and her colleagues at Harvard published a <a href="http://www.nature.com/nature/journal/v457/n7225/full/nature07609.html">paper in <em>Nature</em></a> that made use of that viewer. This was apparently the first scientific publication to include a 3D PDF. I don&#8217;t know of another example since. And I have never seen any other kind of interactive graphics embedded in a PDF. </p>
<p>For more on all this, I invite you to read my column in the format of your choice: good old-fashioned <a href="http://www.americanscientist.org/subscribe/">paper</a>, fine artisanal <a href="http://www.americanscientist.org/issues/pub/pixels-or-perish">HTML</a> (with whiz-bang JavaScript graphics), or the pixelated form of paper we call <a href="http://www.americanscientist.org/libraries/documents/2012211327368928-2012-03CompSciHayes.pdf">PDF</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/pdf-vs-html/feed</wfw:commentRss>
		</item>
		<item>
		<title>17 x 17 = $289.00</title>
		<link>http://bit-player.org/2012/17-x-17-28900</link>
		<comments>http://bit-player.org/2012/17-x-17-28900#comments</comments>
		<pubDate>Wed, 08 Feb 2012 13:24:00 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

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

		<category><![CDATA[problems and puzzles]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1126</guid>
		<description><![CDATA[This just in from Bill Gasarch: The quest for a rectangle-free four-coloring of the 17-by-17 grid is over. If you don&#8217;t know what that&#8217;s all about, and you&#8217;d like to find out, see Bill&#8217;s blog post from 2009 or my earlier comments (one, two, three). 

The coloring above (along with several others) was found by [...]]]></description>
			<content:encoded><![CDATA[<p>This just in from Bill Gasarch: The quest for a rectangle-free four-coloring of the 17-by-17 grid is over. If you don&#8217;t know what that&#8217;s all about, and you&#8217;d like to find out, see <a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">Bill&#8217;s blog post from 2009</a> or my earlier comments (<a href="http://bit-player.org/2009/the-17x17-challenge">one</a>, <a href="http://bit-player.org/2009/17-x-17-a-nonprogress-report">two</a>, <a href="http://bit-player.org/2010/whack-a-rectangle">three</a>). </p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/02/sq17-2012-01.png" alt="Sq17 2012 01" border="0" width="450" height="450" /></p>
<p>The coloring above (along with several others) was found by Bernd Steinbach of Frieburg University and Christian Posthoff of the University of the West Indies. They win the $289 prize that Gasarch had offered for a solution.</p>
<p>Gasarch has posted <a href="http://blog.computationalcomplexity.org/">more details</a> on the Computational Complexity blog. But apparently we&#8217;re going to have to wait until May to learn <em>how</em> the coloring was found. The one interesting clue revealed so far is that the paper will be presented at the International Symposia on Multiple-Valued Logic.</p>
<p><strong>Addendum 2012-02-11:</strong> For the benefit of those who don&#8217;t read the comments, I repeat a remark from reader Craig:</p>
<blockquote><p>What I don’t like about this solution (or, indeed, the solutions to other related problems) is the arbitrariness. Is it not the case that you should be able to permute the rows and columns of any solution and arrive at a new solution? That being the case, I feel that you should be able to adjust the rows and columns here in order to highlight some kind of revealing pattern in the colouring.</p></blockquote>
<p>Indeed, the matrix of dots shown above is one of (17!)<sup>2</sup> equivalent solutions. How should we choose one of those permutations to serve as a representative of the class?</p>
<p>Personally, I&#8217;m not optimistic about finding a &#8220;revealing pattern&#8221; in any of the 126513546505547170185216000000 permuted matrices. If there were some simple, concisely described rule governing the arrangement of the dots&#8212;other than the no-monochrome-rectangle criterion itself&#8212;then we could make use of that rule to find a solution, or at least to reduce the search space. When Steinbach and Posthoff reveal their secret method, maybe we&#8217;ll learn that such a rule exists, but I doubt it.</p>
<p>Even if we can&#8217;t make a pretty picture by permuting rows and columns, it would still be useful to have some canonical ordering, so that we could easily determine whether two arrays are members of the same equivalence class. I&#8217;m not sure how best to do that, but if we assign an ordering to the colors, we can at least sort them.</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2012/02/fixpoint-matrix.png" alt="sorted matrix" border="0" width="450" height="450" /></p>
<p>There is still some arbitrariness here. We have not dealt with the 4! orderings of the colors. Is there a smarter way to go about it?</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/17-x-17-28900/feed</wfw:commentRss>
		</item>
		<item>
		<title>The Knowl Post</title>
		<link>http://bit-player.org/2012/the-knowl-post</link>
		<comments>http://bit-player.org/2012/the-knowl-post#comments</comments>
		<pubDate>Sun, 05 Feb 2012 15:15:28 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1076</guid>
		<description><![CDATA[


Imagine, if you will, the year 2020, when a billion people around the planet are at their screens. And each is able to withdraw from a great repository any fragments of anything that has been published, as well as the private documents he or she has access to. So, you&#8217;re able to bring to your [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script></p>
<link href="http://aimath.org/knowlstyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://aimath.org/knowl.js"></script></p>
<blockquote><p>Imagine, if you will, the year 2020, when a billion people around the planet are at their screens. And each is able to withdraw from a great repository any fragments of anything that has been published, as well as the private documents he or she has access to. So, you&#8217;re able to bring to your screen not just encyclopedias, not just novels, not just the works of Horace and Cicero and Marcus Aurelius and Shakespeare and Goethe, but obscure stuff from South America and Africa that people have written in the last 5 minutes. And [you're able] to make comments and footnotes and to transclude and quote from anything else that&#8217;s published, with automatic royalty.</p></blockquote>
<p>That&#8217;s Ted Nelson, the prophet of hypertext, <a knowl="/wp-content/knowl/byte-ref.html">writing</a> in <em>Byte</em> in 1990. We still have a few years to go before 2020, and yet almost everything Nelson foresaw is already upon us. More than <a href="http://www.physorg.com/news/2011-01-internet-users-worldwide-billion.html"><em>two</em> billion</a> people around the world are sitting at their screens. The encyclopedias and novels are online, along with Horace, Cicero and the rest. Twitter will show you what&#8217;s been written in South America and Africa in the last five minutes. For commenting, <a knowl="/wp-content/knowl/transclusion.html">transcluding</a> and quoting, we have Facebook and many other thriving channels of commerce and communication (even blogs like this one). So what remains to be invented before we arrive in Nelson&#8217;s stately pleasure dome of Xanadu? Well, &#8220;automatic royalty&#8221; hasn&#8217;t shown up yet. More surprising&mdash;and more annoying&mdash;we still don&#8217;t have footnotes on the web.</p>
<p>It&#8217;s a worrisome lack. How are scholars to annotate and document&#8212;not to mention digress and distract&#8212;without footnotes or some similar device? In a <a knowl="/wp-content/knowl/horowitz.html">recent essay</a> Alexandra Horowitz cites Edward Gibbon, J. L. Austin, Nicholson Baker and David Foster Wallace as authors whose work would be diminished or even destroyed if stripped of notes. I would add Vladimir Nabokov to the list, for his novel-in-notes <em>Pale Fire</em>. Martin Gardner deserves mention as well&#8212;not for his columns in <em>Scientific American</em>, where footnotes and marginalia were sadly forbidden, but for his annotated editions of Lewis Carroll and others. And the most important example of all is <a href="http://people.ucalgary.ca/~elsegal/TalmudPage.html">the Talmud</a>, the archetypal hypertext of <a knowl="/wp-content/knowl/talmud.html">modern times</a>. We should be able to do stuff like <em>that</em> that in <a knowl="/wp-content/knowl/talmudofscience.html">HTML</a>!</p>
<p>Why are footnotes not a standard feature of web life? Perhaps because the founders believed that the central mechanism of the web&#8212;the anchor tag &lt;a href= &#8230; &gt;&#8212;adequately served the purpose. And people <em>do</em> use &lt;a&gt; tags for notes. For example, there&#8217;s the <a knowl="/wp-content/knowl/wikitag.html">Wikipedia protocol</a>, where clicking on a footnote link<sup id="wikiref"><a href="#wikinote">[1]</a></sup> sends you on a trip to the bottom of the page, where you&#8217;ll find a helpful caret to take you back where you came from. This scheme does a good job of mimicking the ink-on-paper experience of footnotes&#8212;and ignores all the capabilities and possibilities of a new medium. </p>
<p>Back in 1995, the HTML 3.0 proposal included a <a href="http://www.w3.org/MarkUp/html3/footnotes.html">&lt;fn&gt; tag</a> for footnotes. But HTML 3.0 was stillborn, and the 3.2 version that replaced it a few months later dropped footnote support (and much else). HTML5 now offers the &lt;aside&gt; tag, which sounds like it ought to be the semantically correct way to mark up footnotes. But I have yet to see any website in the wild actually using &lt;aside&gt; that way. And the (still tentative) <a href="http://dev.w3.org/html5/spec/Overview.html#the-aside-element">HTML5 standard</a> suggests that footnotes were <em>not</em> the the original intent of the tag:</p>
<blockquote><p>The aside element &#8230; can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.</p>
<p>It&#8217;s not appropriate to use the aside element just for parentheticals, since those are part of the main flow of the document.</p></blockquote>
<p>Yeah, whatever. But what makes the web such a grand playground is that you can always build your own tools and toys if you don&#8217;t like the standard kit. Which brings me to all those blue links with dotted underscores in the paragraphs above. I assume you&#8217;ve tried them out by now. The device is called a <a href="http://www.aimath.org/knowlepedia/">knowl</a>, and I discovered it the other day while browsing on the home page of the <a href="http://www.aimath.org">American Institute of Mathematics</a> in Palo Alto. The knowl&#8217;s inventor is <a href="http://homepage.univie.ac.at/harald.schilly/">Harald Schilly</a> of the University of Vienna.</p>
<p>It&#8217;s all done with a dab of jQuery and a dollop of CSS. The markup in the HTML file is just a mutant anchor tag:</p>
<p style="text-align: center"><code>&lt;a knowl="wikitag.html"&gt;Wikipedia protocol&lt;/a&gt;</code></p>
<p>where the normal &#8220;href&#8221; has been replaced by &#8220;knowl.&#8221; The jQuery code installs an onClick handler for each instance of this structure found in the text; the onClick function calls out to the server, loads the content of the note, and adds that text to the document tree as a sibling of the current node. CSS rules add a bit of border styling. The little drawer-like pane opens just below the current paragraph (or whatever other HTML element contains the reference to the knowl).</p>
<p>The knowl is not quite everything I would wish for in a footnote utility. A minor issue is that the &#8220;next-sibling&#8221; rule for placing the text of the knowl doesn&#8217;t always <em><a knowl="/wp-content/knowl/next-sibling.html">do the right thing</a></em>. A less-minor issue is that the authoring process is overly arduous. Every knowl goes into a separate file, so writing the text requires a change of mental focus and also creates a lot of file-system clutter. I&#8217;d rather include the text of the note at the point of reference (the way it&#8217;s done in LaTeX, say). That could be accomplished with <a knowl="/wp-content/knowl/easy.html">an easy change</a> to the JavaScript. On the other hand, the system&#8217;s reliance on JavaScript is in itself problematic. The world of knowls is off-limits to those who write on hosted platforms such as WordPress.com or Blogger, because they forbid JavaScript in posts. I wonder if the same visual effects could be achieved entirely with CSS3 animations?</p>
<p>When Schilly and his colleagues at AIM developed the knowl, their goal was not to satisfy my footnote fetish. As a matter of fact, they seem to have a rather different vision of how knowls might be used&#8212;not as a medium for the Shandean digressions of self-indulgent writers like me but as shared nuggets of wisdom, offered as a public resource. David Farmer, director of programs at AIM, writes: &#8220;I envision a time when the Internet has a repository of such knowls, reliable and ready to be referenced anywhere.&#8221; </p>
<p>Unfortunately, there&#8217;s a technical impediment to making that vision a reality. When I started writing this post, I thought it would be only appropriate to <em>transclude</em> the definition of transclusion that&#8217;s given in one of the knowls above. So I constructed a knowl linking to the file on aimath.org where that text exists. <a knowl="http://aimath.org/knowlepedia/transclusion.html">This knowl</a> has such a link. If you click it, you&#8217;ll find that it doesn&#8217;t work: The little blue drawer slides open, but it is empty. The reason is that the page you are reading now was downloaded from bit-player.org, but when you click that knowl, it tries to access HTML content from aimath.org; that attempt runs afoul of the browser&#8217;s &#8220;<a href="http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy">same-origin policy</a>.&#8221; There are ways of evading this security provision, but they come with a faint scent of hackery. Without them, though, I don&#8217;t think we can have our public repository of knowls. It looks like we&#8217;ll each have to serve up our own wit and drollery.</p>
<p><strong>Update 2012-02-28</strong>: Harald Schilly has shown me that transclusion is not a vain dream after all. The solution relies on a fairly recent technology called <a href="http://www.w3.org/TR/2008/WD-access-control-20080912/">Access Control for Cross-Site Requests</a>, and it requires a cooperating server to set an appropriate flag in an HTTP header. <a knowl="http://knowlpedia.appspot.com/k/doc.knowl">This knowl</a> is fetched from appspot.com, the hosting arm of the Google App Engine, which allows cross-site connections from anywhere. If you are reading this page with a recent Webkit browser (Google Chrome, Safari) or a recent Mozilla browser (Firebox), the magic drawer should open with a note inside. But Opera does not implement the method, and I think Internet Explorer is also a holdout, although I don&#8217;t have the means to check. I was totally unaware of this trick, and I&#8217;m grateful to Schilly for enlightening me.</p>
<blockquote><p id="wikinote"><a href="#wikiref">^</a> Hi! I&#8217;m a Wikipedia-style footnote. I feel lonely and exposed and painfully out of context down here.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/the-knowl-post/feed</wfw:commentRss>
		</item>
		<item>
		<title>The Right Click</title>
		<link>http://bit-player.org/2012/the-right-click</link>
		<comments>http://bit-player.org/2012/the-right-click#comments</comments>
		<pubDate>Sat, 21 Jan 2012 22:39:41 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

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

		<guid isPermaLink="false">http://bit-player.org/?p=1072</guid>
		<description><![CDATA[For a few hours yesterday the front page of the New York Times was stealing  right clicks. If I right-clicked on a hyperlinked headline (or option-clicked, or made a two-fingered tap on the trackpad), I did not get the usual context menu; instead, I was taken directly to the target of the link. This [...]]]></description>
			<content:encoded><![CDATA[<p>For a few hours yesterday the front page of the <em>New York Times</em> was stealing  right clicks. If I right-clicked on a hyperlinked headline (or option-clicked, or made a two-fingered tap on the trackpad), I did not get the usual context menu; instead, I was taken directly to the target of the link. This is the proper behavior for an ordinary mouse click&#8212;or a left click with a two-button mouse&#8212;but not for a right click. </p>
<p>The first time this happened, I thought it was just a slip-of-the-finger, but the error was consistently repeatable across two different machines and three different browsers (Firefox, Chrome, Safari). Furthermore, it affected only the <em>New York Times</em>. Indeed, it was only the front page of the <em>Times</em> that was misbehaving; right clicks elsewhere in the paper worked normally.</p>
<p>The cause of this problem may have been an innocent goof, but I&#8217;m skeptical. When the <em>Times</em> first put up a paywall, not quite a year ago, readers quickly found <a href="http://www.practicalhacks.com/2011/05/31/how-to-hack-the-new-york-times-paywall/">holes</a> in it. One of those holes involves right-clicking a link to get a copy of the URL, pasting it in the browser address bar, and removing the referrer cruft following the question mark. My guess is that someone at the <em>Times</em> decided it was time to close the hole.</p>
<p>I hasten to add that freeloading is not <em>my</em> reason for right-clicking on <em>Times</em> headlines. I pay my $15 per doublefortnight. But my newsreading habit is to peruse the entire front page, opening each article that interests me in a separate tab. The &#8220;open in new tab&#8221; command lives in the right-click contextual menu.</p>
<p>Regardless of <em>why</em> the Times was interfering with my Second Amendment right to bear mouse buttons, I was curious about <em>how</em> they were doing it. They weren&#8217;t just disabling the contextual menu entirely. (You can read a scornful account of <em>that</em> nefarious practice at <a href="http://javascript.about.com/library/blright.htm">About.com</a>, which identifies itself as &#8220;A part of The New York Times Company.&#8221; (Not, in my view, the best part.)) On the NYT front page, right clicks worked as usual in ordinary text; they were only hijacking right clicks on links.</p>
<p>Regrettably, I&#8217;m not going to be able to answer the how&#8217;d-they-do-it question. Before I could find the offending code, some grownup at the <em>Times</em> called off the whole crazy experiment, and normal right-clickery was restored.</p>
<p>Although I couldn&#8217;t find the click-stealer, I found plenty else. The <em>Times</em>, it seems, prints all the JavaScript that fits. Some of it is unsurprising. jQuery is loaded. There are scripts to run slide shows and videos, to manage cookies, to serve ads, to provide menus and other navigation aids. But there&#8217;s lots more:</p>
<ul>
<li><code>beacon.js  </code> This may have something to do with all those little files named 1px.gif floating around like packing peanuts.</li>
<li><code>revenuescience.js  </code> Apparently a product of an outfit called <a href="http://www.audiencescience.com/">Audience Science</a>. &#8220;AudienceScience is processing trillions of behaviors per day and over 270 billion attributes at any given moment.&#8221; You don&#8217;t say.</li>
<li><code>krux-4.7.2.js   </code> The web site of <a href="http://www.kruxdigital.com/">Krux</a> (which I had never heard of before) says: &#8220;Krux helps large and small websites control, energize, and responsibly monetize consumer data across screens and sources.&#8221; Reading further, I get the impression they are in the business of preventing snoopers from snooping on the snoopers who snoop on us. I&#8217;m certainly not having much luck snooping on <em>their</em> code. It looks like this:
<p><code>function(a){e(a)||A(b,c(a))}),h(b,c(a[1]),e(f)?f:function({o.js.apply(null,j)})):h(b,c(a[1]));</code></li>
<li><code>gw.js   </code>Even deeper obfuscation. I believe this is a JavaScript program whose function is to write another JavaScript program into the page header. It seems to be one of the tools that Audience Science uses to process those trillions of &#8220;behaviors&#8221; per day.</li>
</ul>
<p>Phooey on them, I say.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/the-right-click/feed</wfw:commentRss>
		</item>
		<item>
		<title>Sugarpixels</title>
		<link>http://bit-player.org/2012/sugarpixels</link>
		<comments>http://bit-player.org/2012/sugarpixels#comments</comments>
		<pubDate>Sun, 01 Jan 2012 19:42:29 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[off-topic]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1070</guid>
		<description><![CDATA[ Yes, that&#8217;s one of those annoying QR codes that seem to be turning up all over the place lately. The jumble of red and blue pixels appears on the front of the holiday greeting cards that my wife Rosalind and I sent to a few friends and family-members last week. Since the card has [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bit-player.org/sugarpixels/"><img class="alignright" src="http://bit-player.org/wp-content/uploads/2012/01/qr-red-blue-200pts.jpg" alt="QR code in red and blue pixels" border="0" width="200" height="200" /></a> Yes, that&#8217;s one of those annoying QR codes that seem to be turning up all over the place lately. The jumble of red and blue pixels appears on the front of the holiday greeting cards that my wife Rosalind and I sent to a few friends and family-members last week. Since the card has an online component, I thought I might share it here with a wider circle of acquaintances. So let me take this opportunity to wish everyone a happy 2012&#8212;all 366 days of it.</p>
<p>If you have a QR reader on your cell phone, you should be able to scan the code directly from the screen. You&#8217;ll be taken to a web page where the same pattern appears, and tapping the red targets should eventually get you to a greeting-of-the-season. Unfortunately, the Javascript driving this transformation doesn&#8217;t seem to run very well on some phones. (I&#8217;ve tested it on iPhones, iPads and a Palm Pre, where it is balky but functional; I&#8217;ve had at a report that it fails entirely on at least one Android phone.) If anyone can offer hints or clues about what I might be doing wrong, I&#8217;ll be grateful.</p>
<p>In any case, the small-screen version of the program isn&#8217;t nearly as nice as the one for grown-up computers, which you can reach by <a href="http://bit-player.org/sugarpixels/">clicking here</a> or on the image above. And there&#8217;s more about my travails with cell-phone Javascript (and SVG) in the <a href="http://bit-player.org/sugarpixels/nerdnotes.html">nerd notes</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2012/sugarpixels/feed</wfw:commentRss>
		</item>
		<item>
		<title>The acceleration of history</title>
		<link>http://bit-player.org/2011/the-acceleration-of-history</link>
		<comments>http://bit-player.org/2011/the-acceleration-of-history#comments</comments>
		<pubDate>Tue, 20 Dec 2011 22:27:43 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1067</guid>
		<description><![CDATA[
Four hundred years ago, the idea that the Earth goes around the Sun rather than vice versa was not just a scientific breakthrough but also a cultural bombshell. People were asked to reimagine the world they were living in. Not everyone welcomed the opportunity. Books were burned. In the case of Giordano Bruno, an author [...]]]></description>
			<content:encoded><![CDATA[</p>
<blockquote><p>Four hundred years ago, the idea that the Earth goes around the Sun rather than vice versa was not just a scientific breakthrough but also a cultural bombshell. People were asked to reimagine the world they were living in. Not everyone welcomed the opportunity. Books were burned. In the case of Giordano Bruno, an author was burned.</p>
<p>In the modern world, cosmological revolutions seem to cause hardly a ripple in public consciousness. Inflation, dark matter, dark energy&#8212;these ideas also call for a reimagining of the world we live in, but they have provoked very little fuss outside the community of science. It&#8217;s certainly a relief that no one will be burned at the stake over matters of cosmological doctrine. But are we really more liberal and open-minded, or just not paying attention?</p>
</blockquote>
<p>Those are the final paragraphs of <a href="http://www.americanscientist.org/issues/pub/a-box-of-universe">my new column</a> in <em>American Scientist</em>. Here I want to say a few words more about the reception of these new ideas in cosmology, but first I should explain that the column is really about something else, namely the <a href="http://hipacc.ucsc.edu/Bolshoi/">Bolshoi computer simulation</a> of the large-scale structure of the universe, led by Joel Primack of UC Santa Cruz and Anatoly Klypin of New Mexico State University.</p>
<p>While preparing to write the column, I picked up Marcia Bartusiak&#8217;s recent book <em><a href="http://www.marciabartusiak.com/books.html">The Day We Found the Universe</a></em>, which tells the story of the discovery that the &#8220;nebulae&#8221; we see in the sky are actually distant galaxies much like our own&#8212;what Kant called &#8220;island universes.&#8221; It&#8217;s a grand story, and Bartusiak gives a splendid account of it, with engaging portraits of the dozen or so principal players. Highly recommended. </p>
<p>I&#8217;m not going to retell the whole story here, but I want to point out that it took 175 years for the idea of island universes to be accepted by astronomers. The earliest known proposal was by Thomas Wright in 1750; Bartusiak&#8217;s story culminates on January 1, 1925, when Edwin Hubble&#8217;s paper &#8220;Cepheids in Spiral Nubulae&#8221; was read to a joint session of the American Astronomical Society and the American Association for the Advancement of Science. In between, there was a great deal of backing and forthing. For example, William Herschel, the preeminent observational astronomer of the 18th century, initially supported the island-universe theory, but later he changed his mind. As late as 1900 many astronomers  believed the nebulae were relatively small, nearby objects&#8212;perhaps protostars about to condense. It took new instruments and a barrelfull of observational evidence to overturn this view. (Specifically: telescopes that could resolve individual stars in distant galaxies, better spectroscopes, better photographic film, the understanding of redshifts, the discovery of a relation between period and luminosity in the stars called Cepheid variables.)</p>
<p>I find it wholly unsurprising that people might need a century or two to digest such a major shift in how we view the universe around us. What&#8217;s remarkable is that lately the pace of change has accelerated, and nobody seems to be having much trouble keeping up.</p>
<p>Consider what&#8217;s happened in cosmology in the 80-some years since Hubble&#8217;s revelation. There was the battle between the steady-state and the big-bang models, which can be traced back to the 1920s and 30s and that was finally resolved in the 1960s with the discovery of the cosmic background radiation. Then there&#8217;s &#8220;dark matter.&#8221; Fritz Zwicky pointed out in the 1930s that the dynamics of galaxies imply there&#8217;s a lot more mass out there than we&#8217;re seeing, and this discrepancy became more troubling with later observations. By the 1980s or 90s most astronomers had accepted the remarkable conclusion that we don&#8217;t know what the universe is made of; all of the familiar &#8220;baryonic&#8221; matter of stars and planets is a minority constituent; the bulk of the mass is some unidentified stuff that Primack dubbed cold dark matter.</p>
<p>Even weirder (if that&#8217;s possible) is the notion of cosmic inflation: In a period of 10<sup>&ndash;36</sup> second, the universe expanded by a factor of 10<sup>78</sup>. The inflationary hypothesis was first put forward in 1980, was tweaked a bit later in that decade, and was soon swallowed whole by the cosmological community (with the exception of a very few skeptics). </p>
<p>Finally comes &#8220;dark energy,&#8221; the force that&#8217;s causing the cosmic expansion to accelerate. It&#8217;s well known that this concept goes back to the early years of general relativity, with Einstein&#8217;s cosmological constant &Lambda;. But Einstein soon disavowed the idea, and it remained moribund until about 15 years ago, when two groups of astronomers found direct observational evidence that the expansion <em>is</em> indeed accelerating. The resurrection of &Lambda; was so quick and total that this year&#8217;s Nobel prize in physics was awarded for this work.</p>
<p>I find it astonishing and disquieting to live in a universe that&#8217;s so very different from the one I was born into. We already had external galaxies in my childhood, and Fred Hoyle and George Gamow were sparring over the big-bang/steady-state issue. But I grew up with no inkling of dark matter, dark energy or cosmic inflation. Now it turns out that most of the universe disappeared over the event horizon in the inflationary era, a fraction of a second after it all began, and long before any of us had a chance to see what we were missing. Of what&#8217;s left, less than 1 percent is the kind of matter we know and love&#8212;and nobody has a very good idea what the rest of all that stuff might be.</p>
<p>Given the contentious history of earlier innovations in cosmology&#8212;starting, of course, with the post-Copernican civil war&#8212;I would have expected more controversy over these ideas. But the whole rapid-fire series of head-spinning revolutions seems to have been accepted rather placidly, both within astronomy and by the wider scientific community. Why so little resistance? Is the evidence so compelling as to overwhelm all opposition? Or, on the contrary, have we become so complacently accepting of what experts tell us to believe that we&#8217;ve lost all independent judgment.</p>
<p>In a telephone conversation I asked Primack how he would explain the lack of controversy. He broadened the scope of the question, pointing out that when you consider the public at large, rather than the scientific community, the issue is not uncritical acceptance but rather ignorance and indifference. A population that doubts Darwinian evolution and anthropogenic climate change is not too easily convinced by evidence or cowed by authority. If no one has risen up to denounce the teaching of dark matter and dark energy in the public schools, it&#8217;s simply because they are unaware of those ideas. I think Primack is right about this, but I don&#8217;t understand why questions about the basic nature of the universe&#8212;which once excited such passion&#8212;could now lie beneath the notice even of the most benighted citizens.</p>
<p>(By the way, the headline on this post is borrowed from my former boss, Gerard Piel, who published a book under that title. Now that Gerry is gone, I can confess that I never read the book, but I always liked the title.)</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2011/the-acceleration-of-history/feed</wfw:commentRss>
		</item>
		<item>
		<title>Chebfun</title>
		<link>http://bit-player.org/2011/chebfun</link>
		<comments>http://bit-player.org/2011/chebfun#comments</comments>
		<pubDate>Tue, 13 Dec 2011 23:34:29 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[computing]]></category>

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

		<guid isPermaLink="false">http://bit-player.org/?p=1060</guid>
		<description><![CDATA[I went to a magic show the other day. Nick Trefethen was giving a demo of Chebfun, a Matlab extension package he is building in collaboration with his Oxford students and colleagues. In the course of the talk, several mathematical rabbits were pulled out of numerical hats.
The key idea in Chebfun is to represent any [...]]]></description>
			<content:encoded><![CDATA[<p>I went to a magic show the other day. <a href="http://people.maths.ox.ac.uk/trefethen/">Nick Trefethen</a> was giving a demo of <a href="http://www2.maths.ox.ac.uk/chebfun/">Chebfun</a>, a Matlab extension package he is building in collaboration with his Oxford students and colleagues. In the course of the talk, several mathematical rabbits were pulled out of numerical hats.</p>
<p>The key idea in Chebfun is to represent any function of a real variable by a polynomial approximation.</p>
<pre>
  >> f = chebfun('sin(x) + sin(x.^2)', [0 10]);
  >> plot(f)
</pre>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2011/12/chebfun-f.png" alt="graph of chebfun f" border="0" width="450" height="298" /></p>
<p>That wiggly line <em>looks</em> like a graph of <em>y</em> = sin(<em>x</em>) + sin(<em>x</em><sup>2</sup>), but that&#8217;s an illusion. What is being plotted here is a certain polynomial of degree 118 that happens to approximate sin(<em>x</em>) + sin(<em>x</em><sup>2</sup>) with high precision.</p>
<p>As I understand it, the chebfun construction algorithm works something like this. First you select <em>N+1</em> points in the interval where the function is defined, and construct the unique polynomial of degree <em>N</em> that passes through all the points. If the error of this approximation is below a threshold, you&#8217;ve found your chebfun. Otherwise, choose a larger sample of points and try again.</p>
<p>The sample points are not evenly spaced across the interval. They are Chebyshev points, whose distribution varies as a cosine function, denser at the extremes and sparser in the middle. In this case, the process converged with 119 Chebyshev points:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2011/12/f-with-sample-points.png" alt="the function f along with the 120 sample points that determine the polynomial" border="0" width="450" height="316" /></p>
<p>In one respect the example above is an easy one: The function is quite smooth. Here&#8217;s something more challenging:</p>
<pre>
  >> hat = 1-abs(x-5)/5;
  >> h = max(f, hat);
  >> plot(h)
</pre>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2011/12/rabbit-ears.png" alt="the rabbit-in-the-hat function" border="0" width="450" height="296" /></p>
<p>This is where we pull the rabbit out of the hat&#8212;or at least several pairs of rabbit ears. To deal with the <del datetime="2011-12-20T14:32:57+00:00">discontinuities</del> <ins datetime="2011-12-20T15:13:20+00:00">sharp corners</ins> in this curve, the Chebfun system assembles 25 polynomial segments, each defined on a different interval. Some are linear, some of higher degree. But the entire structure is still treated as a single function, which can be operated on by other functions. For example, <code>sum(h)</code> calculates the integral over [0, 10], returning the result 8.598303617326401. And here&#8217;s the square root of those rabbit ears:</p>
<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2011/12/square-root-of-rabbit-ears.png" alt="Square root of rabbit ears" border="0" width="450" height="315" /></p>
<p>These are neat tricks, but why would one <em>want</em> to work with polynomial approximations to a function, rather than with the function itself? I&#8217;m too new to all this to answer that question with confidence, so I&#8217;ll quote the <a href="http://www2.maths.ox.ac.uk/chebfun/guide/html/guide1.shtml">Chebfun Guide</a>:</p>
<blockquote><p>The aim of Chebfun is to &#8220;feel symbolic but run at the speed of numerics&#8221;. More precisely our vision is to achieve for functions what floating-point arithmetic achieves for numbers: rapid computation in which each successive operation is carried out exactly apart from a rounding error that is very small in relative terms.</p>
</blockquote>
<p>For those who want to know more, I offer a few pointers:</p>
<p>The first published paper on Chebfun:</p>
<p class="biblio">Battles, Zachary, and Lloyd N. Trefethen. 2004. An extension of MATLAB to continuous functions and operators. <em>SIAM Journal on Scientific Computing</em> 25:1743–1770. (<a href="http://www2.maths.ox.ac.uk/chebfun/publications/chebfun_paper.pdf">PDF</a>)</p>
<p>Trefethen&#8217;s argument favoring floating-point arithmetic over symbolic computation or exact rational arithmetic:</p>
<p class="biblio">Trefethen, Lloyd N. 2007. Computing numerically with functions instead of numbers. Mathematics in Computer Science 1:9&#8211;19. (<a href="http://people.maths.ox.ac.uk/trefethen/trefethen_functions.pdf">PDF</a>)</p>
<p>A provocative account of why polynomial approximation is not as wonky as you may think:</p>
<p class="biblio">Trefethen, Lloyd N. 2011. Six myths of polynomial interpolation and quadrature. <em>Mathematics Today</em>. (<a href="http://people.maths.ox.ac.uk/trefethen/mythspaper.pdf">PDF</a>)</p>
<p>Finally, Trefethen has a forthcoming book on Chebfun and related matters (which I have only just begun to read):</p>
<p class="biblio">Trefethen, Lloyd N. To appear. <em>Approximation Theory and Approximation Practice</em>. (<a href="http://www2.maths.ox.ac.uk/chebfun/ATAP/ATAPJune11.pdf">PDF</a>)</p>
<p>Chebfun runs inside <a href="http://www.mathworks.com/products/matlab/">Matlab</a>, the numerical computing environment from Mathworks. Chebfun itself has recently become open-source software (under a BSD license), but Matlab is proprietary. As far as I can tell, Chebfun does not not (yet?) run under Octave, the open-source alternative to Matlab.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2011/chebfun/feed</wfw:commentRss>
		</item>
		<item>
		<title>How Did the Stars Get Their Points?</title>
		<link>http://bit-player.org/2011/how-did-the-stars-get-their-points</link>
		<comments>http://bit-player.org/2011/how-did-the-stars-get-their-points#comments</comments>
		<pubDate>Thu, 08 Dec 2011 16:19:38 +0000</pubDate>
		<dc:creator>brian</dc:creator>
		
		<category><![CDATA[linguistics]]></category>

		<guid isPermaLink="false">http://bit-player.org/?p=1054</guid>
		<description><![CDATA[
Those are hot young stars in the Large Magellanic Cloud&#8212;one of the puppy-dog galaxies that follow the Milky Way around&#8212;photographed by the Hubble Space Telescope. (Detail cropped from a Wikipedia image.) Note that four rays seem to emanate from each of the brightest stars. The rays are not, of course, true beams of light radiating [...]]]></description>
			<content:encoded><![CDATA[<p><img class="centered" src="http://bit-player.org/wp-content/uploads/2011/12/hst-bright-stars-in-lmc-450.jpg" border="0" alt="a field of bright stars and dust clouds in the Large Magellanic Cloud, photographed by the Hubble Space Telescope, courtesy Wikipedia" width="450" height="450" /></p>
<p>Those are hot young stars in the Large Magellanic Cloud&#8212;one of the puppy-dog galaxies that follow the Milky Way around&#8212;photographed by the Hubble Space Telescope. (Detail cropped from <a href="http://en.wikipedia.org/wiki/File:Starsinthesky.jpg">a Wikipedia image</a>.) Note that four rays seem to emanate from each of the brightest stars. The rays are not, of course, true beams of light radiating in the four cardinal directions. They are <a href="http://www.telescope-optics.net/spider.htm">an artifact of the telescope&#8217;s structure</a>: a diffraction pattern created by the four vanes of the &#8220;spider&#8221; that supports the secondary mirror within the barrel of the telescope. Many other telescopes have three-vane spiders that yield a six-pointed diffraction pattern.</p>
<p><img class="alignright" src="http://bit-player.org/wp-content/uploads/2011/12/escher-stars.png" border="0" alt="Stars, engraving by M. C. Escher, from Wikipedia" width="220" height="271" />Recently, in my lovable know-it-all manner, I was holding forth on the idea that this diffraction effect&#8212;a mere accident of instrumental design&#8212;might actually be the source of the familiar iconographic star, with its five or six angular points. In other words, we think of a star as something spiky, poking out in various directions, because we&#8217;re used to seeing telescopic images with this diffractive defect. At right is <a href="http://en.wikipedia.org/wiki/Stars_%28M._C._Escher%29">M. C. Escher&#8217;s interpretation</a> of what <em>stellar</em> means. For other examples see the Hollywood Walk of Fame or the flags of the U.S. and the E.U. and those of <a href="http://en.wikipedia.org/wiki/Gallery_of_sovereign-state_flags">more than 50 other countries</a>, not to mention Texas.</p>
<p>Well, it turns out my cute idea about the cultural influence of telescopic photos is utterly bogus. If you need any evidence, the engraving reproduced below should suffice. It shows the muse Astronomia (a.k.a. Urania) pointing out the moon and stars to Ptolemy. The stars are five- or six-pointed scribbles that beg to be called <em>asterisks</em>. The engraving appears in the <a href="http://www.er.uqam.ca/nobel/r14310/Ptolemy/Reisch.html"><em>Margarita Philosophica</em> of Gregor Reisch</a>, published in 1504, which is a full century before Galileo turned his telescope to the heavens. Whatever those engraved stars are, they are not artifacts of telescope spider vanes.</p>
<p><img class="alignright" src="http://bit-player.org/wp-content/uploads/2011/12/ptolemy-and-astronomia-450.png" border="0" alt="Ptolemy and Astronomia with stars and moon from Margarita Philosophica 1504" width="450" height="572" /></p>
<p>The dictionary offers further evidence. For example, the <em>starfish</em> (genus <em>Asterias</em>, class <em>Asteroidea</em>) has had that name at least since 1538. And the <em>asterisk</em>&#8212;the typographical mark&#8212;has a citation in the OED going all the way back to 1382. These terms make sense only if the concept of a star was already associated in most people&#8217;s minds with a spiky polygon, rather than a dimensionless point of light in the night sky.</p>
<p>And that&#8217;s what puzzles me, because the stars really do appear to be dimensionless points of light. When I stare at the sky, I see some twinkling going on, but nowhere do I see pentagrams and hexagrams pinned to black velvet, or even the slightest hint of angularity. So where did this tradition get started? Did the Greek word ?????? already convey a sense of symmetrical spikiness, so that ancient Athenians would have understood why we call certain flowers <em>asters</em>? Is the same iconography prevalent in other cultures, say in China? Those 50+ star-studded flags (including China&#8217;s) suggest that the conventional stellar icon is at least recognized globally, but they don&#8217;t tell us where and when it all began. After my telescopic theory fell apart, I had a second hypothesis, namely that the star icon might come from the symbol-happy world of astrology, but I&#8217;ve found no support for this idea either. So I throw the question out to the starry void: How did the star get its points?</p>
<p><strong>Addendum 2011-12-16</strong>: The illuminating comments below on ancient Egyptian paintings of stars would appear to settle part of my question: Well over 2,000 years ago, at least some people were already drawing stars in much the same way a modern kindergartner does. What I&#8217;d still like to know is <em>why</em>. Yes, there are many plausible just-so stories, but you&#8217;d think that someone at the time might have offered a word of explanation.</p>
<p>The other day I spent a pleasant afternoon leafing through <em>The History and Practice of Ancient Astronomy</em>, by James Evans (New York: Oxford University Press, 1998). It&#8217;s quite a thorough introduction to Greek and Egyptian ideas about the sky, but I did not find an answer to my question about the points of stars. The astronomers of that period were engrossed in charting the positions and motions of the stars, but one gets the impression they had no interest whatever in the nature of those bright objects&#8212;what they look like up close, what they&#8217;re made of, why they shine. Of course I don&#8217;t really believe the ancients were so lacking curiosity. Surely Aristotle holds forth somewhere on the substance of the stars? But I haven&#8217;t found it yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://bit-player.org/2011/how-did-the-stars-get-their-points/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

