We present an application of the Dynamic Programming (DP) and of the Maximum Principle (MP) to solve an optimization over time when the production function is linear in the stock of capital (Ak model). Two views of capital are considered. In one, which is embraced by the great majority of macroeconomic models, capital is homogeneous and depreciates at a constant exogenous rate. In the other view each piece of capital has its own finite productive life cycle (vintage capital). The interpretation of the time patterns of macroaggregates is quite different between the two cases. A technological shock generates an oscillatory movement in the time pattern of per capita output when capital has a vintage structure; conversely an instantaneous adjust...