Energy and variational methods in applied mechanics