function fx = p16_fx ( n, x )

%*****************************************************************************80
%
%% p16_fx() evaluates the function for problem 16.
%
%  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 );

  fx(1) = ( x(1) * x(1) + x(2) * x(4) + x(3) * x(7) ) - 0.0001;
  fx(2) = ( x(1) * x(2) + x(2) * x(5) + x(3) * x(8) ) - 1.0;
  fx(3) = ( x(1) * x(3) + x(2) * x(6) + x(3) * x(9) );

  fx(4) = ( x(4) * x(1) + x(5) * x(4) + x(6) * x(7) );
  fx(5) = ( x(4) * x(2) + x(5) * x(5) + x(6) * x(8) ) - 0.0001;
  fx(6) = ( x(4) * x(3) + x(5) * x(6) + x(6) * x(9) );

  fx(7) = ( x(7) * x(1) + x(8) * x(4) + x(9) * x(7) );
  fx(8) = ( x(7) * x(2) + x(8) * x(5) + x(9) * x(8) );
  fx(9) = ( x(7) * x(3) + x(8) * x(6) + x(9) * x(9) ) - 0.0001;

  return
end

