function a = monomial_to_h_matrix ( n )

%*****************************************************************************80
%
%% monomial_to_h_matrix(): the monomial to Physicist's Hermite conversion matrix.
%
%  Example:
%
%    N = 11
%    Each column must be scaled by the divisor listed below it.
%
%    1  .  2  .  12  .  120    .  1680     . 30240
%    .  1  .  6     60    .  840     . 15120     .
%    .  .  1  .  12  .  180    .  3369     . 75600
%    .  .  .  1   . 20    .  420     . 10080     .
%    .  .  .  .   1  .   30    .   840     . 24200
%    .  .  .  .   .  1    .   42     .  1512     .
%    .  .  .  .   .  .    1    .    56     .  2520
%    .  .  .  .   .  .    .    1     .    72     .
%    .  .  .  .   .  .    .    .     1     .    90
%    .  .  .  .   .  .    .    .     .     1     .
%    .  .  .  .   .  .    .    .     .     .     1
%
%   /1 /2 /4 /8 /16 /32 /64 /128  /256  /512 /1024
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 March 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%  Output:
%
%    real A(N,N), the matrix.
%
  a = zeros ( n, n );

  a(1,1) = 1.0;

  if ( n == 1 )
    return
  end

  a(2,2) = 0.5;

  if ( n == 2 )
    return
  end

  for j = 3 : n
    for i = 1 : n
      if ( i == 1 )
        a(i,j) = ( ( j - 2 ) * a(i,j-2)              ) / 2.0;
      else
        a(i,j) = ( ( j - 2 ) * a(i,j-2) + a(i-1,j-1) ) / 2.0;
      end
    end
  end

  return
end
