Simple pendulum with moving support in a parabola The problem says that I have to find the equations of motion in the Hamiltonian formulation for a simple pendulum with mass $m$ and lenght $l$, which its support moves with no friction along the parabola given by $\displaystyle y = ax^2$ in the vertial plane $(x,y)$.
I'm stuck here because its hard for me to visualize how to build the equation for both energies (potential and kinetic) in order to get the Lagrangian, and then give the Hamiltonian.
I know that the energies of the pendulum alone are given by $$ T = \frac{1}{2}mv^2 $$
and $$ V = mgl(1 - \cos{\theta}) $$ 
Could you please give me any help or hint?
 A: So you have that the kinetic energy is given by
$$K = \frac{1}{2} m (\dot x^2 + \dot y^2 )$$
If you consider the angle the pendulum makes with the vertical to be $\theta$ and the length of the pendulum to be $l$ then you can write
$$x_m = x_s + l sin\theta $$ and $$y_m = y_s - l cos\theta $$
where $x_m$, $y_m$ represent the positions of the mass on the pendulum and $x_s$, $y_s$ represent the point on the support. Then the coordinates of the mass would be
$$(x,y) = (x_m , y_m) = (x_s + l sin\theta , y_s - l cos\theta) $$
since we have the constraint $y=ax^2$ which is then
$$(x,ax^2) \rightarrow (x +l sin\theta , ax^2 - l cos\theta) $$
where I have removed the subscripts. The potential energy is then given by
$$V = mg(ax^2 - l cos\theta)$$
Obviously the Hamiltonian is given by
$$H = K + V = \frac{1}{2} m ( \dot x^2 + \dot y^2 ) + mg(ax^2 - l cos\theta)$$
The Lagrangian is
$$L = K-V = \frac{1}{2} m \dot x^2 + \frac{1}{2} m  \dot y^2 -mgax^2 + mglcos\theta $$
This should be all the information you need to solve this problem.
