And can you tell me what classical mechanics is good for, boys and girls? That's right!

**Implementing silly flash games**. (see http://www.cs.cmu.edu/~jcreed/flash/balance.html) I mean, if

*you*want to design a game around relativistic and/or quantum physics, be my guest. I'm stickin' with old-school for now.

What's neat and surprising about Lagrangian mechanics (well, surprsing at least if you are a total physics nub such as me) is that you can formulate the setup of constrained systems (like the simple externally-driven weight-attached-to-rigid-rod system in the game) in whatever coordinate system is convenient for you, figure out what the kinetic and potential energy formulas are, and then derive ordinary differential equations of motion from them

*in that coordinate system*.

So I was like, okay, my mass is at a fixed length L from the mouse at angle θ. My (single) coordinate is just θ, not the (redundant by virtue of the constraint) x and y coordinates of the weight. Kinetic energy is (1/2)m(L

^{2}(θ')

^{2}+ x'

_{mouse}

^{2}+ y'

_{mouse}

^{2}+ 2Lθ'(y

_{mouse}cos θ - x

_{mouse}sin θ)), potential energy is mg(L sin θ + y

_{mouse}). Now I plug these into the Euler-Lagrange equations and proceed to crunch through a bunch of algebra and differentiation, and out pops

_{mouse}sin θ - (y''

_{mouse}+ g)cos θ)

which is now in a form that's trivial to implement numerically.

Not once did I have to think about newton's laws or the weird tension or compression forces in the rigid rod that keep it having the same length. Lagrange just takes care of all that BS somehow.

(PS my best score is