cities. physics. food. environment. fatherhood.

Random header image... Refresh for more!

Dow Jones and Mathematica

A recent post by economist-blogger Brad DeLong, which was also picked up Matthew Yglesias, mused upon the clustering of the Dow Jones Industrial Average clustered near values starting with 1. He showed a chart with the years 1971–1984, and 1996–2008 circled, when the Dow appeared to fluctuate near 1000 and 10000, respectively. Many commenters quickly jumped to point out that this was an example of Benford’s Law, which says, essentially, that if you’re throwing darts at a logarithmically shaped dartboard, you’re going to hit “1″ more often than any other digit. If you pick random values of some phenomenon that is logarithmically distributed, you should get values beginning with “1″ about 30% of the time, which makes sense if you’ve ever looked at log scale graph paper.

It occurred to me that this is an easy thing to investigate with Mathematica, much like my earlier post on the Bailout. Mathematica 6 includes access to a huge library of curated data, including historical values of the Dow Jones Industrial average and other indices (and individual stocks, and so forth). The function here is FinancialData, which Wolfram cautions is experimental: I believe they get the data from the same source as, say, Yahoo! Finance, and just do the conversions to make it automatically importable into Mathematica. That is, it is no more reliable than other web-based archives. The computations are absurdly easy, taking only a few lines of Mathematica code. 

The graph I (eventually) produced shows the relative frequencies of first digits that are calculated by Benford’s Law, together with the relative frequencies of the leading digits from the Dow Jones Industrial Average, the S&P 500, the NASDAQ Composite index, the DAX 30, and the Nikkei 225:


[Read more →]

November 1, 2008   No Comments

Bringing Streetcars back to DC, part 1

Prologue

Bringing a 50-mile streetcar network to Washington DC is the top priority for the DC Chapter of the Sierra Club. I have been following this issue with the Sierra Club since 2002, and it was recently suggested to me that I write down a brief history of the effort, to provide context for those new to the subject. Current progress on the issue is blogged at streetcars4dc.org

The DC Transit Improvements Alternatives Analysis gets underway.

The last time streetcars ran in DC was the early morning of January 28th, 1962, after which all lines were converted to buses. Such was the state of public transit in the District until March 27, 1976, when Metrorail opened. Metrorail, of course, has been a tremendous success, but it does not serve all areas of DC, and was designed primarily to move suburban commuters to their jobs in downtown DC.

The District government has, in principle, been planning to bring streetcars back to DC for some time now. My involvement began in September 2002, when I testified on behalf of the  at a joint oversight hearing of the DC City Council. A relatively small, two-year study had recently been completed (DC Transit Development Study), and then-DDOT director Dan Tangherlini, and then-DDOT Mass Transit Administrator Alex Eckmann went before the council (read their presentation) to ask that a more expansive study be funded. Plans to expand transit in the District stretch back further than that, and are generally said to have begun with the Barry-era DC Vision Study of 1997, itself 2 years in the making. And after more than ten years of talk and study, there are still no streetcars.

[Read more →]

October 29, 2008   2 Comments

My new line for telemarketers

I actually don’t talk to many telemarketers anymore–I’m on the do not call list, so nobody’s been calling to sell me aluminum siding or vacation get-aways. Ever since cell phones really took off, it seems that the long distance companies aren’t falling over themselves to get you to switch to their plan, although I do remember plenty of this in the late 90′s. And although we don’t have caller ID, we’ve gotten pretty good about catching the second or so delay from the robodialers and hang up before the telemarketer comes online.

But sometimes someone does get through, and it’s usually either a charity (usually one that I nominally support) or a political campaign, asking for more money. However, I really, strongly prefer to give on my own terms and on my own schedule, and not theirs. So I want to get rid of them, in some way that’s still polite. So this is what I say now:

Although I will continue to support [your cause], I do not make financial commitments over the phone due to identity theft concerns.

All I have to do now is think of a line to get rid of the (overpriced) identity theft “protection” sales pitches that my credit card companies foist upon me.

