Archive for October, 2006

A bug’s life

Monday, October 16th, 2006

If you write a program to run a simulation of the double pendulum dynamical system on Scheme, for your Classical Mechanics: A Computational Approach homework project, and you get an output like the picture featured below after 50 seconds of running it, you’d better go back to your code and check if you’re not plugging a whole structured tuple into what should be taking a single number, because that is exactly what I did, and it was quite wrong. Of course, I first innocently thought that the beautiful doddles coming out of my simulation were a representation of the velocities and accelerations of a single point of mass changing over time. This will tell you how much I don’t know about Physics, and it is also the principal reason for me to enjoy this very difficult class in so many ways, where one day I can be told of how the solar tides pull us up and down around half a meter every day, and the next morning I’m given the best description I’ve ever heard of a differential form. Every week I learn about some crazy thing like Lagrangians or Hamiltonians, Principal Moments of Inertia, Legendre Transformations, Conserved Quantities or Spin-Orbit Couplings. I can hardly imagine how those powerful minds of the past managed to put together the classical formulations of Physics. They figured it all out up to extreme proportions based on their imagination, thoughtful observation and very rudimentary measuring technologies, i’ts impressive.

Certain initial conditions of the double pendulum lead to chaotic behavior. The system is so sensitive to subtle changes on these initial conditions that offsetting the position of the second point of mass for a little more than the size of an atom will evolve the system into a completely different state from the original after a little more than five seconds.

Every time I work on my weekly homework I realize I might have not learned much after all. And thanks to the dynamically typed nature of Scheme as a programming language, I can get away with spitting a result out of a terribly performed (and utterly impossible) computation, like reading the tuple of the velocities for all the particles in the system as if it was a single floating point number, and thus plotting it over time as if it was the velocity of a single particle. Not much of a bad thing, if it gives me back a nice mysterious picture like the one I’ve got this time, but not so good for my grades if I don’t figure out how to tell my experimental explorations on computational nonsense from true Physics. It was only thanks to G.J. Sussman’s advice that I could figure out what was happening. My next challenge is the Spin-orbit coupling of the rotation of Mercury, due this friday. I will see what happens then.

beautifulbug5501.png

The bug:

(define ((monitor-theta win) state)
   (let ((theta
     ((principal-value :pi) (velocity state))))
     (plot-point win (acceleration state) theta))
   state)

The fix:

(define ((monitor-theta win) state)
   (let ((theta
     ((principal-value :pi) (ref (coordinate state) 1))))
     (plot-point win (time state) theta))
   state)

PLW Map

Sunday, October 15th, 2006

I made this poster-map of the PLW for the upcoming events in the Media Lab next week. The current PLW layout was defined a few months ago by Amber, Brent, Burak, John and I when I first got here. It was fun to reconfigure everything and I got to be located in a good spot that lets me witness the sunset every day. I can’t believe I have already been here four months. This is crazy.
plwmapa1.png