function fjac = p08_jac ( n, x )

%*****************************************************************************80
%
%% p08_jac() sets the jacobian for problem 8.
%
%  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 FJAC(N,N), the jacobian matrix.
%
  fjac = zeros ( n, n );

  for j = 1 : n
    fjac(1:n-1,j) = 1.0;
  end

  for i = 1 : n - 1
    fjac(i,i) = 2.0;
  end
%
%  Last row:
%
  for j = 1 : n
    p = 1.0;
    for k = 1 : n
      if ( k ~= j )
        p = x(k) * p;
      end
    end
    fjac(n,j) = p;
  end

  return
end

