y_new = y makes a reference to the data which shouldn't be changed in the function. This is achieved by creating anew array with the same shape as y