Phuong Piecewise Function