Differentiation rule for piecewise definition by interval