Pātuhitia tēnei: Calculus of variations with applications