Calculus of variations and advanced calculus