October 21, 2008   1 Comment

Peregrine espresso

For those that live on Capitol Hill, this is old news, but the good news is that Peregrine Espresso has opened, in the space that once occupied by Murky Coffee. The better news is that Peregrine is co-owned by a former Murky Coffee employee (and 2005 Southeast Regional Barista Champion [warning:pdf]) Ryan Jensen. Which is to say, Peregine continues, and expands upon, Murky’s pursuit of coffee excellence.

I visited Peregrine for the first time Saturday. The space has been remodeled to look much cleaner–in fact, nothing from the old Murky remains. Their blog has several pictures. The chalkboard menus are gone, the walls are painted, the floors are freshly finished. The menu has been simplified, to the point where each drink comes in only one size. The brewed coffee offerings are given more prominence. 

Peregrine gets its coffee from Counter Culture Coffee, the same supplier that Murky uses. Their milk comes from Trickling Springs Creamery, a relatively local dairy in Pennsylvania that sells milk in re-usable and returnable glass bottles. This is one step beyond Murky, which as far as I know used ordinary supermarket milk. 

I had a cappuccino–regrettably, to go, as there were no free seats. Even in the (appropriately sized) to-go cup, the barista poured a small rosetta. It had been months since I’d had a “third-wave” cappuccino: the way-beyond-starbucks, hand-crafted expression of exactly how amazing coffee can be. Delightful.

Coffee lovers in Washington do owe much to Nick Cho, owner of Murky. That his business skills are sloppy is unfortunate, but he planted the seeds of coffee culture in DC. That a former employee is able to open a cafe that improves upon its predecessor reflects both the technical training and the enthusiasm for coffee that Nick imbued his employees with.

October 20, 2008   No Comments

Bailout and Mathematica

A friend of mine (and regular commenter here) has pointed out that, even if the $700,000,000,000 bailout passes, and adds to our National Debt, we’d still have a Debt-to-GDP ratio that was less than Germany’s.1 Wikipedia says that the US National Debt is 60.8% of our GDP, that Germany’s is 63.1%, and that our GDP is $13.8 trillion. Well, add $700 billion to 60.8% of $13.8 trillion and the new figure is 65.8%–pretty close; there are different ways of measuring both GDP and the Debt.

But I realized that this sort of comparison is something that Mathematica 6 is supposed to be good at. Mathematica is an amazingly powerful system for doing mathematics on a computer. Its strength, traditionally, has been symbolic manipulation–I most often use it for the Integrate command, which can do most of the integrals that in grad school I’d look up in Gradshteyn and Ryzhik. Version 6 has added, amongst other things, a huge library of curated data, loaded over the Internet, that’s relatively straightforward to use.

The command CountryData gives access to all sorts of country-by-country information, including “GDP” and “GovernmentDebt”. So following one of the examples in the documentation, I produced this graph, plotting the Debt-to-GDP ratio versus GDP for (nearly) all the countries for which Mathematica has data. (Note that the x-axis is a logarithmic scale.) The United States, before and after a $700 billion bailout, are shown in green and red, respectively.

If the xhtml export actually works the way it’s supposed to, you should be able to hover your mouse cursor over each point and have a little ToolTip pop up telling you which country the data are for.

"debtgdp.xhtml_1.gif"

GDP [$US]

Mathematica has a syntax that strikes many as arcane. Since I learned about computers with procedural programming, and haven’t really done any functional programming, I too struggle to get Mathematica to do what I want it to do. But one can often do complicated things, such as the above graph, with a very compact command. To make the main graph–the red and green dots are relatively trivial additions–the command I used is:
[Read more →]

  1. He is, nevertheless, against the bailout. []

October 1, 2008   1 Comment

Fall foliage

In Sacramento, where I grew up, we would have the occasional colorful tree in the fall, but there weren’t any really impressive displays of fall color, at least not that I remember. It wasn’t until I was away at grad school, in Ithaca, NY, that I was in an area that could have really impressive displays. I also learned that the peak of fall color really lasts two weeks or so: there must be a mad dash among professional photographers who want to use beautiful fall color as a backdrop. We have this image of the canonical fall day: crisp air, blue sky, reds and oranges and yellows in the trees, but in reality we only get a handful of these days, not a whole season.

