function fx = p04_fx ( n, x )

%*****************************************************************************80
%
%% p04_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 );

  temp1 = x(2) - x(1) * x(1);
  temp2 = x(4) - x(3) * x(3);

  fx(1) = - 200.0 * x(1) * temp1 - ( 1.0 - x(1) );
  fx(2) = 200.0 * temp1 + 20.2 * ( x(2) - 1.0 ) + 19.8 * ( x(4) - 1.0 );
  fx(3) = - 180.0 * x(3) * temp2 - ( 1.0 - x(3) );
  fx(4) = 180.0 * temp2 + 20.2 * ( x(4) - 1.0 ) + 19.8 * ( x(2) - 1.0 );

  return
end

