maximizing profit from a production function