I recently had a problem on a quiz for a classical mechanics course that looked something like this:
A bead of mass $m$ is constrained to move on a rod that is tilted at a fixed angle $\theta$ with respect to the $x$-axis. The rod is accelerated along the $y$-axis with constant acceleration $a$, as shown in the diagram. Ignore gravity in your solution.
My question, and confusion while solving this problem, boiled down to what to do with the acceleration along the $y$-axis, and how to set up my Lagrangian to account for this. Defining $\mathscr{L} = T-V$, clearly $V =0$, as we are ignoring gravity in the problem. My issue lies with how to define $T$: is it possible to make $r$ a non-inertial coordinate such that $T = \frac{1}{2}m\dot{r}^2$, or do I have to make sure that my kinetic energy is written in inertial coordinates, that is, $T = \frac{1}{2}m(\dot{x}^2+\dot{y}^2) = \frac{1}{2}m(\dot{r}^2\cos^2(\theta)+(\dot{r}\sin(\theta)+at)^2))$
More generally, how does using non-intertial coordinates affect the standard formulation of the Lagrangian (and Hamiltonian)?