function T = tent(x)
   if x < 0.5
       T = 2*x;
   else
       T = -2*x + 2;    
   end        
end