## Lagrangian and Hamiltonian Dynamics

1. (from Marion 7-29)

A simple pendulum consist of a mass m supended by a massless spring with unextended lenght b and spring constant k. The pendulum's point of support rises vertically with constant acceleration a. Find the Lagrange equation of motion.

Does the motion of the mass confided in a plane? Or i need to consider the motion in 3D?
Away from the gravitational potential energy, do i also need to consider the elastic potential energy in the spring? Is it equal to 1/2 k * b^2?

2. (from Marion 7-33)

Finding the Hamiltonian equation of motion of a double atwood machine

Using the generalized coordinates x and y in the figure.
i found:
p_x = m_1 * dx/dt +m_2*(dy/dt - dx/dt) + m_3 *(dx/dt + dydt)
p_y = m_2*(dy/dt - dx/dt) + m_3 *(dx/dt + dydt)
H = T + U =1/2*m_1*(dx/dt)^2 + 1/2 * m_2 *(dy/dt - dx/dt)^2 + 1/2*m_3 *(dx/dt + dydt)^2 - m_1 *g*x -m_2*g*(l_1 - x +y ) - m_3*g*(l_1+l_2-x-y)

How can i write H in terms of the generalized momentum (p_x and p_y) and coordinates only ?