Ned Nedialkov, Department of Computing and Software, McMaster University

**"Simulating Lagrangian Mechanics Directly"**

**Abstract: **We integrate numerically a system in a Lagrangian form directly, without deriving the underlying equations of motion explicitly. From a

C++ specification of a Lagrangian function and algebraic constraints,

our "Lagrangian" facility applies automatic differentiation to prepare a differential-algebraic equation (DAE) system, which is then solved by our high-index differential-algebraic equation (DAE) solver DAETS.

Lagrangian equations of the first kind contain algebraic constraints, resulting in an index-3 DAE; Lagrangian equations of the second kind are constraint-free, resulting in a system of ordinary differential equation (ODEs). The former are usually much simpler and easier to construct (in particular when using Cartesian coordinates) than the latter, which typically involve angle coordinates and non-trivial transformations to eliminate constraints. However, integrating an

index-3 DAE is substantially more difficult than integrating an ODE.

DAETS solves a high-index DAE as easily as an ODE. We model and simulate rigid-body mechanisms -- mechanical systems with linked rigid parts and possible other parts such as springs -- from a constrained Lagrangian formulation and using Cartesian coordinates. As a result, we have compact models and avoid lengthy symbolic transformations that are typically applied to derive a system of ODEs.

We illustrate by examples in 2D (such as the Andrews Squeezer Mechanism, one of the MBS Benchmark problems) and 3D, and report results of numerical solution by this method, with animations.

*This is joint work with J. Pryce, Cardiff University, UK.*