function fjac = p13_jac ( n, x )

%*****************************************************************************80
%
%% p13_jac() sets the jacobian for problem 13.
%
%  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 k = 1 : n

    fjac(k,k) = 3.0 - 4.0 * x(k);

    if ( 1 < k )
      fjac(k,k-1) = - 1.0;
    end

    if ( k < n )
      fjac(k,k+1) = - 2.0;
    end

  end

  return
end
