For a double pendulum what would be the gravitational energy. I am trying to work out the Lagrangian for the double pendulum. I got the kinetic energy but I am struggling on the gravitational potential energy.
I tried calculating the gravitational: $$V = g(m_1+m_2)(l_1+l_2-l_1\cos\theta_1) - gm_2(l_2\cos\theta_2)$$ but on wolfram it uses a different equation. Am I wrong?