Gauge Theory And Variational Principles