The critical points of functions and the calculus of variations in the large