function fx = p05_fx ( n, x )

%*****************************************************************************80
%
%% p05_fx() evaluates the function for problem 4.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of variables and equations.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real FX(N), the function value.
%
  fx = zeros ( n, 1 );

  if ( 0.0 < x(1) )
    temp = atan ( x(2) / x(1) ) / ( 2.0 * pi );
  elseif (x(1) < 0.0 )
    temp = atan ( x(2) / x(1) ) / ( 2.0 * pi ) + 0.5;
  else
    temp = 0.25 * sign ( x(2) );
  end

  fx(1) = 10.0 * ( x(3) - 10.0 * temp );
  fx(2) = 10.0 * ( sqrt ( x(1)^2 + x(2)^2 ) - 1.0 );
  fx(3) = x(3);

  return
end

