Variational principles in numerical practice