Navigation

mechanics provides functionality for deriving equations of motion
using Lagrange’s method.
This document will describe Lagrange’s method as used in this module, but not
how the equations are actually derived.

The formulation of the equations of motion in mechanics using
Lagrange’s Method starts with the creation of generalized coordinates and a
Lagrangian. The Lagrangian can either be created with the Lagrangian
function or can be a user supplied function. In this case we will supply the
Lagrangian.

If there are any holonomic or non-holonomic constraints, they must be supplied
as keyword arguments (hol_coneqs and nonhol_coneqs respectively) in a
list of expressions which are equal to zero. Modifying the example above, the
equations of motion can then be generated:

>>> LM=LagrangesMethod(L,[q1,q2],hol_coneqs=[q1-q2])

When the equations of motion are generated in this case, the Lagrange
multipliers are introduced; they are represented by lam1 in this case. In
general, there will be as many multipliers as there are constraint equations.

Also in the case of systems with constraints, the ‘full’ mass matrix is
augmented by the \(k_{dc}(q, t)\) matrix, and the forcing vector by the
\(f_{dc}(q, \dot{q}, t)\) vector. The ‘full’ mass matrix is of size
(2n + o) x (2n + o), i.e. it’s a square matrix.

If there are any non-conservative forces or moments acting on the system,
they must also be supplied as keyword arguments in a list of 2-tuples of the
form (Point,Vector) or (ReferenceFrame,Vector) where the Vector
represents the non-conservative forces and torques. Along with this 2-tuple,
the inertial frame must also be specified as a keyword argument. This is shown
below by modifying the example above: