function J = p15_j ( m, n, x )

%*****************************************************************************80
%
%% p15_j() evaluates the jacobian for problem 15.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%  Modified:
%
%    03 March 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the number of equations.
%
%    integer N, the number of variables.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real J(M,N), the jacobian matrix.
%
  J = zeros ( m, n );

  dx = 1.0 / n;

  for j = 1 : n
    tmp1 = 1.0;
    tmp2 = 2.0 * x(j) - 1.0;
    temp = 2.0 * tmp2;
    tmp3 = 0.0;
    tmp4 = 2.0;
    for i = 1 : m
      J(i,j) = dx * tmp4;
      ti = 4.0 * tmp2 + temp * tmp4 - tmp3;
      tmp3 = tmp4;
      tmp4 = ti;
      ti = temp * tmp2 - tmp1;
      tmp1 = tmp2;
      tmp2 = ti;
    end
  end

  return
end
