derivative of triangular function