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

<channel>
	<title>the jsomers.net blog</title>
	<atom:link href="http://jsomers.net/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://jsomers.net/blog</link>
	<description>the jsomers.net blog</description>
	<lastBuildDate>Thu, 15 Dec 2011 05:11:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Watching Birds</title>
		<link>http://jsomers.net/blog/watching-birds</link>
		<comments>http://jsomers.net/blog/watching-birds#comments</comments>
		<pubDate>Tue, 16 Aug 2011 22:46:59 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=938</guid>
		<description><![CDATA[Something dangerous seems to happen when a person who likes to watch birds decides that they&#8217;re a birdwatcher. It&#8217;s the difference between doing something and doing some thing&#8212;where the latter has a structure to it, a stuffiness, that the former doesn&#8217;t. It&#8217;s the embrace of a complex of habits and equipment and dispositions and vocabulary, [...]]]></description>
			<content:encoded><![CDATA[<p>Something dangerous seems to happen when a person who likes to watch birds decides that they&#8217;re a birdwatcher. It&#8217;s the difference between doing something and doing some thing&#8212;where the latter has a structure to it, a stuffiness, that the former doesn&#8217;t. It&#8217;s the embrace of a complex of habits and equipment and dispositions and vocabulary, a kind of cancerous scaffold that threatens to swallow the building.</p>

<p>I worry about this mostly in the context of writing. I worry that someday&#8212;someday soon, maybe&#8212;I&#8217;ll start to think of myself as a writer, I&#8217;ll start to call myself a writer, and therefrom will not so much write as &#8220;write.&#8221; I&#8217;ll craft &#8220;pieces,&#8221; ply units of a branded trade, instead of trying to put thoughts into words.</p>

<p>There are concrete risks here. My style might get too much varnish on it. I might forget to be humble and curious. I might expect too much from an empty page (and start to fear it).</p>

<p>I hope like hell that doesn&#8217;t happen. I hope like hell I don&#8217;t birdwatch something that I ought to just do and live with, like the wise Paul R. Halmos:</p>

<blockquote>
  <p>As for writing&#8212;I write all the time, and I have done so as far back as I can remember. I write letters, from time to time I have kept diaries, and I write notes to myself, explicit ones with sentences, not just &#8220;try power series expansion&#8221; or &#8220;see Dunford-Schwartz for p > 1&#8243;. I think by writing. In college I wrote notes&#8212;that is, I transcribed abbreviations scribbled in class to legible and grammatical sentences. Later, when I started trying to prove theorems (the acceptably low-key phrase for the more stuffy-sounding &#8220;doing research&#8221;), I would keep writing, as if I were conducting a conversation between me and myself. &#8220;What happens if I restrict to the ergodic case? Well, let me see. I have already looked at what happens when S is ergodic, but the useful case is when both S and T are&#8230;&#8221; (page 8, <em>I Want to Be a Mathematician</em>)</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/watching-birds/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Toys</title>
		<link>http://jsomers.net/blog/toys</link>
		<comments>http://jsomers.net/blog/toys#comments</comments>
		<pubDate>Mon, 18 Jul 2011 05:22:26 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=922</guid>
		<description><![CDATA[Adults seem to have this idea that kids rifle through toys because of some problem that kids have, like short attention spans, when really it&#8217;s a problem that toys have. Not that they&#8217;re poorly made&#8212;some of these things are remarkably durable. It&#8217;s that a toy never quite measures up to what it was promised to [...]]]></description>
			<content:encoded><![CDATA[<p>Adults seem to have this idea that kids rifle through toys because of some problem that kids have, like short attention spans, when really it&#8217;s a problem that <em>toys</em> have. Not that they&#8217;re poorly made&mdash;some of these things are remarkably durable. It&#8217;s that a toy never quite measures up to what it was promised to be. It&#8217;s never quite as capable as it was in the commercials, never as sparkling or vibrant as its counterpart in the Original Motion Picture.</p>

<p>You have to keep in mind that kids are raised on cartoons. I certainly was. For several hours each day I did nothing except sit still and focus my full awareness on bright, lively characters, few of them human, as they wandered around imaginationscapes doing things that could never happen in the real world. My favorite was &ldquo;Teenage Mutant Ninja Turtles,&rdquo; a show about reptiles who stumble into a pool of radioactive ooze in the sewers of New York, develop humanoid bodies and brains, and save the world time and again from a talking brain who lives in the stomach of a stupid robot in a massive metallic weaponized sphere that was built in a place called Dimension X.</p>

<p>I suspended disbelief. In fact I always did&mdash;suspending disbelief was what I was best at then. For me, like for most kids, there was no sense in letting truth get in the way of a good time: I just wanted to hear about, or read about, or see or imagine worlds where interesting stuff happened, and whatever rules were conjured up to drive the action I&#8217;d happily swallow whole. Wishful thinking was my default mode. The bulk of my mental life was fantasy.</p>

<p>One example actually sticks out kind of vividly. I was six. I was hiding in the bow of a ship made out of tires&mdash;it was the centerpiece of our school&#8217;s new playground, the first sight of which was quite possibly the most ecstatic moment of my life. Anyway, I was hiding there and I suddenly got the idea, quite out of nowhere, that I was wearing these unusual boots, boots that not only made me faster but somehow more powerful, too. I thought to myself&mdash;and I really remember thinking this&mdash;that with these boots I would conquer the world. I felt the way Simba must have felt when his father told him that he would someday rule over &ldquo;everything the light touches.&rdquo;</p>

<p>When I rounded up my friends to show them the way to glory, naturally they played along. Not for a minute did they question my boots&mdash;instead, they riffed on the idea. The narrative snowballed.&nbsp; Soon enough we had new characters, new equipment and abilities, territories, a rapidly evolving status ladder, and all sorts of layered missions. It was all felt to be of the highest importance&mdash;we were playing, maybe, but we were very much <em>in</em> it, we had very much forgotten that we were all tiny and powerless and just starting grade school and that it was recess on a cold day and our fortress was made out of discarded rubber.</p>

<p>That was a constant theme: that underneath the apparatus of everyday life was some secret power; that the schoolyard and our parents and day camps and all the little business of little-kid life was a front to a more magical world, a world on the cusp of destruction or in need of a hero or otherwise burdened with something dramatically important; and that we would be the center of it all.</p>

<p>It&#8217;s hard to say where that kind of thinking comes from. Is it natural? Are the authors and screenwriters who produce so many variations on that theme just tapping into inborn archetypes? Or does the causal arrow run the other way: do kids weave these stories because of what&#8217;s &ldquo;in the air&rdquo;?</p>

<p>Whatever the case, there can be no doubt that we were absolutely immersed in the stuff. I for one grew up believing deeply in magic; magic was everywhere around me. It showed up in ghost stories and in fairy tales, at church and in the classroom. It showed up every time an adult tried to explain some phenomenon&mdash;what makes trees grow? what makes sloths slow?&mdash;but ended up explaining it away.</p>

<p>Santa Claus was a big one: I was made to believe, and I enjoyed believing, that my father was good friends with a man who lived at the North Pole and oversaw an impossible factory and knew whether I was swearing too much or &ldquo;instigating&rdquo; my brother. Every Christmas morning I marveled that he took a few bites out of the cookies we left the night before.</p>

<p>The list goes on: Dr. Seuss and Disney movies, science fiction, Pixar, Easter, Looney Tunes, Power Rangers, Harry Potter. Just about every piece of myth or media an American child consumes is shot through with magic in one form or another.</p>

<p>The trouble is, a ten-year old doesn&#8217;t just get swept away to these imagined worlds and then saunter back into his regular life. He can&#8217;t just cleanly bracket the fantasy. A ten year-old who reads about Hogwarts <em>wants to go there</em>, badly, and believes somewhere in the happy shadows of his mind that he one day will. That wonderful prospect might brew in his unconscious for years.</p>

<p>This is where toys come in. Toys promise to reify that fiction. They promise a tangible version of what you saw in your mind&#8217;s eye. To touch and even taste the &ldquo;real&rdquo; Harry Potter universe, you&#8217;re told, all it takes is a trip to Toys &#8216;R Us or Amazon.com for some officially licensed merchandise.</p>

<p>Imagine what a letdown it is to find that a $15 snitch can&#8217;t fly wildly of its own accord, that store-bought &ldquo;sorting hats&rdquo; can&#8217;t tell you who you truly are, that no combination of light and sound effects can make magic of a plastic wand. It&#8217;s like a pinch from a pleasant dream. You&#8217;re made to feel the distinctly childish sadness that comes from wishing what isn&#8217;t is, and being told it might be, and finding out that it wasn&#8217;t, can&#8217;t, and won&#8217;t.</p>

<p>It&#8217;s a disillusionment articulated especially well in Bill Watterson&#8217;s beloved comic strip, <em>Calvin and Hobbes</em>. The strip centers on the relationship between Calvin, a six year-old boy, and Hobbes, his supposed pet tiger. The two make a wonderful duo: Calvin is capricious, bold, creative, mischievous; Hobbes is witty, playful, sharp. Together they set out on extravagant adventures. But all of that fades when Calvin&#8217;s parents are in the frame. The spell is lifted; Hobbes transforms. He goes from being what Calvin needs him to be&mdash;something fantastical, a sassy wise rambunctious friend&mdash;into what he must be, what he actually <em>is</em>, which is just a goddamn stuffed animal.</p>

<p>That&#8217;s roughly what I have in mind when I say that toys are the emblem, the engine, of a special kind of disappointment, one that operates most keenly in the American childhood but lingers well longer&mdash;and manages still to sting.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/toys/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Leaving the village</title>
		<link>http://jsomers.net/blog/village</link>
		<comments>http://jsomers.net/blog/village#comments</comments>
		<pubDate>Sun, 08 May 2011 21:43:17 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=874</guid>
		<description><![CDATA[I&#8217;m starting to think that high school was the ideal social environment. Like most high schoolers I had a social network best described as a series of concentric circles, or maybe fuzzy overlapping halos: A group of just enough very close friends to fit around a single table at lunch Another handful of chums who [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to think that high school was the ideal social environment.</p>

<p>Like most high schoolers I had a social network best described as a series of concentric circles, or maybe fuzzy overlapping halos:</p>

<ul>
<li>A group of just enough very close friends to fit around a single table at lunch</li>
<li>Another handful of chums who I didn&#8217;t see as often outside of school</li>
<li>About a classroom&#8217;s worth of happy acquaintances who I talked to on a regular basis</li>
<li>The rest of my 120-person class</li>
<li>The rest of my school</li>
</ul>

<p>The key was that I interacted with these people every day. We were in the same building together for hours. And not through any effort on our part&#8212;we were actually forced into the arrangement.</p>

<p>I can&#8217;t emphasize how important that is. Socializing in high school was easy and continuous. Whether you were in class, on the bus, playing sports, eating, walking the halls, or lounging, you were engaged with people you had come to know well. In intervals of roughly an hour, the circle of people immediately around you&#8212;the classroom, team, whatever&#8212;was shuffled, but always chosen from the same distribution. You had a healthy balance of variety and stability.</p>

<p>That mode of interaction turns out to be quite natural. <a href="http://en.wikipedia.org/wiki/Dunbar%27s_number">We&#8217;re told</a> that 150 is &#8220;the estimated size of the typical neolithic farming village,&#8221; &#8220;the splitting point of Hutterite settlements,&#8221; and &#8220;the basic unit size of professional armies in Roman antiquity.&#8221; This is how people have evolved to operate: in a village. In a stable community of a hundred or so people with multiply intersecting sub-communities.</p>

<p>High school was a village. College wasn&#8217;t. Consider what my network looked like at the University of Michigan:</p>

<ul>
<li>Miscellaneous</li>
</ul>

<p>In the Miscellaneous category were all sorts of individuals or small groups I was close with at a particular time or in a particular context. There was the hall from my freshman dorm, the Indians who I drank and sang and smoked with (shisha and cigarettes), the ping pong kids, the kids I stayed up with playing Scrabble, that house I spent too much time at, my <a href="http://jimbojeopardy.com">Jimbo Jeopardy</a> opponents, the group I studied with junior year, the guy who I helped with game theory problem sets, the kid I played beer pong with over the summer, a former TA and squash partner, the guys I&#8217;d meet for beers and complex systems talk, people I saw in more than one class, the kids on my basketball team, etc.</p>

<p>These little unstable clusters would intersect from time to time, or drift, or break apart. There wasn&#8217;t much order to it.</p>

<p>We certainly never all came together under one roof. In fact, excepting the handful of people I lived with, spending time with people I knew took work. Not a <em>lot</em> of work, but some: I had to make plans, set up lunches, suggest parties to meet at. For the first time in my life I had to nurse relationships&#8212;or watch them fade.</p>

<p>After I graduated my network became even more fractured. My friends moved all around the world, strewn quite unpredictably into new cohorts in New York, Boston, Chicago, Ann Arbor, California, Dubai.</p>

<p>Two years out, I&#8217;m sharing a New York apartment with four friends from my high school lunch table. Outside that core my social life is an impoverished mess.</p>

<p>The first problem, of course, is that most of my friends don&#8217;t live here. To see them I have to travel. And I would most certainly give up those wonderful weekend trips with free lodging to have more friends within walking distance.</p>

<p>It also doesn&#8217;t help that my friendships now are structured just like my friendships in college&#8212;that is, without much structure at all&#8212;except that now everybody has a lot less free time. My friends are in serious jobs or graduate programs. They have to wake up early. They spend weekends with their families or girlfriends. It&#8217;s no longer easy, or wise, to blow six hours playing video games talking about Foucault, or whatever it was we did so much of in college.</p>

<p>Nor is there any longer a central peg, a cafeteria or classroom or dorm or library that we all might share in spite of our multiplex associations.</p>

<p>One rather large caveat is that I haven&#8217;t yet worked in a normal big office. I&#8217;ve either been at tiny companies, or worked from home, or spent half-days in-house as an independent contractor.</p>

<p>But I doubt I&#8217;d find what I&#8217;m after in the workplace. My friends with regular day jobs seem to enjoy their coworkers, and socialize with them, but still they spend most of their free time with &#8220;real&#8221; friends instead of &#8220;work people.&#8221; Probably this has to do with age differences&#8212;the work troupes my friends are in have just a few young people each; youth is spread across the firm.</p>

<p>For all that, though, I do know some people who manage to keep up a very rich social life. They&#8217;re gregarious. They put a lot effort into it: they call friends for coffees and drinks and dinners and all those little two-hour blasts of adult conviviality. They flit from group to group, attending to the ones they haven&#8217;t seen recently, putting air under the juggling balls that were about to fall.</p>

<p>But even in the best case an especially social young New Yorker might see each of his fifty or so friendly contacts an average of once every three weeks, or something like that, compared to the <em>every day</em> he would have seen them in high school.</p>

<p>You might say: way it goes, bud. We live in cities now, not villages. We run in cliques, not tribes.</p>

<p>Indeed I feel like I&#8217;m up against serious structural forces. I feel like it&#8217;s normal to split one&#8217;s day between intimates and near strangers, or to spend less than a couple hours per day just shooting the bull. I feel like the sort of track my friends and I are on is cutting against the sort of community I want, which is <em>my</em> community, my entire wonderful society of friends, all close and spending time together.</p>

<p>I guess I&#8217;ll have to wait for a wedding.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/village/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bits and Pieces</title>
		<link>http://jsomers.net/blog/teach-learn</link>
		<comments>http://jsomers.net/blog/teach-learn#comments</comments>
		<pubDate>Mon, 28 Mar 2011 01:15:55 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=865</guid>
		<description><![CDATA[A few months ago, a friend and I were talking about Sporcle, a popular website with moderately educational fill-in-the-blank quizzes. Their most popular page, for example, asks you to name the fifty United States. And here&#8217;s one that asks you to name thirty-two characters from The West Wing. There are many thousands more. My friend [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, a friend and I were talking about <a href="http://sporcle.com">Sporcle</a>, a popular website with moderately educational fill-in-the-blank quizzes. Their most popular page, for example, asks you to <a href="http://www.sporcle.com/games/states.php">name the fifty United States</a>. And <a href="http://www.sporcle.com/games/westwingcharacters.php">here&#8217;s</a> one that asks you to name thirty-two characters from The West Wing. There are many thousands more.</p>

<p>My friend thought Sporcle would be much improved if you could compete with other people in real time to fill out the quizzes. That way you&#8217;d turn lonely exercises into lively races.</p>

<p>Thinking this &#8220;multiplayer Sporcle&#8221; was a superb idea, I set out that night to build it. And remarkably I had a version that worked within three or four days, a feat I chalk up almost entirely to the <a href="http://www.theatlantic.com/technology/archive/2011/01/why-learning-to-fly-or-code-is-easier-than-you-think/69324/">deep brobdinagian complex of other people&#8217;s work</a> that supports every modern programmer.</p>

<p>As I&#8217;ve steadily hacked away at the project, taking nights and weekends here and there to push out a new feature, preen the code, style some pages, and so on, I&#8217;ve been mostly oblivious to the growing complexity of the whole thing&#8212;the mess of technologies now implicated in even the simplest user actions. Without paying it any mind, really, I&#8217;ve darted fluidly among dozens of languages and dialects and libraries, thinking so little of their differences as to be effectively writing the entire application, top to bottom, in a kind of computational mentalese.</p>

<p>What I mean is that as I tab around in my editor touching some jQuery, then some Ruby code, then HTML, and then tweak some Apache settings, and tune MySQL, and push some new EC2 instances, and rewrite DNS entries, and thin out my Rails controllers, and wrap ActiveRecord around a Redis model, and rejigger some Capistrano recipes, and rethink my Passenger config, and on and on, the whole thing feels rather frictionless&#8212;I zip through each modal border-crossing like a well-heeled diplomat. I just slip from one file to the next, thinking mostly about what my application does, assembling the different pieces like so many LEGO bricks.</p>

<p>I hadn&#8217;t thought about how extraordinary this was until I took on a small handful of students (thanks, <a href="http://tutorspree.com">Tutorspree</a>!), some of whom have never programmed before, and tried to look at my code the way they do. It&#8217;s been a fascinating exercise.</p>

<p style="text-align: center; margin:0 auto; margin-bottom: 10px;">* * *</p>

<p>I have long known that teaching exposes what you don&#8217;t know. As you hazard an explanation or answer an unanticipated question, the cruft dissolves, leaving only what you understand well enough to describe in crisp, detailed English. Often it&#8217;s not much. I can&#8217;t tell you how many times I&#8217;ve begun to &#8220;explain&#8221; something only to stumble when my vague gist proves too shallow&#8212;too slippery&#8212;to render concretely.</p>

<p>What&#8217;s new for me, though, with these little compu-tutoring sessions, is seeing how much I <em>do</em> know. It turns out that after five years of programming in stints variously sporadic and immersive my brain has been colonized by fertile strains of cognitive tropes, skills, ideas, incantations, metaphors, and analogies that I never knew were there. Silent invaders.</p>

<p>It&#8217;s strange because I spend most of my time at the computer feeling like I&#8217;m faking it, pretending I know what the hell I&#8217;m doing but looking everything up along the way, frantically assembling the very ladder I&#8217;m climbing.</p>

<p>As it happens I&#8217;m a lot higher than I thought. It first hit me when I opened an old Rails project, hoping to walk through the high-level basics with a student looking to get into Web programming. Literally every file I fired up and every line I pointed to was for her a wonderful mystery. She didn&#8217;t know the difference between HTML, CSS, and Javascript. She wondered what Gmail was made of. She asked me what UTF-8 and the W3 were, and why they showed up at the top of most web pages (I got her in the habit of hitting &#8220;view source&#8221;), and what a DTD file is and who makes them, and what sorts of tags there were, and where all the names come from.</p>

<p>She wanted to know why the words on this tab had all those curly braces when the words on <em>that</em> tab didn&#8217;t. She asked what all the colors meant. She wanted to know why there were so many different languages that seemed to do the same things. She asked what you <em>couldn&#8217;t</em> do in a browser. She had heard of &#8220;servers&#8221; before, but not &#8220;clients,&#8221; and wanted me to walk her through what happens when you submit a form. She wondered what the Internet actually was.</p>

<p>When we started writing code together, she was deeply impressed by the idea of storing values in variables instead of copying and pasting them. She loved how programmers all use each other&#8217;s code, though she worried about running modules and libraries without knowing how they worked. She seemed intuitively drawn to the <a href="http://www.faqs.org/docs/artu/ch01s06.html">Unix philosophy</a>.</p>

<p>We found that she could read some of my code right away&#8212;stuff like SQL queries and <code>for</code> loops&#8212;and some not at all (like functional Javascript, Rails models, and some <a href="http://projecteuler.net">Project Euler</a> solutions).</p>

<p>She stopped me in the middle of a tangent: do people really write all that &#8220;view source&#8221; stuff <em>by hand</em>, in colorful notepads like the one you have open? What&#8217;s Dreamweaver do? Why do pages look different in different browsers? Where are the actual titles and articles and pictures coming from? Where are they stored? And what <em>is</em> a database, exactly? How is it different from an Excel spreadsheet?</p>

<p>With all these questions I started to get the feeling I sometimes get when I see new skiers bumble down the mountain: thank God I learned this stuff already. It all seems entirely too big. I could scarcely imagine starting from scratch.</p>

<p>But of course it&#8217;s not so bad. If my student sticks with it, she&#8217;ll learn just the way I did. She&#8217;ll dip into something&#8212;a fun little project or time-saving utility&#8212;and struggle, and struggle, and somehow get it working.</p>

<p>Along the way she&#8217;ll pick up accidental bookfuls of hard knowledge: the basics of HTTP and TCP, how servers work, what OOP is for, how to configure Apache and Nginx and Haproxy and Memcache and Mongrels, how caching works, what hashes and lists and integers and floats all do, why some languages type statically and others dynamically, how to use higher-order functions, how to do file I/O, what to do with pipes, the rationale behind MVC, what&#8217;s &#8220;cascading&#8221; about cascading style sheets, the wonder of LISP macros, how to slice images and minify Javascripts, what the DOM is and how jQuery tames it, how to manage code with Git or Subversion, who Knuth is, how to sort integers and find shortest paths&#8230;</p>

<p>And her brain will be invaded just like mine with all sorts of &#8220;soft&#8221; knowledge. She&#8217;ll become intimately acquainted with the bedrock principles of the craft. She will learn <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">Not to Repeat Herself</a> and that &#8220;clarity is better than cleverness.&#8221;</p>

<p>She&#8217;ll learn to pack complexity into data, not code. She&#8217;ll fuss over the names of things and aim high on readability. She&#8217;ll struggle to cut her problems at their natural joints.</p>

<p>She will develop an uncanny ability to scan API documentation for the precise methods she needs now and to skim for others that might come in handy. She&#8217;ll start to sense when some part of the problem she&#8217;s working on must have been solved by someone else, and she&#8217;ll know how to find and incorporate the stranger&#8217;s solution. Her eyes will start snapping to just the right line in error traces.</p>

<p>As her toolkit grows, so too will the space of possible programs she can build. She&#8217;ll increasingly find herself daydreaming about unborn projects, imagining their concrete mechanics.</p>

<p>She&#8217;ll progress from not really perceiving the distinctions among so many technologies and acronyms, to being scared by the plenitudes, to seeing them as so many variations on familiar themes.</p>

<p>All the while she&#8217;ll marvel at how little she knows, and not long after, at all she has to teach.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/teach-learn/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>On the elusiveness of Uppercase Things</title>
		<link>http://jsomers.net/blog/uppercase</link>
		<comments>http://jsomers.net/blog/uppercase#comments</comments>
		<pubDate>Wed, 02 Mar 2011 08:50:57 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=846</guid>
		<description><![CDATA[A few days after I loaned the excellent The Man Who Loved Only Numbers: The Story of Paul Erdős and the Search for Mathematical Truth to a friend, I received a note highlighting a sentence that he said contained &#8220;a preposterous number&#8221; of some of his favorite words: In the ninth century, nomadic Magyar warriors [...]]]></description>
			<content:encoded><![CDATA[<p>A few days after I loaned the excellent <em>The Man Who Loved Only Numbers: The Story of Paul Erdős and the Search for Mathematical Truth</em> to a friend, I received a note highlighting a sentence that he said contained &#8220;a preposterous number&#8221; of some of his favorite words:</p>

<blockquote>
  <p>In the ninth century, <strong>nomadic Magyar</strong> warriors from the <strong>steppes</strong> of Eastern Europe crossed the <strong>Carpathian</strong> Mountains and, renouncing their <strong>peripatetic</strong> way of life, settled in the middle <strong>Danube</strong> basin at the heart of what is now Hungary.</p>
</blockquote>

<p>His comment surprised me, not because I don&#8217;t equally enjoy the sounds and flavors of that sentence, but because I almost certainly ignored them all the first time I read it. In fact, for me this was probably one of the least interesting sentences in the book, so uninteresting that my glossing over it was an unconscious non-event. It&#8217;s just a part of the way I read.</p>

<p>Here&#8217;s another example: if I&#8217;m reading a law review article and the name of a case comes up, and the case isn&#8217;t something I&#8217;ve heard of before like &#8220;Brown v. the Board of Education,&#8221; I don&#8217;t put any effort into mentally assigning the new name <em>X</em> to the content of the paper, claim, context, etc. I treat the name <em>X</em> as a kind of local variable. That is, the only sense in which you could say I&#8217;ve cognized it is that if two sentences in different parts of <em>this paper</em> both said something about <em>X</em>, I&#8217;d recognize that they shared their referent; but the moment I move on to something else, that nascent &lt;word, object&gt; pair dissolves.</p>

<p>The same thing happens when I read a long technical blog post about, say, tax policy. I pay zero attention to basically anything in capital letters: the names of various plans, their proponents, the states where certain pieces of the plans are in play, etc. I treat these strings as happy little warp-slides I can safely zoom past.</p>

<p>Maybe more alarmingly&#8212;and tellingly&#8212;the same thing happens with mathematics. Unless I&#8217;m specifically reading an article as a way of learning a piece of math, or the math in an article is so simple that it can be parsed at something close to regular speed, I skip it.</p>

<p>So now we have our first obvious explanations: (a) James is lazy, and/or (b) James goes into these articles at a certain level of abstraction, and both the Capitalized Names and mathematics are below that level. So James ignores them.</p>

<p>That probably does most of the explanatory work. But there are other possibilities.</p>

<p>One is that I have pretty bad recall. It probably hurts my recall to think it&#8217;s bad (apparently recall performance has been pegged to self-perception of recall performance), but whatever, my memories just don&#8217;t seem to be indexed by names or dates the way they are for some people.</p>

<p>So one theory is that because I have such low expectations about remembering things like names and dates, I simply don&#8217;t pay attention to them. In other words, because my brain wants to put strings like &#8220;Magyar warriors&#8221; or &#8220;Ashcroft v. Iqbal&#8221; into the <code>to-memorize</code> queue&#8212;this it does because Capitalized Strings are often <em>just</em> names, vs. concepts or narratives or ideas which can fold their way into the brain in a more natural sort of way just by nestling into the appropriate associative context&#8212;and because my <code>to-memorize</code> queue is run by a bunch of idiot half-a-loafs, I discard them as a way of saving energy.</p>

<p>Example: I often ignore lists. When a writer says that some economic theory has been tremendously successful in explaining behavior in Germany, Austria, Japan, and Norway, I think my eyes literally jump over the List, Of, Capitalized, Country, Names much faster than over the stuff explaining the theory, or the stuff explaining what elements of that list have in common.</p>

<p>In the short run that shouldn&#8217;t hurt me because with any luck, the more conceptual-narrative-imagistic-flowcharty lowercase kind of knowledge <em>does</em> stick with me and is indexed analogically against other concepts of the same kind, etc. But in the long run, I&#8217;ve lost the information that lowercase concepts <em>x</em> and <em>z</em> are tied to Norway and Japan.</p>

<p>Note also that this strategy is path-dependent: if early on you develop the habit of discarding names and dates, you won&#8217;t have a lot of them swirling around, which means that when you later run across new instances in new contexts, you won&#8217;t have a rich index to cross-reference against, and so you won&#8217;t be able to build organized stores of knowledge about particular things. I think that effect could turn out to be pretty important.</p>

<p>The normative upshot is that I could probably do with a <em>ton</em> more history, where this time around I actually pay attention to the dates, because timelines are a tremendously useful organizing concept&ndash;knowledge template, and I have this black hole where I should have the context that most of my friends seem to carry around.</p>

<p>It also means that <a href="http://sporcle.com">Sporcle</a> and Quiz Bowl and all this nonsense, in which I have essentially zero interest because I&#8217;m so terrible at it, could turn out to be cognitively really important just as a way of ordering what would otherwise be loosely overlapping fact miasmas.</p>

<p>To circle back a bit, I want to ask this question about my friend&#8217;s Erdős sentence: could it be rewritten such that I, with my current readerly quirks, would want to underline it? Initially I thought it could, maybe by extracting the conceptual/lowercase content into its own sentence and doing a sort of &#8220;for example&#8221; to introduce all the names and dates. But in this case there&#8217;s really nothing to extract. The lowercase content is that &#8220;peripatetic warriors crossed mountains to settle near a river.&#8221;</p>

<p>Maybe that&#8217;s the upside to my handicap: a mind unencumbered by Uppercase Things can focus on meat and mechanisms. But then again, maybe that&#8217;s just Wishful Thinking.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/uppercase/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Spillage</title>
		<link>http://jsomers.net/blog/spillage</link>
		<comments>http://jsomers.net/blog/spillage#comments</comments>
		<pubDate>Mon, 28 Feb 2011 01:29:38 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=773</guid>
		<description><![CDATA[[Composed on March 12th, 2010, at 2:17 in the morning.] I&#8217;m very tired. I&#8217;m writing, though, to keep a streak alive: one hour per day, every day. Last month I did twenty-four days in a row. Tonight will be my sixth. I&#8217;m shooting for hundreds. Writing under these conditions can have you producing crap in [...]]]></description>
			<content:encoded><![CDATA[<p>[Composed on March 12th, 2010, at 2:17 in the morning.]</p>

<p>I&#8217;m very tired. I&#8217;m writing, though, to keep a streak alive: one hour per day, every day. Last month I did twenty-four days in a row. Tonight will be my sixth. I&#8217;m shooting for hundreds.</p>

<p>Writing under these conditions can have you producing crap in no time. But creative writing teachers and professional authors actually encourage this sort of meandering associative spillage. They say it&#8217;s okay to write with abandon as long as you clean it up later. All writing is rewriting, they say.
<br /><br /></p>

<p>When I play squash I love to go after cutesy drop shots and boasts. Part of it is that it&#8217;s fun to feel as though I&#8217;m finessing the ball, and part of it is that these shots are devastating when they succeed.</p>

<p>But they rarely do. That&#8217;s why my coach urged me to hit deep solid drives instead. Those I could more reliably control; they were easier to practice; and when they failed, I wouldn&#8217;t be left totally exposed.</p>

<p>Writing can work the same way. I like to compose long, breathy sentences, sentences packed with commas and clauses in an effusion of iambic feet, the sort of sentences that build, in a meandering prosodic way, a feeling in the reader of tension&#8212;eased by an interruption&#8212;that predictably unwind, rhythmically beat by beat, toward a quick but satisfying end.</p>

<p>It&#8217;s hard to stop writing like that once you start. You sort of have to snap yourself out of it: keep things short and punchy. That&#8217;s what I&#8217;m doing right now. These sentences are my writerly attempt to hit solid deep balls to the corner. Are they working?</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/spillage/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Project Euler problem 191, or, how I learned to stop counting and love induction</title>
		<link>http://jsomers.net/blog/project-euler-problem-191-or-how-i-learned-to-stop-counting-and-love-induction</link>
		<comments>http://jsomers.net/blog/project-euler-problem-191-or-how-i-learned-to-stop-counting-and-love-induction#comments</comments>
		<pubDate>Fri, 25 Feb 2011 05:51:18 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=839</guid>
		<description><![CDATA[Of the 142 Project Euler problems I&#8217;ve battled so far, it may just be that #191 has put up the most interesting fight, not because the problem itself was all that difficult or unusual or enlightening, but because the road to solving it&#8212;seven to ten hours of work, seven sheets of paper, several trips to [...]]]></description>
			<content:encoded><![CDATA[<p>Of the 142 <a href="http://projecteuler.net">Project Euler problems</a> I&#8217;ve battled so far, it may just be that <a href="http://projecteuler.net/index.php?section=problems&amp;id=191">#191</a> has put up the most interesting fight, not because the problem itself was all that difficult or unusual or enlightening, but because the road to solving it&#8212;seven to ten hours of work, <a href="http://jsomers.net/pe-191-work.pdf">seven sheets of paper</a>, several trips to the <a href="http://oeis.org">online encyclopedia of integer sequences</a>, three or four minor insights, and one major breakthrough&#8212;was for me almost a paradigm of puzzle-solving, or, closer to the point, a paradigm of how a mathematically crippled mistake-prone dabbler like myself solves puzzles.</p>

<p>Here&#8217;s the problem statement that kicked it all off:</p>

<blockquote>
  <p>A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize.</p>
  
  <p>During an n-day period a trinary string is formed for each child consisting of L&#8217;s (late), O&#8217;s (on time), and A&#8217;s (absent).</p>
  
  <p>Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:</p>

<pre><code>  OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
  OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
  AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
  AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
  LAOO LAOA LAAO
</code></pre>
  
  <p>How many &#8220;prize&#8221; strings exist over a 30-day period?</p>
</blockquote>

<p>I encourage you to give it a shot. If you&#8217;ve solved lots of puzzles like this in the past, you&#8217;ll probably be able to cook up a solution in under an hour. If not, expect to spend an afternoon or two scratching out all sorts of cases and conditions and combinatoric formulations. Either way it should be a great deal of fun.</p>

<p>When I first saw the problem I had only two approaches in mind:</p>

<ol>
<li><p>If we let <code>n</code> be the number of days, we know that there are 3<sup>n</sup> possible strings of <code>O</code>s and <code>A</code>s and <code>L</code>s. To find the number of &#8220;prize&#8221; strings, then, all we have to do is <em>subtract</em> from 3<sup>n</sup> the number of strings that <em>couldn&#8217;t</em> be winners.</p></li>
<li><p>Or, we could go the constructive route and try to only count prize strings.</p></li>
</ol>

<p>Intuition told me that the first way would be a lot easier, so that&#8217;s the way I went.</p>

<h3>A first crack</h3>

<p>The problem statement helps us out by giving the solution to a small case, <code>n</code> = 4, which we can use to validate our approach before ramping up to the much trickier case where <code>n</code> = 30.</p>

<p>What we&#8217;re trying to do is enumerate all of the strings with either the substring <code>AAA</code> or two or more not-necessarily-adjacent <code>L</code>s, because these are the strings that are <em>ineligible</em> for a prize. We know that we have 3<sup>4</sup> = <strong>81</strong> possible strings to begin with, and from the problem statement we&#8217;ve been told that <strong>43</strong> of these are prize strings, so whatever rules or program we come up with to prune them should wipe out exactly <strong>38</strong> (=81 &#8211; 43).</p>

<p>At a first pass I mustered the following rough (and wildly incorrect) count:</p>

<ul>
<li>There are exactly <strong>two</strong> strings containing <code>AAA</code>.</li>
<li><strong>Six</strong> strings contain two <code>L</code>s, a number I arrived at by taking &#8220;4 choose 2&#8243;, or 4!/2!2!</li>
<li><strong>Four</strong> strings have three <code>L</code>s (by the same argument as the two-<code>L</code> case).</li>
<li><strong>One</strong> string has four <code>L</code>s (ditto).</li>
</ul>

<p>Unfortunately that left me with only <strong>thirteen</strong> candidates for elimination, far short of required <strong>43</strong>. Can you see what I was doing wrong?</p>

<p>I left out a whole lot of permutations! Each of the cases above is actually <em>under-specified</em>, in the sense that there are multiple strings that could satisfy the given condition. For example, although I said there were only two strings containing <code>AAA</code>, there are actually a lot more, because each template&#8212;<code>AAA_</code> or <code>_AAA</code>&#8212;can be completed with any one of <code>O</code>, <code>L</code>, or <code>A</code>. Similarly, in cases where we&#8217;re counting <code>L</code>s, we need to remember that the spots <em>without</em> <code>L</code>s can have either an <code>O</code> or an <code>A</code>, so that each <code>L</code>-template really has 2<sup>k</sup> possible fillings, where <code>k</code> is just the number of non-<code>L</code> spots.</p>

<h3>Trouble looms</h3>

<p>Are you beginning to smell the complexity?</p>

<p>Consider the rule for counting strings with an <code>AAA</code> in them. Even if you multiply 2 (for the two templates <code>AAA_</code> and <code>_AAA</code>) by 3 (because in each template you can have three possible fillings: <code>O</code>, <code>L</code>, or <code>A</code>), you&#8217;re still incorrectly counting the number of ineligible strings. In particular, you&#8217;ve <em>double-counted</em> the case where an <code>A</code> fills the blank, because regardless of which template you use, you end up with the same string <code>AAAA</code>.</p>

<p>At first this might not seem like a big deal, but that little <code>AAAA</code> snag and others like it will turn out to be major wrenches in the works, hitches enough to drive me into what an impartial observer might have described as hours of psychotic numerology.</p>

<p>The trick is to see what happens when you crank <code>n</code> up to 30. Remember what we&#8217;re trying to do: ultimately, we want the number of eligible prize strings. To wit, we want to first count the <em>non</em>-prize strings&#8212;the number of strings with three or more <code>A</code>s in a row (<code>LOOAAAO...</code>, <code>...AAAAO</code>, <code>L...AAAAAAOO...O</code>, etc.) or two or more <code>L</code>s (<code>OAAL...AOLO</code>, <code>AOOLLALLL...</code>, etc.)&#8212;and then subtract that number from 3<sup>30</sup>, the number of total possible strings.</p>

<p>Suppose we start by trying to count the first type of string, the ones with a bunch of <code>AAA</code>s in them. At some point we&#8217;re going to run into a string that <em>also</em> has a few <code>L</code>s, and it&#8217;s important that we somehow keep track of when this happens. If not, we&#8217;ll end up counting such a string twice, first when we go through looking for <code>AAA</code>-style strings and second when we look for strings with multiple <code>L</code>s.</p>

<p>This is exactly the kind of bookkeeping you don&#8217;t want to run into when hacking on a combinatorics problem, because it almost always means you&#8217;ve taken a wrong turn. Project Euler is careful to choose problems that <em>can</em> be solved elegantly, usually with less than ten lines of code, so it&#8217;s a major red flag anytime you&#8217;ve got <a href="http://jsomers.net/pe-191-work.pdf">pages</a> of branching cases and ad hoc &#8220;rules.&#8221;</p>

<h3>Divide and conquer?</h3>

<p>At this point I probably should have gone back to square one. Instead, though, I hatched what I thought was a workable game plan: I&#8217;d avoid the double-counting issue by breaking those non-prize strings into mutually exclusive sets.</p>

<p>I&#8217;d proceed in three steps:</p>

<ol>
<li>First, count the strings of length 30 with two or more <code>L</code>s in them. The non-<code>L</code> spots in these strings can filled any whichway. They can even have runs of three or more <code>A</code>s in a row&#8212;it doesn&#8217;t matter.</li>
<li>Second, count all of the strings with runs of <code>A</code>s in them that <em>also</em> don&#8217;t have any <code>L</code>s. So we&#8217;re just considering the length-30 strings with some mix of <code>O</code>s and <code>A</code>s, and counting only the ones that include three or more <code>A</code>s in a row.</li>
<li>Finally, count all of the strings with three or more <code>A</code>s in a row that <em>also</em> have <em>exactly one</em> <code>L</code> in them.</li>
</ol>

<p>Do you see how that works? The trick is that we&#8217;re taking care of all the messy stuff in Step 1, and restricting ourselves in Steps 2 and 3 to small precise collections of ineligible strings&#8212;strings where <em>only</em> the <code>AAA</code>s matter. So our three sets are guaranteed, by construction, not too overlap with one another.</p>

<p>So much for the theory&#8212;at a certain point one has to actually <em>count</em> these things, either with a formula or a simple program. Will my sets be well enough behaved, or will they too have all sorts of quirks and caveats?</p>

<p>I tamed the first set rather quickly. It turned out that counting those strings, the ones with with two or more <code>L</code>s, was simply a matter of taking a sum from <em>i</em> = 2 to <em>i</em> = 30 of &#8220;30 choose <em>i</em>&#8221; * 2<sup>(30 &#8211; <em>i</em>)</sup>.</p>

<p>That first term, &#8220;30 <a href="http://en.wikipedia.org/wiki/Combination">choose</a> <em>i</em>,&#8221; just counts the number of ways of arranging <em>i</em> <code>L</code>s in a string with 30 different spots. For <em>i</em> = 3 it would count the number of templates that look like <code>__L...L_..._L</code> or <code>LL__...L...</code>, i.e., templates with exactly three <code>L</code>s in them. The second term just counts the number of possible fillings-in of each template: for each spot there are by assumption two choices (<code>O</code> or <code>A</code>), and each template has 30 &#8211; <em>i</em> open spots (spots without an <code>L</code> in them).</p>

<p>The second set is a lot more complicated, but once I thought about it I was immediately reminded of another Project Euler problem, one I&#8217;d worked on&#8212;without solving&#8212;just a few weeks before. It was problem <a href="http://projecteuler.net/index.php?section=problems&amp;id=114">#114</a>.</p>

<h3>Old friends and new</h3>

<p>One way to see the correspondence is to imagine the red blocks in problem #114 as <code>A</code>s and the black ones as <code>O</code>s. If you solve it for n = 30, then, you&#8217;ve implicitly solve my Step 2 above, because you&#8217;ve counted the number of strings with at least one run of three or more <code>A</code>s and no <code>L</code>s.</p>

<p>Or so I thought. What you&#8217;ve actually done is <em>undercounted</em> those strings by a huge margin, because you&#8217;ve left out strings where an <code>A</code>&#8212;a red block&#8212;fills one of the spots not already covered by a <em>run</em> of <code>A</code>s. Problem #114 explicitly requires that the <em>only</em> red blocks you can have must appear in runs of three or more. You can&#8217;t, in other words, have stragglers.</p>

<p>You can imagine what I did next. I tried not only to solve #114, a problem I couldn&#8217;t crack weeks earlier (even with the help of a mathematically-inclined friend who wanted to chip in), but to do so knowing full well it&#8217;d only get me partway toward a solution to the problem at hand&#8212;thanks to those straggler <code>A</code>s. It cost me about two hours of mostly unnecessary work, an expense I would have avoided if I had never seen #114 in the first place. It was an unlikely lesson: drawing on experience can sometimes do more harm than good.</p>

<p>After scrapping that angle I decided to do something a bit ignoble. I decided to write some code to exhaustively spit out trinary strings, not of length 30&#8212;such a program would take weeks to run&#8212;but for small <code>n</code>s. For each <code>n</code> I&#8217;d keep a count of the number of strings that would fall into each of the sets I named above, with a specific focus on the strings in Step 2: strings with zero <code>L</code>s and at least one run of three or more <code>A</code>s in a row. I&#8217;d then take that partial series and plug it into the <a href="http://oeis.org">Online Encyclopedia of Integer Sequences</a>. If I hit a match I might be able to steal a nice clean formula.</p>

<p>(I&#8217;ve raved <a href="http://jsomers.net/blog/pe-oeis">elsewhere</a> about the OEIS, so I won&#8217;t do that again here. Suffice it to say it&#8217;s an invaluable resource and a constant temptation when working on Project Euler problems. One must use it sparingly and as a last resort.)</p>

<p>Much to my delight, the very sequence I had generated was chronicled in great detail on the OEIS as sequence <a href="http://oeis.org/A050231">#A050231</a>, &#8220;the number of n-tosses having a run of 3 or more heads for a fair coin.&#8221;</p>

<p>Yoink!</p>

<h3>Descent into madness</h3>

<p>&#35;A050231 was a huge boon&#8212;rather than computing the count in Step 2 above, I could literally copy and paste the correct value from a list someone else had already generated and posted to the OEIS. And with that I was only one term away from a full solution. All that was left was to work through Step 3: counting strings just like the ones in Step 2 that also include a single <code>L</code>.</p>

<p>When you think about it, it actually seems like a trivial modification could get you from the strings that A050231 is counting to the strings that also include a single <code>L</code> (call them <code>L</code>-strings). To get the number of <code>L</code>-strings, all you have to do is to take each A050231-string&#8212;each string of <code>A</code>s and <code>O</code>s&#8212;and multiply it by the number of <code>O</code>-spots (as opposed to <code>A</code>-spots), those being precisely the spots where you can put the <code>L</code>. As an example, for the A050231-string <code>OAAAOAOAAAA</code> I would have three corresponding <code>L</code>-strings, <code>LAAAOAOAAAA</code>, <code>OAAALAOAAAA</code>, and <code>OAAAOALAAAA</code>, one for each <code>O</code>-spot.</p>

<p>But since I wasn&#8217;t man enough to generate A050231 myself, and so didn&#8217;t understand its structure at anything but the shallowest level, I had no way of doing that simple multiplication, because for each <code>n</code> I only knew the number of A050231-strings, without knowing how many <code>O</code>-spots each of them contained.</p>

<p>So after fumbling around the OEIS for just over an hour trying to find some code or sequence or math that might get me those numbers, I was left seemingly without a way out. But instead of dropping the idea, I decided to work it out in painstaking detail. I decided to work out a sequence that tracked, for each string of length <code>n</code>, (a) the number of ways of arranging <code>A</code>s, with the proviso that each &#8220;way&#8221; must include a run of three or more, and (b) the number of empty spots (<code>O</code>-spots) in each of these arrangements. I&#8217;d then look for patterns.</p>

<p>You can see the insane work that came out of this insane project by looking at pages 1 and 2 <a href="http://jsomers.net/pe-191-work.pdf">in this PDF of scratch paper</a>. The &#8220;crazy-person triangles&#8221; that resulted include a list of comma-separated terms for each <code>n</code>, where the large numbers specify the number of <code>O</code>-spots we&#8217;re working with (call it <em>k</em>) and the subscripts count the number possible arrangements of Type 2 strings&#8212;<code>A</code>s and <code>O</code>s and at least one run of three or more&#8212;for each of those <em>k</em>s. (I&#8217;m pretty sure only the second triangle is correct, which is why I went on to larger <code>n</code>s with it. It&#8217;s been long enough since I did this work, though, that I don&#8217;t really know what I was thinking or what&#8217;s actually going on in the first triangle.)</p>

<p>I used a helper script to compute those subscripts as <code>n</code> and <em>k</em> increased. I had to stop after <code>n</code> = 14 or so, both because I was running out of space on the page and because the subscripts were taking too long to generate. But even with eleven different rows of numbers, I wasn&#8217;t able to find any meaningful patterns. I did find all sorts of <em>un</em>meaningful patterns, mostly by subtracting sequences of numbers and then recursively subtracting the differences until I hit some sort of constant or steady state; but I&#8217;m pretty sure <em>any</em> sequence can degrade that way after enough &#8220;diffs of diffs.&#8221; You can see on page 2 of my scrap work that I came upon a few promising generating formulas, both horizontally (as <em>k</em> varies) and vertically (as <code>n</code> varies), but nothing panned out.</p>

<h3>The clouds part</h3>

<p>After all that&#8212;after <em>all</em> that&#8212;I decided to scrap the work I&#8217;d done so far and take another tack. Because it hit me like a ton of bricks: I should be solving this problem inductively.</p>

<p>Think about it this way. Suppose I know how exactly how many prize strings there are for a given <code>n</code>. Now increment <code>n</code> by one. What changes?</p>

<p>Well, there are only three letters that can be added to a given string: <code>O</code>, <code>A</code>, and <code>L</code>. If I add an <code>L</code> to a string that already <em>has</em> an <code>L</code>, all of a sudden that string becomes ineligible; same thing if I add an <code>A</code> to a prize string ending in <code>AA</code>. If I had an <code>O</code> to <em>any</em> string, it has no effect. If I add any letter to an ineligible string, it stays ineligible. Etc.</p>

<p>It&#8217;s starting to sound like all we need to do, then, is keep counts of certain string &#8220;types&#8221;&#8212;strings ending with <code>AA</code>, strings with one <code>L</code>, ineligible strings, etc.&#8212;and formulate rules for how these counts change each time we increment <code>n</code>.</p>

<p>That&#8217;s exactly what I did. After lots of trial and error, I determined that I needed to track <strong>six</strong> different types of special strings:</p>

<ol>
<li>Eligible strings ending in <code>AA</code>.</li>
<li>Eligible strings with zero <code>L</code>s.</li>
<li>Eligible strings ending in <code>A</code> (and <em>only</em> <code>A</code>).</li>
<li>Eligible strings ending in <code>AA</code> that also have exactly one <code>L</code>.</li>
<li>Eligible strings ending in <code>A</code> that also have exactly one <code>L</code>.</li>
<li>Eligible strings with one <code>L</code> that don&#8217;t end in <code>A</code>.</li>
</ol>

<p>It turns out that just this set of strings, call them <em>a</em> through <em>f</em>, are enough to keep an accurate accounting of prize strings as you increment <code>n</code> all the way up to 30.</p>

<p>An example should illustrate the method. Take <em>c</em>-strings, strings that end in a single <code>A</code>. Suppose that when <code>n</code> = 3 we have exactly <strong>five</strong> of them (we do: they&#8217;re <code>OOA</code>, <code>AOA</code>, <code>LOA</code>, <code>OLA</code>, and <code>ALA</code>). What happens to that count (<strong>5</strong>) when we increment <code>n</code>? Well, we have to consider three cases, one for each of the possible new letters <code>O</code>, <code>A</code>, and <code>L</code>.</p>

<p>(Keep in mind that what we&#8217;re doing in each case is essentially generating 3<sup>n + 1</sup> new strings&#8212;that is, we&#8217;re taking each of the 3<sup>n</sup> strings we have and appending one letter (<code>O</code>, for instance) to all of them. Do that three times and we have our full round of strings for the <code>n</code> + 1 case, because 3<sup>n</sup> * 3 is 3<sup>n + 1</sup>. I say &#8220;essentially&#8221; above because what we&#8217;re <em>really</em> doing is generating 3 * <code>t</code> new strings, where <code>t</code> is the number of <em>eligible</em> (prize) strings for a given <code>n</code>. We ignore ineligible strings.</p>

<p>Either way, the question is how many of these new <code>-O</code> strings and <code>-L</code> strings and <code>-A</code> strings are of type <em>c</em>.)</p>

<ul>
<li>Case <code>O</code>: If we add an <code>O</code> then all of the five eligible strings that used to end in a single <code>A</code> no longer end in a single <code>A</code>. And all of the strings that <em>didn&#8217;t</em> end in a single <code>A</code> still don&#8217;t. So the net effect of the <code>O</code>s is to decrease our count by 5.</li>
<li>Case <code>L</code>: This works the same as the <code>O</code>, obviously. A net loss of 5 <em>c</em>-strings.</li>
<li>Case <code>A</code>: If we add an <code>A</code> to one of the five <em>c</em>-strings, it&#8217;ll no longer be a <em>c</em>-string. But if we add an <code>A</code> to any of the <em>other</em> strings it will <em>become</em> a <em>c</em>-string. So there&#8217;s a net gain here of <code>t</code> &#8211; 5.</li>
</ul>

<p>So we have a total number of ((<code>t</code> &#8211; 5) &#8211; 5) &#8211; 5 <em>c</em>-strings in our next round, which for <code>n</code> = 3 is ((27 &#8211; 5) &#8211; 5) &#8211; 5 = <strong>12</strong>. If you were to enumerate all of the eligible trinary strings for <code>n</code> = 4, you&#8217;d see that there are in fact exactly 12 of them that end in a single <code>A</code>. Our method works!</p>

<p>What&#8217;s nice is that we now have an exact formula that tells us how to get the number of <em>c</em>-strings in round <code>n</code> + 1 if we know the number of <em>c</em>-strings in round <code>n</code>. And what&#8217;s more, that formula depends only on <code>t</code>, the total number of eligible prize strings in a given round; <em>c</em>; and <em>a</em>, where <em>a</em> tracks the number of strings ending in <em>two</em> <code>A</code>s. (Where does that <em>a</em> come from? Well, when you add an <code>A</code> to a string that already ends in two <code>A</code>s, you &#8220;kill&#8221; it (render it ineligible). So you need to know how many <em>a</em>-strings are floating around.)</p>

<p>Similarly, all the rest of <em>a</em>-<em>f</em> depend only on <code>t</code> and the values of <em>a</em>-<em>f</em> themselves. That&#8217;s the sense in which the set <em>a</em>-<em>f</em> is complete.</p>

<p>The upshot of all this is that we can now write an obnoxiously simple program to find <code>t</code> when <code>n</code> = 30. We simply seed a list of values for <code>n</code>, <code>t</code>, <em>a</em>, <em>b</em>, <em>c</em>, <em>d</em>, <em>e</em>, and <em>f</em>&#8212;<code>[1, 3, 0, 2, 1, 0, 0, 1]</code>&#8212;and loop over it thirty times, applying our various formulas (like the one for <em>c</em>-strings above) with each iteration. Here are the simplified formulas for each element:</p>

<ul>
<li><code>n</code> -> <code>n + 1</code></li>
<li><code>t</code> -> <code>2 * t + b - a</code></li>
<li><code>a</code> -> <code>c</code></li>
<li><code>b</code> -> <code>2 * b - a + d</code></li>
<li><code>c</code> -> <code>t - (a + c)</code></li>
<li><code>d</code> -> <code>e</code></li>
<li><code>e</code> -> <code>f</code></li>
<li><code>f</code> -> <code>t</code></li>
</ul>

<p>I encourage you to try to derive these yourself. You can consult <a href="http://jsomers.net/pe-191-work.pdf">my scratch paper</a> for hints.</p>

<p>We&#8217;re left with this wonderful, short, extremely fast solution:</p>

<pre><code># [n, tot, -AA, 0Ls, -A, 1L-AA, 1L-A, 1LnotA]
lst = [1, 3, 0, 2, 1, 0, 0, 1]
while lst[0] &lt; 30
  n, t, a, b, c, d, e, f = lst
  lst = [n + 1, 2 * t + b - a, c, 2 * b - a + d, t - (a + c), e, f, t]
end
p lst[1] # =&gt; 1918080160
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/project-euler-problem-191-or-how-i-learned-to-stop-counting-and-love-induction/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Boredom</title>
		<link>http://jsomers.net/blog/boredom</link>
		<comments>http://jsomers.net/blog/boredom#comments</comments>
		<pubDate>Wed, 23 Feb 2011 18:31:53 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=795</guid>
		<description><![CDATA[I don&#8217;t seem to get bored anymore. I mean that I no longer get the feeling that I want to do something, but not any of the things I can think of doing. Of course I still get bored of individual activities. What happened? I think that the biggest change as I&#8217;ve gotten older is [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t seem to get bored anymore. I mean that I no longer get the feeling that I want to do <em>something</em>, but not any of the things I can think of doing. Of course I still get bored of individual activities.</p>

<p>What happened?</p>

<p>I think that the biggest change as I&#8217;ve gotten older is that I now see activities at a higher grain. Where I used to survey my options as &#8220;reading,&#8221; &#8220;watching TV,&#8221; &#8220;playing a video game,&#8221; or &#8220;running around outside,&#8221; I now break each of these into lots of sub-options: &#8220;reading the newspaper,&#8221; &#8220;reading the Economist,&#8221; &#8220;reading Reader posts,&#8221; &#8220;reading <em>Cryptonomicon</em>,&#8221; &#8220;reading <em>Le Ton Beau de Marot</em>,&#8221; etc.</p>

<p>Since boredom is the feeling of not having an outlet for my energy&#8212;of not liking my options&#8212;and since I now seem to have more options, I have a smaller chance of getting bored. I can always think of <em>something</em> to do because my mind has matured to be stimulable by&#8212;and capable of&#8212;more and more things.</p>

<p>It&#8217;s the old idea of &#8220;seeing the world in a grain of sand&#8221;: the closer you zoom into something, the richer it gets. And what have I been doing in my intellectual life over the past eight or nine years? Zooming in.</p>

<p style="margin:0 auto; text-align: center; margin-bottom: 10px">* * *</p>

<p>With that in mind, I can now see what might threaten my newfound unborability: anything that forces me, or encourages me, to zoom out.</p>

<p>The trouble is that these kinds of things are proliferating. Most of what I read on the web, for instance, is trying to summarize something for me. And most of the web sites I visit summarize those summaries.</p>

<p>What seems to be happening is what I described in a post called &#8220;<a href="http://jsomers.net/blog/wandering-the-web-stacks">Wandering the Web Stacks</a>&#8220;: I cultivate a few feeds, aggregations of abstractions of ideas, and when I&#8217;m done walking through them, I feel as though there&#8217;s nothing left to read online.</p>

<p style="margin:0 auto; text-align: center; margin-bottom: 10px">* * *</p>

<p>These feeds aren&#8217;t always pernicious. Sometimes they draw me down a rabbit hole, down a few levels of abstraction, until suddenly I&#8217;m consuming huge volumes on a single topic. That topic then becomes one of the options I can cash in to fend off boredom.</p>

<p>I think it&#8217;s worth reminding myself that drawing me down rabbit holes is what those feeds are for.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/boredom/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Futurizing</title>
		<link>http://jsomers.net/blog/futurizing</link>
		<comments>http://jsomers.net/blog/futurizing#comments</comments>
		<pubDate>Sat, 19 Feb 2011 13:42:45 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=799</guid>
		<description><![CDATA[&#8220;The Record&#8221; Data storage is now cheap enough and file transfers fast enough that you could walk around with a voice recorder that was always on, periodically shuttling your audio to a server when the local drive started to fill up. On its own this already has serious implications. You&#8217;d never have to worry about [...]]]></description>
			<content:encoded><![CDATA[<p><strong>&#8220;The Record&#8221;</strong></p>

<p>Data storage is now cheap enough and file transfers fast enough that you could walk around with a voice recorder that was always on, periodically shuttling your audio to a server when the local drive started to fill up.</p>

<p>On its own this already has serious implications. You&#8217;d never have to worry about missing a great line or joke; you could replay and dissect every subtle argument; no conversation would be forgotten.</p>

<p>But imagine if this capability were combined with fast accurate speech recognition. For one, the plain text that such a gizmo might produce would be trivial to store and share. But more importantly, your speech would be searchable, skimmable, excerptable, etc., just like any other kind of text.</p>

<p>That&#8217;s where things get crazy. Imagine being able to perform the conversational equivalent of highly targeted keyword searches&#8212;&#8221;What are two guys in Arizona saying about &#8216;X&#8217;?&#8221; Think of advertising and media; think of the law; think of the bubbling up of ideas and jokes and people. Whole debates might be pruned and published; quips that get enough of a laugh could automatically be tweeted; meetings minutes and class notes and informal colloquies would all be broadcast and indexed and archived. You could get famous just for being well-spoken.</p>

<p><strong>The name-tag scenario</strong></p>

<p>In Season 5, Episode 7 of Seinfeld&#8212;&#8221;The Non-Fat Yogurt&#8221;&#8212;Elaine, shooting the bull with her boyfriend Lloyd Braun, suggests that &#8220;everybody should wear name tags all the time&#8212;to make the city friendlier.&#8221; &#8220;It would be like a small town,&#8221; she says.</p>

<p>Later in the episode we discover that Braun has shared Elaine&#8217;s proposal with his boss, the sitting mayor, who essentially torpedos his bid for reelection by making the name tags a key part of his platform.</p>

<p>Silliness aside, it&#8217;s quite likely that someday soon everyone&#8217;s name will be visible, in one form or another, to everyone else. Maybe we&#8217;ll walk around with Terminator-style heads-up displays; maybe our smartphones will show us the Facebook profiles of everyone within thirty feet; maybe we&#8217;ll all have state-issued wristbands.</p>

<p>If something like that does happen, what will become of names? Will I still perk up whenever I hear &#8220;James,&#8221; or will the sound wear out? Will it be kosher to even <em>use</em> a stranger&#8217;s name, or will new norms for introductions evolve? Will people be more empathetic, or less? Will we just seamlessly adapt?</p>

<p><strong>E-mails of note?</strong></p>

<p><a href="http://www.lettersofnote.com/">Letters of Note</a> is one of my favorite blogs. But it makes me wonder what will become of <em>our</em> correspondence, now that it&#8217;s all electronic. On the one hand it&#8217;s infinitely more accessible&#8212;neatly typed, frequently copied, and keyword-searchable. But all the good stuff is buried in tens of thousands of useless ads and notices, and what&#8217;s worse, siloed in password-protected inboxes hosted by companies that might very well dissolve.</p>

<p>What a shame it would be if our progeny couldn&#8217;t read our intimate exchanges the way I did Feynman&#8217;s, or Joyce&#8217;s, or Lewis Carroll&#8217;s. And what a thrill it would be if they had, say, J.D. Salinger&#8217;s gmail password.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/futurizing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;technology,&#8221; expectations, pseudoreading</title>
		<link>http://jsomers.net/blog/jimbits-4-tech-expectations-pseudoreading</link>
		<comments>http://jsomers.net/blog/jimbits-4-tech-expectations-pseudoreading#comments</comments>
		<pubDate>Wed, 16 Feb 2011 21:54:19 +0000</pubDate>
		<dc:creator>James Somers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jsomers.net/blog/?p=778</guid>
		<description><![CDATA[&#8220;Technology&#8221; On the one hand the way the word &#8220;technology&#8221; is used is overly narrow. It refers essentially to electronic gizmos when it could refer to any kind of artcraft, including bookshelves, water bottles, RAID arrays, Markdown, magazines, keyboards, LEDs, pizza boxes, windowing systems, driveways, Bayes&#8217; rule, door handles, languages, Occam&#8217;s razor, software, pens, lists, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>&#8220;Technology&#8221;</strong></p>

<p>On the one hand the way the word &#8220;technology&#8221; is used is overly narrow. It refers essentially to electronic gizmos when it <em>could</em> refer to any kind of <a href="http://en.wikipedia.org/wiki/Metis_(mythology)">artcraft</a>, including bookshelves, water bottles, RAID arrays, Markdown, magazines, keyboards, LEDs, pizza boxes, windowing systems, driveways, Bayes&#8217; rule, door handles, languages, Occam&#8217;s razor, software, pens, lists, and so on.</p>

<p>On the other hand, even in its current guise&#8212;as a gloss for &#8220;computer shit&#8221;&#8212;the word is overly <em>broad</em>. To say that we should &#8220;bring technology into the classroom&#8221; is to make a million different proposals all at once. To &#8220;cover tech&#8221; is to write about anything new and nerdy.</p>

<p>What role, then, is the word &#8220;technology&#8221; playing in the language game?</p>

<p><strong>Low expectations</strong></p>

<p>Disappointments abound: first anythings with a girl, your own fiction, new people. Everything&#8217;s better when you set a lower bar. Example: read negative reviews before seeing a movie&#8212;set yourself up just like your friend did when he said he&#8217;d arrive late, but came early. Make less rare the rare pleasure of a pleasant surprise.</p>

<p>The question is whether you can hold your expectations down against their will.  <a href="http://en.wikipedia.org/wiki/Kavka's_toxin_puzzle">Can you intend tonight to take the poison tomorrow, knowing what you know about the pain, the reward, and, most importantly, the way out?</a></p>

<p><strong>Pseudoreading</strong></p>

<p>Normally while reading my eyes and mind work in concert, or at least seem to: as my foveae <a href="http://www.microsoft.com/typography/ctfonts/wordrecognition.aspx">jump and jounce</a> around the page, the rest of my readerly machinery&#8212;everything from my ocular nerve and visual cortex through to the &#8220;workspace&#8221; of my consciousness and the seat of my &#8220;I&#8221;&#8212;seems to tag along.</p>

<p>Sometimes the whole apparatus goes off task at once, as when I put a book down to make myself a sandwich. But that&#8217;s not very interesting. The interesting case is when the various layers of the system unhinge.</p>

<p>That seems to be what&#8217;s happening when I daydream in the middle of a sentence. My eyes follow through, happily tracking the rest of the line, <em>even as my mind wanders onto something entirely unrelated</em>. It&#8217;s as if all those lower layers continue their sophisticated unconscious work of turning globs of ink into a mental representation of words, only to have the whole lot discarded just before it becomes a conscious thought.</p>

<p>The trick is that when the daydream ends, my focus returns as if it never left. It&#8217;s easy not to catch the difference, and so just to read, read, read, to read <em>without</em> reading, without making sure that my mind is along for the ride.</p>
]]></content:encoded>
			<wfw:commentRss>http://jsomers.net/blog/jimbits-4-tech-expectations-pseudoreading/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

