A set of ordinary differential equations of motion for constrained mechanical systems