# Equation for Simple Harmonic Oscillator with moving base

It is known that the base of a simple harmonic oscillator moves according to a known function $$u(t)$$. Is the dynamics of this system given by

$$m\ddot{x} = -\nabla V = -\nabla\frac{k}{2}|x - u(t)|^2 = -k(x-u(t))$$

I am worried that there may be additional terms due to change of coordinate system. What would be a general way to approach the construction of such equations. I have considered using Euler-Lagrange, but I'm not sure if it is applicable, namely, since I am not sure if the system is no longer closed in presence of $$u(t)$$