Seol mar théacs é seo: Optimal control theory with applications in economics