How to derive lagrangian for any classical system?

In summary, there is no general rule for deriving the Lagrangian. Instead, one guesses the Lagrangian based on the sort of particles and fields you expect to have.
  • #1
Alexandre
29
0
Suppose I come up with a system that has certain number of particles with certain masses and are interconnected between each other in a certain way and are acted by forces which are also part of the system. What's the general rule for finding potential and kinetic energies as functions of coordinates and their derivatives? I don't expect the answer to be as simple to put it out here in comment section but maybe you could point me to some textbook or a video that explains that in full detail?
 
Physics news on Phys.org
  • #2
As far as I know, there is no rule for deriving the Lagrangian. Instead, one guesses the Lagrangian based on the sort of particles and fields you expect to have.

In nonrelativistic single-particle physics, the ingredients that you have to play around with are scalars, vectors and tensors:
  1. The velocity vector [itex]\vec{v}[/itex]
  2. The electromagnetic vector potential [itex]\vec{A}[/itex]
  3. The electromagnetic scalar potential [itex]\phi[/itex]
  4. The electromagnetic field tensor, with components [itex]\vec{E}[/itex] and [itex]\vec{B}[/itex]
Then you go through the possible ways to combine these to get a scalar (a Lagrangian has to be a scalar). The simplest Lagrangian that leads to interesting dynamics is:

[itex]L = \frac{m}{2} |v|^2 - q \vec{v} \cdot \vec{A} - q \phi[/itex]

But you could certainly add more fields, or more complicated interactions between fields and particles. There is no rule other than the fact the result needs to be a scalar.
 
  • #3
stevendaryl said:
But you could certainly add more fields, or more complicated interactions between fields and particles. There is no rule other than the fact the result needs to be a scalar.

Hmm interesting, thanks for the reply! I understand that now but what if there are many particles and they are not free but instead are bonded by either elastic or rigid rods to each other and/or to the ground/ceiling/wall. Are there any textbook examples for those kind of problems? Any useful tricks? How to chose generalized coordinates (cartesian, polar or any other coordinates) and so forth...
 
  • #4
Well, for most such problems, the Lagrangian can just be written as [itex]KE - PE[/itex] where [itex]KE[/itex] is the kinetic energy, and [itex]PE[/itex] is the potential energy. The form of the kinetic energy changes, depending on whether you are using cartesian coordinates, or not. The potential energy for such problems usually involves two types of potential: (1) gravitational (or electrical, which is similar), (2) harmonic oscillator, the potential of a spring. It can be a little complicated to figure out the kinetic energy and potential energy for extended objects (such as rods and blocks and ropes and so forth).

Another wrinkle is that often such problems involve constraints. That is, some object is constrained to move in a circle (on tracks), or something like that. Problems with constraints are typically not solved by trying to figure out the forces or the potentials, but instead are solved using the method of Lagrange multipliers. The general idea is this: Suppose you have a problem involving coordinates [itex]x[/itex] and [itex]y[/itex] and you are constrained so that [itex]x^2 + y^2 = R^2[/itex] (so the motion is confined to a circle). Then one approach is this: If [itex]x[/itex] and [itex]y[/itex] are constrained so that [itex]F(x,y) = [/itex] a constant, then let [itex]L_0[/itex] be the lagrangian that you would have without the constraint. Then you create a new Lagrangian: [itex]L = L_0 - \lambda F(x,y)[/itex] where [itex]\lambda[/itex] is some unspecified constant. So this is like a new potential energy term to the Lagrangian, although the magnitude is unknown. If you solve the Lagrangian equations of motion using this potential energy term, you'll get equations of motion that might involve [itex]\lambda[/itex]. But then afterwards, [itex]\lambda[/itex] can be eliminated by imposing the constraint that [itex]F(x,y) = [/itex] whatever.
 
  • #5
stevendaryl said:
Suppose you have a problem involving coordinates [itex]x[/itex] and [itex]y[/itex] and you are constrained so that [itex]x^2 + y^2 = R^2[/itex] (so the motion is confined to a circle). Then one approach is this: If [itex]x[/itex] and [itex]y[/itex] are constrained so that [itex]F(x,y) = [/itex] a constant, then let [itex]L_0[/itex] be the lagrangian that you would have without the constraint. Then you create a new Lagrangian: [itex]L = L_0 - \lambda F(x,y)[/itex] where [itex]\lambda[/itex] is some unspecified constant.

Well, I've actually tried solving this and added potential energy due to gravity along y axes ([itex]mgy[/itex]), Lagrangian I've got is:

[itex]L=\frac{m}{2}(ẋ²+ẏ²)-mgy-\lambda(x²+y²)[/itex]

