function f = p05_f ( m, n, x )

%*****************************************************************************80
%
%% p05_f() evaluates the M nonlinear functions for problem 5.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 March 2026
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jorge More, Burton Garbow, and Kenneth Hillstrom,
%    Testing unconstrained optimization software,
%    ACM Transactions on Mathematical Software,
%    Volume 7, pages 17-41, 1981.
%
%  Input:
%
%    integer M, the number of functions.
%
%    integer N, the number of unknowns.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real F(M), the value of the functions evaluated at X.
%
  f = zeros ( m, 1 );

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

  f(1) = 10.0 * ( x(3) - 10.0 * tmp1 );
  f(2) = 10.0 * ( sqrt ( x(1)^2 + x(2)^2 ) - 1.0 );
  f(3) = x(3);

  return
end

