Calling v=dot xv=.x and omega = dot thetaω=.θ and
v_c = r omega(cos(theta),-sin(theta))+(v,0)vc=rω(cos(θ),−sin(θ))+(v,0) we have
E_K = 1/2(J omega^2+m_2 << v_c, v_c >> + m_1v^2)EK=12(Jω2+m2⟨vc,vc⟩+m1v2)
=1/2 ((m_1 + m_2)dot x^2 +
2 m_2 r cos(theta) dot x dot theta+ (J +
m_2 r^2)dot theta^2)=12((m1+m2).x2+2m2rcos(θ).x.θ+(J+m2r2).θ2)
E_P=(R-r)(1-cos(theta))m_2 g+1/2 x^2EP=(R−r)(1−cos(θ))m2g+12x2
so
L = E_K-E_PL=EK−EP
The movement equations are obtained solving for dot v, dot omega.v,.ω
d/(dt)((partial L)/(partial dot q))-(partial L)/(partial q) = F_qddt(∂L∂.q)−∂L∂q=Fq
where q = (x, theta)q=(x,θ) and F_q = (F,0)Fq=(F,0) obtaining
ddot x= ((J+m_2r^2)(F-k x + m_2 r sin(theta) dot theta^2)+m_2 g r(R-r)cos(theta)sin(theta))/((m_1+m_2)(J+m_2r^2)-m_2^2r^2cos^2(theta))
ddot theta=-(m_2cos(theta)(F r+ g(m_1+m_2)(R-r)tan(theta)-k r x +m_2r^2sin(theta)dot theta^2))/((m_1+m_2)(J+m_2r^2)-m_2^2r^2cos^2(theta))