## 1.6.2 Systems with Rigid Constraints

So far we have found $L = T-V$ to be a suitable Lagrangian for systems of point particles subject to forces derived from a potential. In this section, we will find that $L = T − V$, expressed in *irredundant* coordinates, is also a suitable Lagrangian for modeling systems of point particles with rigid constraints.

### Lagrangians for rigidly constrained systems

We start with a system of $N$ point masses, indexed by $\alpha$ in 3D space. We choose a set of generalized coordinates $q$ that have the system constraints built into them. The rectangular coordinates can then be defined as:

where all the coordinate constraints are built into the functions $f_\alpha$. The velocities can then be obtained in terms of the generalized velocities, $v$ in the same manner as in the last section as:

The kinetic energy in rectangular coordinates can be obtained as:

Converting to generalized coordinates:

Similarly, the potential energy in generalized coordinates is:

The Lagrangian can then be obtained as $L = T - V$.

### A pendulum driven at the pivot

Consider a pendulum of length $l$ and mass $m$, modeled as a point mass, supported by a pivot that is driven in the vertical direction by a given function of time $y_s(t)$. This system has a single degree of freedom and can be represented by the generalized coordinate $\theta$, the angle of the pendulum from the vertical.

The position of the bob is given in rectangular coordinates by

The velocities are:

The kinetic energy is:

The potential energy $\widetilde{V}(t; x,y) = mgy$ in rectangular coordinates. Therefore in generalized coordinates,

```
;; Computing EoMs
(defn T-pend-on-pivot [m l g y_s]
(fn [[t [theta] [thetadot]]]
(let [Dy_s ((D y_s) t)]
(* 1/2 m
(+ (square (* l thetadot))
(square Dy_s)
(* 2 l (sin theta) Dy_s thetadot)
)
)
)
)
)
(defn V-pend-on-pivot [m l g y_s]
(fn [[t [theta] [thetadot]]]
(* m g (- (y_s t) (* l (cos theta))))
))
(def L-pend-on-pivot (- T-pend-on-pivot V-pend-on-pivot))
;; (render
;; (let [local ((Gamma (up (literal-function 'theta))) 't)
;; L (L-pend-on-pivot 'm 'l 'g (literal-function 'y_s))
;; ]
;; (L local)
;; ))
;; EOMs for pendulum driven at pivot
(let [L (L-pend-on-pivot 'm 'l 'g (literal-function 'y_s))
state (up (literal-function 'theta))]
(rendertex (((Lagrange-equations L) state) 't)))
```