function fjac = p09_jac ( n, x )

%*****************************************************************************80
%
%% p09_jac() sets the jacobian for problem 9.
%
%  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 i = 1 : n

    fjac(i,i) = 2.0 + 1.5 * ( x(i) + 1.0 + i / ( n + 1 )  )^2 / ( n + 1 )^2;

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

    if ( i < n )
      fjac(i,i+1) = - 1.0;
    end

  end

  return
end

