function J = p18_j ( m, n, x )

%*****************************************************************************80
%
%% p18_j() evaluates the jacobian for problem 18.
%
%  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 );

  for i = 1 : 65

    temp = ( i - 1 ) / 10.0;
    tmp1 = exp ( -x(5) * temp );
    tmp2 = exp ( -x(6) * ( temp - x(9) )^2 );
    tmp3 = exp ( -x(7) * ( temp - x(10) )^2 );
    tmp4 = exp ( -x(8) * ( temp - x(11) )^2 );

    J(i,1) = -tmp1;
    J(i,2) = -tmp2;
    J(i,3) = -tmp3;
    J(i,4) = -tmp4;
    J(i,5) = temp * x(1) * tmp1;
    J(i,6) = x(2) * ( temp - x(9) )^2 * tmp2;
    J(i,7) = x(3) * ( temp - x(10) )^2 * tmp3;
    J(i,8) = x(4) * ( temp - x(11) )^2 * tmp4;
    J(i,9) = -2.0 * x(2) * x(6) * ( temp - x(9) ) * tmp2;
    J(i,10) = -2.0 * x(3) * x(7) * ( temp - x(10) ) * tmp3;
    J(i,11) = -2.0 * x(4) * x(8) * ( temp - x(11) ) * tmp4;

  end

  return
end