There are, for the fall foliage seeker, plenty of online guides: Maine, New Hampshire, Vermont, New YorkPennsylvania, and Virginia all have guides. The Foliage Network maps out reports from a network of 500 correspondents, and Yankee Foliage does the same for New England.1

There is a whole bunch of data out there, somewhere,2 which could probably answer the questions that came to my mind as I was thinking about fall foliage today:

  • How much variation is there, geographically and year-to-year, in the duration of the peak color period?
  • How fast does the peak color “front” move? Could you hike along with it?
  • What is the longest hike you could plan that would keep you in peak color the whole time? Could you stay in peak color along, say, the Appalachian Trail?
  • What sort of bike ride could you plan, to stay in peak fall color the whole time?
  • Although the timing of the arrival of fall color shifts around from year to year, does all of the Northeast experience the same shift? Could one use the arrival of peak color in northern Maine to predict the arrival of peak color in central Pennsylvania?

And of course the big question, will I see any fall foliage this year?

  1. Curiously, the current reports from these two networks seem to disagree with the current reports for the state tourism boards in Maine and New York, but this could be the result of different standards. []
  2. The Foliage Network actually has ten years or so of archived, weekly maps []

September 24, 2008   No Comments

Coffee and Tea

Sundays May through October we have, in our neighborhood, what could accurately be called a “Farmer Market,” because these days, we’re down to just one farmer, except that I think he’s more of a consolidator for a few mostly-organic farmers and less of a farmer himself. But the produce he sells is good, and I really don’t need more than one vendor of green beans or potatoes.

There are other vendors, too, including Fresh Off the Roast, a local coffee roaster who started as a hobbyist but who has been steadily expanding his business. I’ve been getting my coffee from him for just over a year now. He roasts every Friday, and I pick up just enough for the week on Sunday. It works out very well. He blogs at Cuppa Joel.

There is now, at our Farmer Market, a tea vendor as well. A fellow Brooklander recently bought Pearl Fine Teas, which has mostly, I believe, been a mail-order firm dealing in higher-end loose teas. She had several teas–black, scented, and herbal–on display, which were sold in one-ounce packages. She blogs at TeaLove.

I drink more coffee than tea. Every morning starts with coffee, although I lean towards tea at work because low-effort tea is much better than low-effort coffee, doubly so if there’s nobody else around who would want to share the coffee. My tolerance for caffeine in the evenings isn’t what it used to be, so I tend to favor herbal teas after dinner, although there is no better accompaniment to dessert than coffee.

For our little Farmer market to become a center for high-quality beverages is pretty cool.

September 22, 2008   1 Comment

Brompton: report on the commute

The short answer is that my new Brompton has substantially improved my commute. The combination of Brompton and Metrorail is by far the fastest way for me to get to work without a car. It gives me more freedom than the all-Metro commute, in which I was tied to the (unreliable) bus schedule. And it isn’t as grueling as the all-bicycle commute.

The one part of the commute that is longer is the first part, taking my son to his day care. It’s on the way to the Metro, but instead of simply pushing him in his stroller, I have to push his stroller and haul my bike at the same time. I’ve become somewhat adept at the one-handed stroller push, so that I can walk my bike with my other hand. It’s faster than leaving my bike at home and going back for it, but slower than just pushing the stroller.

On the return trip, though (my wife picks up Matthew in the evening), cycling the 3/4 mile between the Metro and our house is much faster than walking, or calling home to get a ride.

As folding bicycles are rather rare, I am frequently asked about it. A friend of mine once observed that Americans, in particular, have a tendency to ask how much you paid for something: this is certainly true of the Brompton. Complete strangers are often most interested in how much it cost me and have no hesitation about asking. I’m also asked where I got it, and I’ll go into a little spiel about going to New York City to buy it, and that College Park bicycles says they carry it but never have any in stock but they do have other, cheaper brands, and a new place in Vienna [Virginia] now carries them. I really should print up a bunch of cards listing the stores to give to others who might be interested in folding bicycles.