I've solved the equations and It turns out [itex]\lambda[/itex] should equal to mass, otherwise I get Lissajous curve shaped trajectory which makes no sense. The problem I have is that the trajectory is not always a circle, most of the times it's an ellipse. Here you can check the animated solution and play around with it:

https://www.desmos.com/calculator/pm3uuxqoif
(L≡lambda)

My guess is that initial position and velocity along both axis should be somehow restricted to satisfy my confinements. The obvious restriction is that initial position should not be greater than the radius of the circle and probably initial velocity should be a cosine of initial position. But that doesn't seem to be enough, I'm still getting an ellipse and the weirder thing is that changing free fall acceleration g also has an effect on the trajectory. What am I getting wrong? Do I have to think through all of these details every time I'm using [itex]L = L_0 - \lambda F(x,y)[/itex] formula?

P.S.

One more restriction I figured out is y initial should be equal to plus or minus square root of [itex]1-x_0²[/itex] (where x0 is x component of initial position) because initial point should lay on the circle. But there should be more restrictions because I'm getting ellipses anyway. And it seems to me that this system should be equivalent to mathematical pendulum with a rigid rod but what I'm getting is far from that.
 
Last edited:
  • #6
The Lagrangian you wrote down is the Lagrangian for a particle that moves in a plane and is subject to the constant gravitational force (an approximation valid close to the surface of the earth) and a harmonic-oscillator potential. The harmonic potential reads in physical terms
[tex]V_{\text{osc}}=\frac{m \omega^2}{2} (x^2+y^2).[/tex]
The total potential is
[tex]V=\frac{m \omega^2}{2} (x^2+y^2)+mg y = \frac{m \omega^2}{2} x^2 + \frac{m \omega^2}{2} \left (y+\frac{g}{2 \omega^2} \right )^2 - \frac{m g^2}{8 \omega^2}.[/tex]
Introducing the new coordinate [itex]y'=y+\frac{g}{2 \omega^2}[/itex] and dropping the irrelevant constant in the potential you get the corresponding new Lagrangian
[tex]L=\frac{m}{2} (\dot{x}^2+\dot{y}{}^2) - \frac{m \omega^2}{2} (x^2+y'{}^2).[/tex]
The equations of motion read
[tex]\ddot{x}=-\omega^2 x, \quad \ddot{y}=-\omega^2 y.[/tex]
The solutions are
[tex]x(t)=x_0 \cos(\omega t) +\frac{\dot{x}_0}{\omega} \sin(\omega t),[/tex]
[tex]y'(t)=y_0' \cos(\omega t) + \frac{\dot{y}_0'}{\omega} \sin(\omega t).[/tex]
The trajectory is an ellipse.

I do not understand your animations.
 
  • #7
If that Lagrangian which I constructed has an oscillator (and I think it has) than what stevendaryl said is not quite correct:
stevendaryl said:
Suppose you have a problem involving coordinates [itex]x[/itex] and [itex]y[/itex] and you are constrained so that [itex]x^2 + y^2 = R^2[/itex] (so the motion is confined to a circle). Then one approach is this: If [itex]x[/itex] and [itex]y[/itex] are constrained so that [itex]F(x,y) = [/itex] a constant, then let [itex]L_0[/itex] be the lagrangian that you would have without the constraint. Then you create a new Lagrangian: [itex]L = L_0 - \lambda F(x,y)[/itex] where [itex]\lambda[/itex] is some unspecified constant.

I should look up Lagrange multipliers on google to understand how they work... And I think I've spotted an error here:

vanhees71 said:
[tex]V=\frac{m \omega^2}{2} (x^2+y^2)+mg y = \frac{m \omega^2}{2} x^2 + \frac{m \omega^2}{2} \left (y+\frac{g}{2 \omega^2} \right )^2 - \frac{m g^2}{8 \omega^2}.[/tex]

If you calculate backwards you get extra 2 in denominator of gravitational potential

[tex]\frac{m \omega^2}{2} x^2 + \frac{m \omega^2}{2} \left (y+\frac{g}{2 \omega^2} \right )^2 - \frac{m g^2}{8 \omega^2} = \frac{m \omega^2}{2} x^2 + \frac{m \omega^2}{2} \left (y^2+\frac{gy}{ \omega^2} + \frac{g^2}{4 \omega^4} \right ) - \frac{m g^2}{8 \omega^2} [/tex]

[tex] \frac{m \omega^2}{2} x^2 + \frac{m \omega^2}{2}y^2+\frac{mg}{2}y + \frac{mg^2}{8 \omega^2} - \frac{m g^2}{8 \omega^2} = \frac{m \omega^2}{2} \left (x^2 + y^2 \right)+\frac{mg}{2}y [/tex]
 
  • #8
vanhees71 said:
The Lagrangian you wrote down is the Lagrangian for a particle that moves in a plane and is subject to the constant gravitational force (an approximation valid close to the surface of the earth) and a harmonic-oscillator potential.

That is certainly correct. However, according to http://en.wikipedia.org/wiki/Lagrangian_mechanics#Lagrange_equations_of_the_first_kind,
it is the way to incorporate the constraint [itex]x^2+y^2 = R^2[/itex] into the Lagrangian. However, I really don't see that the following two approaches are equivalent, in this example:

1. Use polar coordinates, and use the Lagrangian: [itex]1/2 m R^2 \dot{\theta}^2 - m g R sin(\theta)[/itex]
2. Use rectangular coordinates, and use the Lagrangian [itex]1/2 m (\dot{x}^2 + \dot{y}^2) - m g y - \lambda (x^2 + y^2)[/itex]

With the latter approach, [itex]\lambda[/itex] has to be chosen so that there is no motion in the radial direction.

As I said, it's not completely clear to me that these approaches give the same result.
 
  • #9
I see. Then I was mistaken, because I've not seen that you want to solve a system with constraints. As you correctly say, you can solve this holonomous contraint
[tex]f(x,y)=0[/tex]
by introducing an auxiliary function in the sense of a Lagrange parameter. Varying the action wrt. this parameter should give the constraint. In our case the Lagrangian should then read
[tex]L=\frac{m}{2} (\dot{x}^2+\dot{y}^2) - m g y - \frac{\lambda}{2}(x^2+y^2-R^2).[/tex]
I introduced the additional factor 1/2 for convenience, but it's important to put the [itex]-R^2[/itex] term in.

Now the equations of motion are given by the Euler-Lagrange equations of the variational principle under independent variations of [itex]x[/itex], [itex]y[/itex], [itex]\lambda[/itex]:
[tex]m \ddot{x}=-\lambda x,[/tex]
[tex]m \ddot{y}=-\lambda y - mg,[/tex]
[tex]x^2+y^2-R^2=0.[/tex]
It's clear from this equation that the terms in the first two equation involving [itex]\lambda[/itex] provide the force centripetal necessary to fulfill the constraint, i.e., to keep the particle on a circle.

It's clear that it's way easier to solve the problem by introducing the angle. It's a bit more convenient to count it from the minimum of the potential, i.e.,
[tex]x=R \sin \varphi, \quad y=-R \cos \varphi.[/tex]
The Lagrangian then reads
[tex]L=\frac{m R^2}{2} \dot{\varphi}^2+m g R \cos \varphi.[/tex]
The term with the Lagrange parameter now is automatically eliminated, because the constraint is fulfilled by parametrizing via the introduction generalized coordinate.

The equation of motion then reads
[tex]m R^2 \ddot{\varphi}=-m g R \sin \varphi.[/tex]
This is the equation of a mathematical pendulum as it must be, and now also the animation quoted in the posting above makes sense!
 
  • #10
please lagrangian for a particle of mass m is connected between two spring of constants k1& k2
 

Related to How to derive lagrangian for any classical system?

1. What is the Lagrangian in classical mechanics?

The Lagrangian is a function in classical mechanics that represents the total energy of a system. It is defined as the difference between the kinetic and potential energies of the system.

2. How do you derive the Lagrangian for a classical system?

The Lagrangian can be derived using the Euler-Lagrange equation, which is a mathematical tool that relates the Lagrangian to the equations of motion of the system. It involves taking partial derivatives of the Lagrangian with respect to the variables of the system.

3. Can the Lagrangian be derived for any classical system?

Yes, the Lagrangian can be derived for any classical system as long as the system can be described using generalized coordinates and the principle of least action can be applied.

4. What is the principle of least action?

The principle of least action states that the true path of a system between two points in space and time is the one that minimizes the action, which is the integral of the Lagrangian over time. This principle is equivalent to Newton's laws of motion and is used to derive the equations of motion for a system.

5. Are there any advantages to using the Lagrangian over other formulations in classical mechanics?

Yes, there are several advantages to using the Lagrangian formulation. It allows for a more concise and elegant representation of the equations of motion, and it is also easier to apply to systems with constraints or non-Cartesian coordinates. Additionally, the Lagrangian is invariant under coordinate transformations, making it useful for analyzing systems from different reference frames.

Similar threads

Replies
5
Views
754
  • Classical Physics
Replies
5
Views
1K
  • Classical Physics
Replies
13
Views
2K
Replies
1
Views
482
Replies
13
Views
1K
Replies
30
Views
2K
Replies
12
Views
870
Replies
16
Views
916
  • Classical Physics
2
Replies
48
Views
2K
  • Classical Physics
Replies
7
Views
1K
Back
Top