Marginal Cost Function Calculus