Add support to calculate analytical derivative of ifelse function (assuming it was used to define piecewise functions).