where the index r runs over the D generalized coordinates q r , which usually correspond to the degrees of freedom of the system. The function S is defined as the mass-weighted sum of the particle accelerations squared,