## A 3D Variable Mass Pendulum
[[cite_leeLieGroupVariational2005]] develop a variational integrator for 3D constant mass rigid pendulum. In this note, we derive the Lagrangian for a variable mass simple pendulum.
![[Fig1-eps-converted-to.pdf]]
We start with the Lagrangian of the system:
$
\mathcal{L} = \frac{1}{2} \int _{m} {^N\mathbf{v}^P} \cdot {^N\mathbf{v}^P} \, dm
$
Transferring velocity to point $O$ on the rigid body results in the following $\mathcal{L}$:
$
\mathcal{L} = \frac{1}{2} \int _{m}
\bigg(
{^N\mathbf{v}^O}
+ ({^N\boldsymbol{\omega}^B \times \mathbf{r})
+ {^B\mathbf{v}^P}}
\bigg)
\cdot
\bigg(
{^N\mathbf{v}^O}
+ ({^N\boldsymbol{\omega}^B \times \mathbf{r})
+ {^B\mathbf{v}^P}}
\bigg)
\, dm
$
Assuming $O$ to be the pivot point of the pendulum implies, ${^N\mathbf{v}^O} = 0$, which simplifies the Lagrangian to:
$
\mathcal{L} = \frac{1}{2} \int _{m}
\bigg(({^N\boldsymbol{\omega}^B \times \mathbf{r})
+ {^B\mathbf{v}^P}}
\bigg)
\cdot
\bigg(({^N\boldsymbol{\omega}^B \times \mathbf{r})
+ {^B\mathbf{v}^P}}
\bigg)
\, dm.
$
Expanding the above
$
\begin{align}
\mathcal{L} =
\frac{1}{2} {^N\boldsymbol{\omega}^B} \cdot \Bigg[\int _{m} \mathbf{r} \times({^N\boldsymbol{\omega}^B \times \mathbf{r})\, dm\\
+ 2\int _{m} \mathbf{r} \times {^B\mathbf{v}^P}}\, &dm \Bigg]\\
+ \frac{1}{2}\int _{m} {^B\mathbf{v}^P} \cdot {^B\mathbf{v}^P}\, &dm
\end{align}
$
$
\delta S = \delta \int _{t_{0}}^{t_{f}} \mathcal{L} \, dt = \frac{\partial}{\partial \epsilon}\Bigr|_{\epsilon=0} \int _{t_{0}}^{t_{f}} \mathcal{L} \, dt
$