Wind Knitting Factory

March 8th, 2011

wind-knitting-factory

Have you seen Merel Karhof’s Wind Knitting Factory? I guess if you read swissmiss you have. Which you should.

The site’s worth checking out — there’s a video. If you go watch it, I’ll spare you a really weak “windsock” joke.

art+design, video | No Comments »

Painting with WiFi

March 7th, 2011

So clearly this results in a pretty cool set of images. What I’d really like, though, is a 3-d graph depicting signal strength on a 2-d field.

Imagine if we replaced the rod with a disc composed of a set of concentric circles of lights. Suppose the number of circles that light up correlates with the strength of the signal, so that more signal => more light. Head to the city park, wander around in a grid pattern with this device, point the camera down from a building, and take a long exposure of the results. Signal would be represented as pools of light.

Someone go do this for me. Send me pictures.

art+design, computer science, infographic, video | No Comments »

Chess Music

February 25th, 2011

A gentleman of the Internet decided to map algebraic chess notation to musical notes. He includes mp3s for a few classic games (including Fischer’s ‘72 match against Spassky), and also reverses the process to set Ode to Joy to chess. Neat idea!

Also it’s my birthday and I’m a quarter of a century old. I’m pretty sure I’m wise now.

chess, music | No Comments »

The Great Gatsby: NES Edition

February 15th, 2011

great-gatsby-nes

Apparently someone made an old NES game that’s very, very loosely based on The Great Gatsby. A flash-based version is now on the tubes. Now you too can throw hats at flappers and fight the giant floating eyes of Dr. T.J. Eckleburg.

books, games, ill-conceived plans | No Comments »

RFC 2324

February 12th, 2011

networked-french-press

RFC 2324 defines the Hyper Text Coffee Pot Control Protocol. HTCPCP is built on top of HTTP, implementing a range of new headers and errors (418 I’M A TEAPOT) that enable the intercommunication of networked coffee pots. Manufacturers, take note — standards-compliance grows the market.

actual food, computer science, web | No Comments »

Enthiran

January 27th, 2011

I guess I could try to describe the Kollywood sci-fi movie Enthiran, but I think the above clip show (dubbed in Russian, but don’t worry, the dialogue doesn’t seem to matter) gets the idea across. As Gizmodo mentions, it really does put Michael Bay to shame. Incredible.

My favorite moment, I think, is when the giant tower of robots throws a helicopter into another helicopter.

Good find, Mr. Cooney!

ill-conceived plans, video | 1 Comment »

Tupper’s Self-Referential Formula

January 22nd, 2011

Tupper's self referential formula plot

Tupper’s self-referential formula describes a function whose graph (for inputs within a certain range) is the formula of the function itself.

Links: Wolfram, Wikipedia.

Hofstadter should probably be informed.

computer science, math | No Comments »

Types of Screws

January 10th, 2011

screw-heads

I sure hope some other person in the world finds Wikipedia’s List of Screw Drives page as fascinating as I do.

art+design | No Comments »

Pay Your Taxes, Witches

January 9th, 2011

Romania recently declared witchcraft to be a legal profession in an effort to decrease tax evasion. The legislation was passed despite widespread protests among Romanian witches and the casting of Bratara’s Curse of Governmental Discord.

The new laws will also apply to astrologers and driving instructors.

cranks, ill-conceived plans, laws | No Comments »

Memoization Using Closures

January 6th, 2011

I wrote a little post about how to use closures in Python a couple weeks ago, but I’m not convinced that I really gave a good motivation for why we might want to use them. The example I gave was a little bit simplistic — here’s a better one.

First, we need to talk about memoization (if you’re familiar with memoization already, feel free to skip along a bit). Suppose we want to write a function to calculate the nth Fibonacci number. We might first write a naïve recursive function:


def fib (n):
     if n < 2:
         return n
     else:
         return fib (n - 1) + fib (n - 2)

This does the job (assuming we give it appropriate input), but it's actually terribly inefficient. Check out the call tree for fib (5):

fib-call-tree

We've got a few redundant calls here (notably fib(2) and fib(3)), and for higher values of n they really start adding up. As it turns out, this Fibonacci implementation is O (2n). Our elegantly simple algorithm is awful, just awful.

But we can salvage it! If we were to record our calculated values (using a closure, say) we could make this thing phenomenally more efficient.


def memoized_fib (n):
     values = [0, 1]

     def fib_helper (k):
         if len (values) > k:
             result = values [k]
         else:
             result = fib_helper (k - 1) + fib_helper (k - 2)
             values.append (result)
         return result

     return fib_helper (n)

We're creating a list called values, for which each entry contains the Fibonacci number associated with its index, starting with the first two. After we've recursed all the way down the first time, we build up the list as we pop functions off the stack, so subsequent calls to fib_helper() don't really need to do any recursion at all — they can just look up the appropriate value in values. The list values is hidden inside a closure, so it's protected from the outside world. Certainly we could have implemented memoization using a global variable, but why would we if we we don't have to? Our closure provides an equally efficient and more elegant solution to the problem.

Just to drive home the efficiency gain, memoized_fib(500) takes 0.014s to run on my machine; fib(500) is still calculating an hour later. Which makes sense, since we've replaced an exponential algorithm with a linear one. Nice.

computer science | No Comments »