Variational aspects of analytical mechanics