Lagrange multipliers revisited

I spent the last few days trying to decide whether to teach Lagrange multipliers in my Theoretical Mechanics course. Ultimately I decided to go ahead and do it and I wanted to get down my thoughts on why and what we ended up doing in class today.

I made a lot of progress on how to teach Lagrange multipliers the last time I taught this class, and I have to say that it was great being able to read my old thoughts when prepping this class. In that post I break down how to derive the needed result, so I won’t repeat that here (though I did find a slightly better approach for one of the steps that I’ll talk about below).

So why was I waffling? Every time I come around to this topic, I begin to realize that if my students are predominantly going to numerically integrate the ultimate equations of motion (or equation of motions as I usually pluralize the acronym – eoms) they can get the same information that Lagrange multipliers provide (typically the constraint forces) by simply plotting the total acceleration of the relevant particles minus the known forces. In fact that’s one of the beauties of the Lagrangian approach — you can ignore the constraint forces when figuring out the equations of motion. At the end of the day, you have access to the full accelerations which come about due to both the known external forces AND the constraint forces. What Lagrangian multipliers do is help you explicitly calculate those constraint forces, but sometimes I don’t really see the value of that.

So what tipped the scales towards teaching them this year? Well, I realized that actually doing what I suggest above is kind of a hassle. Consider the prototypical problem of when a sled will lose contact with the ground as it goes down a hill. If you have the equation of the hill, you can then reduce the problem to a one-dimensional one, typically the horizontal variable. Then you can do the Lagrangian approach where you force the sled to stay on the curve. When you’re done you can look at the total acceleration and subtract gravity from that vector. Then you have the normal force vector and you can investigate when that switches from a vector pointing out of the ground to a vector pointing into the ground. When that happens the sled will lose contact with the ground. Now, that all sounds great, but actually determining which way the vector points involves dotting it with a vector that’s normal to the curve. To get that you have to do some derivatives on the function that defines the curve in the first place. In other words, there’s a little bit of a hassle.

Contrast that with learning about Lagrange multipliers and applying them. Now, there’s no question that learning about them (the whole separation of variables thing in my other post) is not a cake walk. However, there’s some very cool calculus of variations in there and it helps me reinforce the original derivation of the Euler equation (which I always choose to teach). So teaching it isn’t really the big deal. What is the big deal is whether what you get after implementing it makes your life easier. And guess what? It does! For the sled problem, if you have access to the Lagrange multiplier as a function of time (which you will after implementing the approach) you just have to plot it and look for when it changes sign. That doesn’t require the multivariable calculus that’s necessary to define the normal direction that you need for the other way.

Here’s the screencasts that I made for my students today. We were tackling whether a sled would ever lose contact with the ground on a parabolic hill. I did it once without Lagrange multipliers and once with them. It’s my contention that the second way is a more clear way of finding when the sled leaves the ground (too long, didn’t watch: it never does for a parabolic hill). But I recognize it’s not a slam dunk case.

I was talking with a math professor buddy of mine today and he suggested that it might be a slam dunk case if you have a constraint that is hard to solve for one variable in terms of the other. I get what he was saying, but I don’t immediately have an idea of a sled/hill constraint where that would be the case.

Quick note about a change to the derivation: There’s a point in my other post where I say that the constraint should not be a function of the perturbation variable, \alpha. I then take a derivative and find a relationship between the two perturbation functions, \eta_1 and \eta_2. I realized this time around that there’s a different way to approach that. Basically we know that the constraint, g, has to be obeyed whether you’re on the best paths (x(t) and y(t)) or on nearby paths (x_\text{best}+\alpha \eta_1 and y_\text{best}+\alpha \eta_2):

g(x_b, y_b)=g(x_b+\alpha \eta_1, y_b+\alpha \eta_2)

$latex g(x_b+\alpha \eta_1, y_b+\alpha \eta_2) \approx g(x_b, y_b)+\frac{\partial g}{\partial x}(\alpha \eta_1)+\frac{\partial g}{\partial y}(\alpha \eta_1)$

or

$latex \frac{\partial g}{\partial x}(\alpha \eta_1)+\frac{\partial g}{\partial x}(\alpha \eta_1)=0&s=2$

which leads directly to the same result I have in the last page.

Update on how to do this in Mathematica: In the screencasts above you might notice that I deviate from what I suggest in my other post. The reason is that Mathematica has a new method for NDSolve that saves the day. Now you can simply tell NDSolve about the constraint and go, without having to do the differentiation that was my work around. The key is to use Method->{“IndexReduction”->Automatic} which Mathematica kindly suggests if you try to do NDSolve without it. It’s great, you even only have to give initial conditions for one of the variables. Mathematica will figure out the initial conditions for the other variable(s) by using the constraint. Awesome!

Your thoughts? Here are some starters for you:

  • I like this, I’ve been looking for better motivation and I’m going to use this to . . .
  • I hate this and all things having to do with Lagrange multipliers. Please stop posting about this.
  • I’m in this class and I found today very useful. Here’s why . . .
  • I’m in this class and I thought today was a waste of time. Here’s why . . .
  • Of course you don’t leave the ground on a parabolic hill, everyone knows that.
  • Why didn’t you type up all the stuff you said in the screencasts? I hate watching videos.
  • Thanks for the screencasts, do your students find them useful?
  • Mathematica had that new method two years ago, I just decided not to tell you about it
  • Here’s a suggestion for a sled/hill problem with a constraint that’s hard to solve for one of the variables . . .
Advertisements

About Andy "SuperFly" Rundquist

Professor of physics at Hamline University in St. Paul, MN
This entry was posted in mathematica, physics, syllabus creation, teaching. Bookmark the permalink.

One Response to Lagrange multipliers revisited

  1. Pingback: Relativistic Lagrangians | SuperFly Physics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s