Although it’s certainly easier to wrangle than a full sized bicycle, the Brompton is more “luggable” than portable, so it’s as awkward as any other piece of luggage on the Metro. As such, my seat preferences have shifted. On the red line, I used to try to get a window seat with a view of the Amtrak yards; now I prefer to be at the ends of the car. Going home, I’ll try to board last, so I can stand near the doors. The doors open on the right at Gallery Place, and at the next stop (Judiciary Square), which tends to have very light traffic. After that, the doors open on the left all the remaining stops, including Brookland, so I can stay out of everyone’s way near the left-hand door.

I take different routes going to work and coming home. The natural Metro stop would be Anacostia: this is where I caught the A4/A5 bus that took me to work, and it’s a short and flat trip to the northern entrance of the swath of government facilities through which I ride. When I ride home, I ride to Anacostia, a 3.8 mile trip. But for the trip to work, I’ve come to prefer to ride one more stop to Congress Heights, for a slightly shorter 3.5 mile bike ride, which includes a long downhill stretch (which would, of course, be uphill on the way back). The first two weeks of the Brompton, I alternated between these two routes to work, and I think it’s about 4 minutes faster to ride to Congress Heights.

The all-bicycle commute is 10.2 miles: at this distance, one really wants to wear separate cycling clothes, and probably shower at the end of the ride. On the way to work, this just shifts the shower to the health club at work, but on the way back it would add to the trip, but in any case even changing clothes adds time. The three and a half miles from Metro to work is short enough so that I don’t feel a change of clothes is necessary.

The steps of my commute are now:

  1. unfold bicycle
  2. ride to Brookland Metro
  3. fold bicycle
  4. lug bicycle through faregates to platform
  5. wait for train
  6. ride to Gallery Place
  7. lug bicycle to Green line platform
  8. wait for train
  9. ride to Congress Heights
  10. lug bicycle through faregates outside
  11. unfold bicycle
  12. ride to work
  13. park bicycle

I include many of these steps, which might take a minute or two, to emphasize the fact that they do add up: five steps that take two minutes each means ten minutes. In a sense 10 minutes isn’t a terribly long time, but psychologically the difference between a 45 and a 55 minute commute is huge.

The other point with all the steps is that I don’t have any big contiguous block of time along the trip, so (say) trying to read is really not feasible. When I did Metrorail and Metrobus, I’d usually pick up the Washington Post Express and work the Sudoku, and listen to podcasts on my iPod. No time for the Sudoku now, and I have much less iPod listening time, so I’m down to a handful of podcasts.

Folding or unfolding the bike takes less than a minute, unless someone has asked about the bike and I’m sort of narrating the process and giving a demonstration.

Step 12 above is reliably 20-25 minutes, depending on the wind, traffic lights, how much air is in my tires, how heavy my bag is, and how willing I am to work up a sweat. I’ve done the ride in less than 20 minutes, but during much of the summer I prefer not to. According to WMATA, step 6 above takes 8 minutes, and step 9 takes 12 minutes. 

All total, the whole trip–office to front door–can be done in 50-55 minutes. I think that 45 might be possible, if I have a tailwind and no red lights, and have no waits for trains. But I’ve found, though, that I’ve become a much more relaxed commuter. No longer worried that I might miss a bus by a minute or two, which would mean I’d have an extra 20 minute wait, I don’t feel as compelled to rush for trains as I used to. And especially in the summer, I’ve found that a leisurely pace ensures that I feel comfortable without a change of clothes.

September 21, 2008   8 Comments

A new time sink

It seems like just yesterday that facebook was, well, the linked online student directory for Harvard. Then for other colleges. And I remember some dust-up when the college kids objected to the plan to let high school kids on.

