[home]
Lagrangian Mechanics



Suppose the state of a mechanical system can be described by a set of coordinates q0,q1,...,qn-1. These do not have to be cartesian coordinates; for instance, the state of a double pendulum is determined by two angles. Let q'0,q'1,...,q'n-1 be the time derivatives of these coordinates. Suppose we have an expression
U = U(q0,q1,...,qn-1)
for the potential energy, and an expression
T = T(q0,q1,...,qn-1,q'0,q'1,...,q'n-1)
for the kinetic energy of the system in terms of these coordinates. From this data, Lagrangian Mechanics allows us to predict the behavior of the system. The behavior is expressed as a system of n second-order differential equations. The Lagrangian equations of motion are
d/dt dL/dq'_i = dL/dq_i ,
where L = T - U. Equivalently,
sum_j(d^2L/dq'_i dq'_j)q''_j + sum_j(d^2L/dq'_i dq_j)q'_j = dL/dq_i .
Here we assume that L has no explicit time dependency, i.e. that the variable t does not occur in the formula for L. There is one equation for each coordinate i. The above is a system of linear equations Aq''+Bq'=v, where
A_ij = d^2L/dq'_i dq'_j, B_ij = d^2L/dq'_i dq_j, v_i = dL/dq_i ,
for i,j=0..n-1. At any given time in the evolution of the system, qj and q'j are known. The Lagrange Applet uses a numerical method to solve the above equations for q''i and to display the solution graphically.

The Lagrange Applet defines an abstract Java class MechSystem that can numerically solve these equations and display the motion of a system. For each particular type of mechanical system, one defines a subclass of MechSystem. This subclass must essentially define two things: methods for calculating the potential and kinetic energy, and methods for how the system is to be drawn. In addition, some methods must be defined for bookkeeping: for instance, methods that return the names and number of coordinates and constants. One can also define methods for handling mouse action, but this is optional.

  1. Double Pendulum,
  2. Double Spring,
  3. Spring Pendulum.


Back to main Lagrange page.
Back to Peter Selinger's Homepage: [home]


Peter Selinger / Department of Mathematics and Statistics / Dalhousie University
selinger@mathstat.dal.ca / PGP key
Updated Feb 4, 1999