function fjac = p24_jac ( n, x )

%*****************************************************************************80
%
%% p24_jac() sets the jacobian for problem 24.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 August 2026
%
%  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.
%
  a32 = x(1);
  a42 = x(2); 
  a43 = x(3);
  b1  = x(4);
  b2  = x(5);
  b3  = x(6);
  b4  = x(7);
  c2  = x(8);
  c3  = x(9);
  c4  = x(10);

  fjac = zeros ( n, n );

% fx(1)  = b1 + b2 + b3 + b4 - 1.0;
  fjac(1,4) = 1.0;
  fjac(1,5) = 1.0;
  fjac(1,6) = 1.0;
  fjac(1,7) = 1.0;

% fx(2)  = b2 * c2 + b3 * c3 + b4 * c4 - 0.5;
  fjac(2,5)  = c2;
  fjac(2,6)  = c3;
  fjac(2,7)  = c4;
  fjac(2,8)  = b2;
  fjac(2,9)  = b3;
  fjac(2,10) = b4;

% fx(3)  = b2 * c2^2 + b3 * c3^2 + b4 * c4^2 - 1.0 / 3.0;
  fjac(3,5)  = c2^2;
  fjac(3,6)  = c3^2;
  fjac(3,7)  = c4^2;
  fjac(3,8)  = 2.0 * b2 * c2;
  fjac(3,9)  = 2.0 * b3 * c3;
  fjac(3,10) = 2.0 * b4 * c4;

% fx(4)  = b3 * a32 * c2 + b4 * ( a42 * c2 + a43 * c3 ) - 1.0 / 6.0;
  fjac(4,1)  = b3 * c2;
  fjac(4,2)  = b4 * c2;
  fjac(4,3)  = b4 * c3;
  fjac(4,6)  = a32 * c2;
  fjac(4,7)  = a42 * c2 + a43 * c3;
  fjac(4,8)  = b3 * a32 + b4 * a42;
  fjac(4,9)  = b4 * a43;

% fx(5)  = b2 * c2^3 + b3 * c3^3 + b4 * c4^3 - 1.0 / 4.0;
  fjac(5,5)  = c2^3;
  fjac(5,6)  = c3^3;
  fjac(5,7)  = c4^3;
  fjac(5,8)  = 3.0 * b2 * c2^2;
  fjac(5,9)  = 3.0 * b3 * c3^2;
  fjac(5,10) = 3.0 * b4 * c4^2;

% fx(6)  = b3 * c3 * a32 * c2 + b4 * c4 * ( a42 * c2 + a43 * c3 ) - 1.0 / 8.0;
  fjac(6,1) = b3 * c3 * c2;
  fjac(6,2) = b4 * c4 * c2;
  fjac(6,3) = b4 * c4 * c3;
  fjac(6,6) = c3 * a32 * c2;
  fjac(6,7) = c4 * ( a42 * c2 + a43 * c3 );

% fx(7)  = b3 * a32 * c2^2 + b4 * ( a42 * c2^2 + a43 * c3^2 ) - 1.0 / 12.0;
  fjac(7,1) = b3 * c2^2;
  fjac(7,2) = b4 * c2^2;
  fjac(7,3) = b4 * c3^2;
  fjac(7,6) = a32 * c2^2;
  fjac(7,7) = a42 * c2^2 + a43 * c3^2;
  fjac(7,8) = 2.0 * b3 * a32 * c2 + 2.0 * b4 * a42 * c2;
  fjac(7,9) = 4.0 * b4 * a43 * c3^2;

% fx(8)  = b4 * a43 * a32 * c2 - 1.0 / 24.0;
  fjac(8,1) = b4 * a43 * c2;
  fjac(8,3) = b4 * a32 * c2;
  fjac(8,7) = a43 * a32 * c2;
  fjac(8,8) = b4 * a43 * a32;

% fx(9)  = b2 - b3;
  fjac(9,5) = 1.0;
  fjac(9,6) = - 1.0;

% fx(10) = c2 - c3;
  fjac(10,8) = 1.0;
  fjac(10,9) = - 1.0;

  return
end

