function value = hilbert_f ( x, n )

%*****************************************************************************80
%
%% hilbert_f() evaluates the Hilbert function.
%
%  Discussion:
%
%    The function is a positive definite quadratic function of the form
%
%      f(x) = x' A x
%
%    where A is the Hilbert matrix, A(I,J) = 1/(I+J-1).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 July 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(N), the evaluation point.
%
%    integer N, the number of variables.
%
%  Output:
%
%    real VALUE, the function value.
%
  value = 0.0;

  for i = 1 : n
    for j = 1 : n
      value = value + x(i) * x(j) / ( i + j - 1 );
    end
  end

  return
end
