\frac{d}{dt}\frac{\partial T}{\partial \dot{q_j}}}-\frac{\partial T}{\partial q_j}=Q_j, j=1,...n