結果 : how to take derivative of a piecewise function