add piecewise
add piecewise