It is a problem found in Physics. From the edge of a (in distance r to the center) disk a (mathematical) pendulum is hanging. The disk spins with a velocity w, which also stimulates the hanging pendulum.(As can be seen in the picture below)

The first intuition is to use Lagrange to solve the chaotic movement. $ L=T-V $ Our kinetic Energy would be: $ \begin{equation*} \begin{aligned} T=\frac{1}{2} \cdot m (l^2 \cdot \dot{\phi}^2+l^2\cdot w^2\cdot sin^2(\phi)) \end{aligned} \end{equation*} $
with the potential energy being: $ \begin{equation*} \begin{aligned} V=-g \cdot m \cdot l \cdot cos(\phi)) \end{aligned} \end{equation*} $
The Lagrangian would therefore be: $ \begin{equation*} \begin{aligned} L=\frac{1}{2} \cdot m (l^2 \cdot \dot{\phi}^2+l^2\cdot w^2\cdot sin^2(\phi))+g \cdot m \cdot l \cdot cos(\phi)) \end{aligned} \end{equation*} $
Now calculating the Euler-Lagrange differential equation leads to:
$ \begin{equation*} \begin{aligned} \frac{\partial L}{\partial \phi}-\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{\phi}}\right)= m \cdot l^2 \cdot \ddot{\phi} + m \cdot l^2 \cdot w^2 \cdot sin(\phi) \cdot cos(\phi) - m\cdot g \cdot l \cdot sin(\phi) = 0 \end{aligned} \end{equation*} $
This can now be adjusted for $\ddot{\phi}$ which results in the following:
$ \begin{equation*} \begin{aligned} \ddot{\phi}= - w^2 \cdot cos(\phi) \cdot sin(\phi)+\frac{g}{l}\cdot sin(\phi) \end{aligned} \end{equation*} $
Is this correct and how do we continue?
Given a referential with basis vectors $(\hat i, \hat j,\hat k)$ and making
$$ \cases{ q=r(\hat i \cos(\omega t) + \hat j\sin(\omega t))+q_0 \hat k\\ p = (x(t),y(t),z(t)) }\ \ \ \ \ (1) $$
the lagrangian reads
$$ L(p,\lambda, t) = \frac 12m\|\dot p\|^2-m g p\cdot\hat k+\lambda(\|p-q\|^2-l^2) $$
Here $\lambda$ is a lagrange multiplier to consider in the variation also the constraint $\|p-q\|=l^2$ and the movement equations are obtained from
$$ \cases{ \frac{d}{dt}\left(\frac{\partial L}{\partial \dot p}\right)-\frac{\partial L}{\partial p}=0\\ \frac{d^2}{dt^2}(\|p-q\|^2-l^2) = 0\\ } $$
or
$$ \cases{2 r \lambda \cos (\omega t)-2 \lambda x(t)+m x''(t)=0\\ 2 r\lambda \sin (\omega t)-2 \lambda y(t)+m y''(t)=0\\ g m+2 \lambda q_0-2 \lambda z(t)+m z''(t)=0\\ r \cos (\omega t)\left(\omega ^2 x(t)-2 \omega y'(t)-x''(t)\right)+r \sin(\omega t) \left(\omega ^2 y(t)+2 \omega x'(t)-y''(t)\right)+(z(t)-q_0) z''(t)+x(t)x''(t)+x'(t)^2+y(t) y''(t)+y'(t)^2+z'(t)^2=0 } $$
Solving for $\{x''(t),y''(y),z''(t),\lambda\}$ we have
$$ \cases{ x''(t)= \frac{(r \cos (\omega t)-x(t)) \left(r \omega \sin (\omega t) \left(\omega y(t)+2 x'(t)\right)+r \omega \cos (\omega t) \left(\omega x(t)-2 y'(t)\right)+g q_0-g z(t)+x'(t)^2+y'(t)^2+z'(t)^2\right)}{r^2-2 r x(t) \cos (\omega t)-2 a y(t) \sin (\omega t)+q_0^2-2 q_0 z(t)+x(t)^2+y(t)^2+z(t)^2}\\ y''(t)=\frac{(r \sin (\omega t)-y(t)) \left(r \omega \sin (\omega t) \left(\omega y(t)+2 x'(t)\right)+r \omega \cos (\omega t) \left(\omega x(t)-2 y'(t)\right)+g q_0-g z(t)+x'(t)^2+y'(t)^2+z'(t)^2\right)}{r^2-2 r x(t) \cos (\omega t)-2 r y(t) \sin (\omega t)+q_0^2-2 q_0 z(t)+x(t)^2+y(t)^2+z(t)^2}\\ z''(t)= \frac{-g r^2+r x(t) \cos (\omega t) \left(2 g+\omega ^2 q_0-\omega ^2 z(t)\right)+r y(t) \sin (\omega t) \left(2 g+\omega ^2 q_0-\omega ^2 z(t)\right)+(q_0-z(t)) \left(2 r \omega \sin (\omega t) x'(t)-2 r \omega \cos (\omega t) y'(t)+x'(t)^2+y'(t)^2+z'(t)^2\right)-g x(t)^2-g y(t)^2}{r^2-2 a x(t) \cos (\omega t)-2 r y(t) \sin (\omega t)+q_0^2-2 q_0 z(t)+x(t)^2+y(t)^2+z(t)^2} } $$
NOTE
The modeling can be done considering polar coordinates as sugested by @mjqxxxx
Making
$$ p = q-l(\cos(\theta)\sin(\phi),\cos(\theta)\cos(\phi),\sin(\theta))\ \ \ \ \ (2) $$
and considering now, the Lagrangian
$$ L(p(\theta,\phi), \dot p(\theta,\phi),t) = \frac 12m \|\dot p\|^2-m g p\cdot\hat k $$
so the resulting movement equations are much more simpler
$$ \cases{ \theta ''(t)= \frac{g \cos (\theta (t))-l \phi '(t)^2 \sin (\theta (t)) \cos (\theta (t))+\omega ^2 r \sin (\theta (t)) \sin (\omega t+\phi (t))}{l}\\ \phi ''(t)= 2 \phi '(t) \theta '(t) \tan (\theta (t))-\frac{\omega ^2 r \sec (\theta (t)) \cos (\omega t+\phi (t))}{l} } $$
Included a MATHEMATICA script with animation