variational principles and natural boundary conditions for