function y = g(x)

% discontinuous + periodic
y = sign(sin(x));

% jump in first derivative:
y = 2*(abs(sin(x))-1/2);

% jump in second derivative:
y = .5*(cos(2*x)-1).*sign(mod(x/pi,2)-1);

% beautiful function:
y = sin(x);
