SMS dit: Optimal control theory with applications in economics