function ff=f(s)
%---------------------------------------
% Four test functions:
% 1. sqrt((z+1)(1-z))cos(x/2+y/3+z/5)
% 2. cos(30xyz) if z<1/2 and sqrt(x^2+...
%     y^2+z^2)^3 if z>=1/2 
% 3. exp(-sin(2x^2+3y^2+5z^2)) 
% 4. exp(-sqrt(x^2+y^2+z^2))/(1+x^2)...
%     *cos(1+x^2)sin(1-y^2)exp(abs(z))
%----------------------------------------
switch s
    case 1
        ff=@(x,y,z) sqrt((z+1).*(1-z)).*cos(x./2+y./3+z./5);
    case 2
        ff=@(x,y,z) cos(30.*x.*y.*z).*(z<1/2)+sqrt(x.^2+y.^2+z.^2).^3.*(z>=1/2);
    case 3
        ff=@(x,y,z) exp(-sin(2.*x.^2+3.*y.^2+5.*z.^2));
    case 4
        ff=@(x,y,z) exp(-sqrt(x.^2+y.^2+z.^2))./(1+x.^2).*cos(1+x.^2).*sin(1-y.^2).*exp(abs(z));
end

end