I'm trying to solve the following exercise
Consider a point P of mass m under the action of a spring of elastic constant $k>0$, whose origin rotates uniformly on a circle of fixed radius $R$ with constant angular velocity $\omega$.Write the Lagrangian and Lagrange equations wrt the cartesian coordinates $(x_1,x_2,x_3)$ and wrt a system of time-dependent coordinate $(q_1,q_2,q_3)$ that moves according to $C$.
My attempt
With cartesian coordinates
I have that the kinetic energy is simply given by $T=\frac{1}{2}m (\dot x_1^2+\dot x_2^2+ \dot x_3^2)$, while the potential energy has to be related to the movement of the spring in the $(x_1,x_2)$ plane. I have the relation $OP=O \bar{O} + \bar{O}P$ and hence
$x_1=R \cos(\omega t)+\tilde{x_1}, x_2=R \sin(\omega t)+\tilde{x_2}, x_3=\tilde{x_3}$ $(\star)$
hence the potential energy is
\begin{align} V(x_1,x_2,x_3)=\frac{k}{2}((x_1-R \cos(\omega t)^2+(x_2-R \sin(\omega t))^2+x_3^2) \end{align}
And hence I have just that $L=T-V$.
With coordinates that moves according to $C$
Here $P$ has coordinates $\tilde{x_1},\tilde{x_2},\tilde{x_3}$ with respect to the moving system.
Hence, $T=\frac{1}{2}m (\dot x_1^2+\dot x_2^2+ \dot x_3^2)$ and here each $x_i$ is given by $\star$, while the potential energy is $V(\tilde{x_1},\tilde{x_2},\tilde{x_3})=\frac{k}{2}(\tilde{x_1}^2+\tilde{x_2}^2+\tilde{x_3}^2)$
Could it be okay?