function fjac = p15_jac ( n, x )

%*****************************************************************************80
%
%% p15_jac() sets the jacobian for problem 15.
%
%  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 );

  fjac(1,1) = 2.0 * x(1);
  fjac(1,2) = x(3);
  fjac(1,3) = x(2);
  fjac(1,4) = 0.0;

  fjac(2,1) = x(2);
  fjac(2,2) = x(1) + x(4);
  fjac(2,3) = 0.0;
  fjac(2,4) = x(2);

  fjac(3,1) = x(3);
  fjac(3,2) = 0.0;
  fjac(3,3) = x(1) + x(4);
  fjac(3,4) = x(3);

  fjac(4,1) = 0.0;
  fjac(4,2) = x(3);
  fjac(4,3) = x(2);
  fjac(4,4) = 2.0 * x(4);

  return
end

