Suppose we have a differential equation of the from
$L = \frac{1}{2}((I_1 + I_2 + m_1r_1^2 + m_2q_2^2)\dot{q}_1^2 + m_2\dot{q}_2^2) - a_g(m_1r_1 + m_2q_2) \sin q_1$.
and we want to find $g = \frac{\operatorname{d}}{\operatorname{d}t} \frac{\partial L}{\partial \dot q_1}$, and $h = \frac{\partial L}{\partial q_1}$.
For the first term I get $g = (I_1 + I_2 + m_1r_1^2 + m_2q_2^2)\ddot{q}_1$ which I'm pretty sure is correct. However, I believe the second term should be $h = 2m_2q_2\dot{q_1}\dot{q_2} + a_g(m_1r_1 + m_2q_2) \cos q_1$. I see where the cosine term appears from, but not $2m_2q_2\dot{q_1}\dot{q_2}$. Can anybody help me out?