The variational principles of mechanics