function fjac = p14_jac ( n, x )

%*****************************************************************************80
%
%% P14_JAC sets the jacobian for problem 14.
%
%  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 );

  ml = 5;
  mu = 1;

  for k = 1 : n

    k1 = max ( 1, k - ml );
    k2 = min ( n, k + mu );

    for j = k1 : k2
      if ( j ~= k )
        fjac(k,j) = - ( 1.0 + 2.0 * x(j) );
      else
        fjac(k,j) = 2.0 + 15.0 * x(k) * x(k);
      end
    end

  end

  return
end
