The Analytical Mechanics of Consumption