
(See this notebook on GitHub) tl;dr : Use functions like Deriv::Deriv(), splinefun(), approxfun(), and uniroot() to do things with derivatives in R, both with actual functions and with existing empirical data A typical microeconomics problem involves finding the optimal price and quantity of a product, given its demand and cost across different quantities.