3 Mar 2003 jfleck   » (Master)

African Queen
There's a famous psychology experiment done by Elizabeth Loftus in which she exposed subjects to an ad showing Bugs Bunny at Disneyland, then asked them later if they remembered meeting Bugs at Disneyland. Lots said yes, even though Bugs is a Warner Brothers character never seen at Disneyland. It's a powerful testament to the weakness of memory and the strength of suggestion.

It comes to mind because last night Lissa and I watched The African Queen, the famous 1951 Hepburn and Bogart flick. Lissa really wanted to see it, but I was lukewarm, thinking I'd seen it before and didn't like it that much. But when we watched it, I realized I hadn't seen it. I'd seen a bunch of famous scenes from it - the two of them riding the rapids in the African Queen, and Hepburn pulling leaches off of Bogart's gaunt body. But I'd never seen the movie. (And it was a terrific film.)
I picked up Fooled by Randomness at the library last week. The book kept coming up in things I was reading, and I'm very interested in the idea that our ability to see patterns where none exist is a source of endless trouble (see, for example, the Kennedy assassinations). The book wasn't that great - interesting material, but overtly arrogant writing that got in the way - so I returned it yesterday.

But the author did share a fun tidbit that stuck - a Monte Carlo technique for calculating pi. It's a pretty simple principle, explained in some detail here. Draw a circle with radius r and a square around it with side length 2r. Generate random points inside the square, and keep a tally. The ratio of points inside the circle to the total number of points, times four, approximates pi for a sufficiently large number of iterations.

I have a longstanding personal tradition, dating back to my high school math teacher David Geisler, of calculating pi with a new computer, or when I start playing with a new language. So in honor of Mr. Geisler (I often wonder whatever happened to him), I offer this. It's not a terribly efficient way to calculate pi, but it was fun. I did 10 runs with 100,000 iterations each run, and came out with pi=3.140472 +/- .0065, which seems reasonable.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!