function y=f(x)
    if x<=1/2
       y=2*x;
    else
       y=2-2*x;
    end