Calculus of Variations: with Applications to Physics and Engineering