Dynamic Optimization: The Calculus of Variations and Optimal Control in Economics and Management