Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do you a find a Hamiltonian?

  1. Apr 5, 2006 #1
    So when I first learned about Hamiltonians, my teacher presented them as something which you derived based Newton's second law, with the intermediate step of the Lagrangian. Doing it this way gets a Hamiltonian of the form H = T + V. Now I have a new teacher, who says that that these sorts of Hamiltonians are a special case, and that in general you can't derive them from anything. I was wondering how the people here approach the Hamiltonian- is it derived from something else, or simply developed (guessed) from experimental evidence? If you say that it's derived from a Lagrangian, please explain how you get the Lagrangian.
  2. jcsd
  3. Apr 5, 2006 #2
    I think your initial teacher may have confused you with his "derivation": Lagrange's equations are entirely equivalent to Newton's -- you can't really derive one without use of the other (see Marion & Thornton, 4th ed, pg. 258).
    On the topic of the Hamiltonian, it is based on 'Hamilton's Principle' that, "of all possible paths along which a dynamical system may move from one point to another in a specified time, then the actual path taken is that which minimizes the time integral of the difference between the kinetic and potential energies." I.e. the actual path is given when the variation of Lagrangian (L=T-V) is zero. The Lagrangian is not "derived" -- it's just what we call the difference in the kinetic and potential energies. So I guess it all comes from this Principle, and since it does coincide and reaffirm the conservation principles, then it does accurately describe the world.

    I think the "special case" your new teacher is talking about is if the potential, V, depends only on the (generalized) space coordinates and not on the (generalized) velocities, i.e. V is not time-dependent whatsoever.

    Just remember that Hamiltonian formalism is just another tool to get the equations of motion of a system. It's just easier to use scalar quantities (energy) and it accepts non-rectangular coordinates rather than Newtonian methods which are vector based on rect. coordinates.
  4. Apr 5, 2006 #3
    When I first studied Lagrangians and Hamiltonians, we used Marion and Thornton as the textbook. I'm well aware that, in that book, Lagrange and Hamilton's equations of motion are derived from a Newtonian framework. However, note that in this book the Lagrangian is defined to be L = T - V, momentum is defined to be m*v, and the Hamiltonian is "derived" from these as H = T + V. If you start with those definitions, then of course Lagrange's equations are equivalent to Newtons. Whereas, if you simply start with Hamilton's equations of motion, and don't restrict the form of the Hamiltonian, or the Lagrangian, or the momentum, you'll get some very non-Newtonian results. Moreover, you can derive the principle of least action more easily by starting with a Hamiltonian framework, then you can by starting with a Newtonian framework.

    Now, about time-dependance- this brings up another interesting question. If H has no explicit time-dependance, it's easy to show that its value is constant. Now, since H is a measure of energy, there's two interpretations of this.
    1)The Hamiltonian is equal to the total energy only when it is not time-dependant, because energy is always conserved
    2)The Hamiltonian measures the total energy, and energy is only conserved when the Hamiltonian is not time dependant

    My current teacher believes in the latter explanation, and I must admit that I'm starting to believe him. Still, I'm not certain about this.
  5. Apr 7, 2006 #4
    Hamiltonians and Lagrangians for a given law of motion

    The ability to derive a Lagrangian and Hamiltonian for a given 2nd order system of equations of motion is not automatic. So, this is not equivalent to Newton's second law or to systems whose equations of motion come ouf of that law. The extra conditions amount to what are known as Helmholtz's conditions.

    If you start out with a given system q = (q1,q2,...,qN) with q''(t) = A(q(t),q'(t)), there are certain conditions that apply to the "acceleration function" A before the system can have a Lagrangian or Hamiltonian formulation.

    These conditions give you the integrability conditions for certain partial differential equations whose solution ultimately gives you the Lagrangian in question (and from that, the Hamiltonian).

    For a system of the form q'(t) = v(t), m v'(t) = Q(t), where m is a NxN matrix and Q an N-dimensional vector (the generalized coefficients of inertia and generalized force, respectively), a similar set of conditions can be established that m and Q must satisfy for a Lagrangian or Hamiltonian to exist. It's this form of the law of motion that Helmholtz's conditions are usually stated in terms of, though the (q'=v,mv'=Q) formulation is weaker than the (q''=A) formulation.

    The (q''=A) formulation requires that there EXIST a matrix m ... that will ultimately be one and the same as the m in the 2nd formulation. It may depend on v = q' as well as q, but must satisfy the conditions
    dm_{ab}/dv^c = dm_{ac}/dv^b; m_{ab} = m_{ba}
    where a, b, c index the individual components. Once you have a suitable m, Q may be defined in terms of a by Q_a = sum (m_{ab} A^b). The remaining conditions are then those which apply (in either formulation) to Q:
    dQ_a/dv^b + dQ_b/dv^a = -2 D m_{ab}
    D (dQ_a/dv^b - dQ_b/dv^a) = 1/2 (dQ_a/dq^b - dQ_b/dq^a).
    D = d/dt + sum (v^c d/dq^c)

    (The derivatives above are partial derivatives)

    (I'm doing this off the top of my head, so I might have the 1/2's, 2's switched around).

    If you can either (a) find a set of coefficients m for the formulation (q''=A) that satisfy these 4 conditions; or (b) already have a set of coefficients (m,Q) in the formulation (q'=v,mv'=Q) that satisfy these conditions, then there is a set procedure to work backwards from here to get a Lagrangian. If the matrix m is non-singular, that determines whether a Hamiltonian can also be defined.

    I won't take this too far, but will point out that because of the two conditions on m, Frobenius's theorem already guarantees you the ability to integrate the system
    dp_a/dv^b = m_{ab}; p_a = dT/dv^a.
    This "T" plays the analogous role of kinetic energy and will form the core of what will become the Lagrangian. If you substitute this into the first condition on Q (and perform various manipulations to make it symmetric in the a and b indices), you get a system of the form
    dF_a/dv^b + dF_b/dv^a = 0
    where F = Q + (other terms). This proves that F is at most linear in v and ius of the form
    F_a = E_a(q) + sum (B_{ab}(q) v^b)
    where B_{ab} = -B_{ba}. The 2nd condition on Q will prove that E, B are derivable from "potentials" much like the E and B maxwell fields would be
    E_a = -d(phi)/dq^a - dA_a/dt
    B_{ab} = dA_b/dq^a - dA_a/dq^a.
    These can be used in the equation (F = Q + (other terms)), and the law of form mq'' = Q, ultimately to systematically build up the Lagrangian.

    All of these points apply also field equations. But only the (q'=v,mv'=Q) formulation is available. Instead of there being just a single evolution variable (t), field equations depend on a set of coordinates (x1,x2,...,xn). So, the "velocity" components are indexed but just by the system's index "a,b,c...", but by a coordinate index, "m,n,p,..."; and the system for which a Lagrangian is to be derived, must have the form:
    v^a_m = dq^a/dx^m
    sum (m_{ab}^{mn} d(v^b_n)/dx^m) = Q_a
    the latter sum taken over the indices b, m and n.

    The conditions are similar
    m_{ab}^{mn} = m_{ba}^{nm}
    d(m_{ab}^{mn})/dv^c_p = d(m_{ac}^{mp})/dv^b_n
    but more elaborate for Q:
    dQ_a/dv^b_n + dQ_b/dv^a_n =
    - sum D_m (m^{ab}_{mn} + m^{ba}_{mn})
    D_n (dQ_a/dv^b_n - dQ_b/dv^a_n) = 1/2 (dQ_a/dq^b - dQ_b/dq^a)

    the sum above is over the index m.

    Once you have this, you can proceed to integrate to arrive at a Lagrangian density.

    The process of building up a Lagrangian density and (if m is non-singular) a Hamiltonian density from this is more elaborate for the case of field equations than for the case of ordinary equations of motion.
  6. Apr 10, 2006 #5
    This is not a true statement. It is equivalent to Newton's laws in cases where forces of constraint do no work, which is not every problem. This is an important distinction. Newton's laws deal stupidly with constraints to motion regardless of their form, whereas Lagrange's equations do not provide a systematic method for dealing with nonholonomic constraints beyond those that are linear in the generalized velocities.

    It's an important distinction that gets lost in a lot of derivations. Also, you assume that the forces of constraint do no work, which need not necessarily be true (although a specific example escapes me at the moment).
  7. Apr 11, 2006 #6


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    1. I hardly see Newton's laws as "stupid". Wherever have you gotten that idea from?
    Nor can I see what is stupid with tackling problems involving other constraints than the simplistic holonomic ones.
    From a "Newtonian" perspective, the d'Alembert approach of getting the Lagrange equations with the use of the concept of virtual work is a highly elegant and systematic manner in removing "redundant" unknowns. If this approach cannot be used, too bad.
    Perhaps one can simplify the problem in some other manner.

    2. The Lagrangian approach is strong enough to derive the equations of motions as long as no VIRTUAL work is done by the constraint forces, even though the contstraint forces might do actual work (for example, normal forces from a moving surface might well do actual work over time) .
    Last edited: Apr 11, 2006
  8. Apr 11, 2006 #7

    Physics Monkey

    User Avatar
    Science Advisor
    Homework Helper

    Ha ha, I told him that someone would get onto him after that post of his (I know abszero in real life). In vague defense of my friend, I would point out that he didn't say Newton's laws are stupid, he merely said they deal stupidly with constraints. The d'Alembert approach is highly elegant, and that's the point. The other option is just to think real hard with Newton's laws. I think its fair to say to say there is a difference in sophistication there.

    Still, nobody talks bad about Newton and gets away with, right? Right!
  9. Apr 12, 2006 #8


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    I would say that problems with ugly, non-holonomic constraints are annoying, but it isn't "stupid" to try and tackle them as well. :smile:

    Besides, the level of sophistication needed to deal with such problems are not particularly less with such questions.
  10. Apr 13, 2006 #9
    That is not always true.
    Nonsense. If you're given T (kinetic energy) and V (potential energy) then you can form L = T - V, i.e. the Lagrangian L. The Hamiltonian is obtained from the Lagrangian through a Legendre transformation (See Goldstein 3rd Ed, section 8.1). The canoniocal momentum, p, is obtained through a derivative of the Lagrangian with respect to its canonical position, q. The quantity

    h(q, dq/dt, t) = (dq/dt)q - L(q, dq/dt, t)

    Is called the energy function. Once the variables are change then it becomes the Hamiltonian, i.e. h(q, dq/dt, t) => H(q, p, t) = Hamiltonian.

    The Legendre transformation lets you take the right side and transform it from a function of q, dq/dt to a function of q, p.

    Last edited: Apr 14, 2006
  11. Apr 14, 2006 #10


    User Avatar
    Science Advisor
    Homework Helper

    Interestingly, there's a lot to learn in order to prove the complete equivalence between the 2 variational problems in classical dynamics.
    That is, it's not really that obvious for constrained systems that hamiltonian dynamics is equivalent to lagrangian dynamics...

  12. Apr 16, 2006 #11
    This doesn't easily generalise to relativistic field theory. You usually have to guess some reasonable looking Lorentz scalar. For example, the electromagnetic field: there is no real motion of particles to start talking about kinetic and potential energies. Just a field tensor -- and a good guess is to contract it on itself twice to give a scalar, and that seems to give (up to some normalisation) Maxwell Eqns.
  13. Apr 16, 2006 #12
    If was posting the Hamiltonian of a classical particle. You're talking about relativistic fields. Its best to know what the person who started this thread wants.

  14. Apr 16, 2006 #13
    Is this a relativistic question or a non-relativistic mechanics question? Are you refering to the Hamiltonian of a particle or a field. To me it looks lile your working with the Hamiltonian of a particle in a field using non-relativistic mechanics. Is that correct?

  15. Apr 16, 2006 #14
    It looked like a particle to me as well. But note, I said this point of view doesn't easily generalise. I didn't say it's wrong.

    In any case, even for particle mechanics, you can choose any Lagrangian you want, it's just that L = T - V happens to give Newton's Laws for a certain (albeit very large) class of problems.
    Last edited: Apr 16, 2006
  16. Apr 16, 2006 #15
    I understand. The relativistic Lagrangians can be wierd. E.g. see Eq. 15 at


Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?