1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to derive lagrangian for any classical system?

  1. Oct 8, 2014 #1
    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?
     
  2. jcsd
  3. Oct 8, 2014 #2

    stevendaryl

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
     
  4. Oct 8, 2014 #3
    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....
     
  5. Oct 8, 2014 #4

    stevendaryl

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
     
  6. Oct 9, 2014 #5
    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: Oct 9, 2014
  7. Oct 10, 2014 #6

    vanhees71

    User Avatar
    Science Advisor
    2016 Award

    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.
     
  8. Oct 10, 2014 #7
    If that Lagrangian which I constructed has an oscillator (and I think it has) than what stevendaryl said is not quite correct:
    I should look up Lagrange multipliers on google to understand how they work.... And I think I've spotted an error here:

    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]
     
  9. Oct 11, 2014 #8

    stevendaryl

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
     
  10. Oct 12, 2014 #9

    vanhees71

    User Avatar
    Science Advisor
    2016 Award

    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!
     
  11. Nov 14, 2014 #10
    please lagrangian for a particle of mass m is connected between two spring of constants k1& k2
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to derive lagrangian for any classical system?
  1. Lagrangian systems (Replies: 0)

  2. Lagrangian Derivation (Replies: 2)

Loading...