But now, it seems everyone is on. My wife joined last week, and so I’ve decided it’s time for me to jump on the bandwagon as well.

But I don’t know if I’ll ever get used to using the word “friend” as a verb.

September 20, 2008   No Comments

Outside Lies Magic

In response to my post about following railroad tracks, commenter Richard Layman suggested I borrow his copy of John Stilgoe‘s Outside Lies Magic. I did (lending to him A Pattern Language and David Owen’s Sheetrock and Shellac), and tore through it in a few days. It’s a slim volume, less than 200 pages of generous type, about explorations of the built environment. Reading it gave me the rare experience of coming across words that gave voice to a bundle of thoughts and feelings that had long been stewing in my mind but which I could never quite articulate. (In this sense, it was much like reading James Howard Kunstler’s Geography of Nowhere.)

Stilgoe exhorts us to explore: to walk and cycle, to observe, to look for “history and awareness” in “the best-kept secret around–the ordinary, everyday landscape that rewards any explorer.” The book is partly a narration of the observations that “the explorer” would make, mixed with history that can, in part, be inferred from these observations. The first explorations revolve around a discussion of wires–power and telegraph and telephone–and rail, networks that grew up with one another. A sample:

[T]he walker emerges thoughtfully from the woods or fields and finds a tiny industrial park of grain elevators, machinery dealers, warehouses, wood-frame or redbrick factories, every structure marked by that certain sign of railroad influence, the walled-up loading door four feet above grade level, too high for trucks but the perfect height for boxcar floors. [p.46]

We go on to learn about mail, about paths and roads and highways, and about fences–apparently, in the North, livestock were fenced in, but in the South, crops were fenced to keep otherwise free-running livestock out. It wasn’t until cars started colliding with farm animals in large numbers that laws requiring the fencing-in of livestock were enacted all across the country. There is no way, of course, for any explorer to infer this entirely from his observations, but it is the sort of knowledge that  the explorer can use to understand and connect what he is seeing.

The text meanders in much the same way that an explorer would. One chapter begins with (a dubious) discussion of motel siting, and of the design of motel sites, which leads to a discussion of vacancy: not only at the motel, but what it means for a field or lot to be vacant. And what it means, then, to be a field, and how big our fields are, and how we measure how big they are, and how the weights and measures in use here are the result of some compromise between the populist- and dozenal-leaning Adams and the decimal-leaning Jefferson. Our currency (unlike, say, Britan’s) has always been decimal, but we buy eggs by the dozen, which can be evenly split in more ways than ten can, giving greater flexibility for people to pool their resources when money is tight. More significant was the continued use of the mile: a square mile is 640 acres, which is 16 times 40 acres, the canonical size for a family farm. So the use of the mile facilitated the sub-division of land, because the square mile can be nicely divided into appropriate-sized lots.

The motel siting discussion says that eight hours from a major metropolitan area would be a good place for motels: I have no doubt that it would be, but my own experience tells me that motels are much more closely spaced than every 500 miles. There are other instances that strike me as similarly dubious: the optimistic claim that railroads are “rediscovering the profitability of carrying passengers.” [p. 52] If only that were true! Passenger rail has been expanding, slowly, but as a matter of civic investment, not private profit. So I’m left with a sort of skepticism about the specific claims, but this doesn’t dampen my enthusiams for the book: it is not supposed to be a definitive treatment of anything, but an inspiration to explore and discover.

The book ends with a discussion of the “magic” of exploration, the fulfillment that comes with the discoveries and connections and the accumulation of a personal world-view. This discussion begins by noting the skepticism that explorers might encounter, from people who want to know why they want to go someplace or take a picture of something. In recent years, we have seen episodes of absurd harassment (one example in the Washington area, and proper responses.) The exploration that Stilgoe describes is very fundamentally an expression of our freedom, to go and do as we wish. The contemporary reader can appreciate the truly tragic irony in which the increased scrutiny to which an explorer is subjected comes in the name of protecting our freedom.

September 13, 2008   1 Comment