function a = h_to_monomial_matrix ( n )

%*****************************************************************************80
%
%% h_to_monomial_matrix(): physicist's Hermite to monomial conversion matrix.
%
%  Discussion:
%
%    Here we are using the physicist's Hermite polynomial.
%
%  Example:
%
%    N = 11
%
%      1  .  -2   .    12     .    -120     .   1680     .   -30240
%      .  2   .  12     .   120      .  -1680      . 30240        .
%      .  .   4   .   -48     .     720     . -13440     .   302400
%      .  .   .   8     .  -160       .  3360   .   -80640        .
%      .  .   .   .    16     .    -480     .  13440     .  -403200
%      .  .   .   .     .    32       . -1344      . 48384        .
%      .  .   .   .     .     .      64     .  -3584     .   161280
%      .  .   .   .     .     .       .   128      . -9216        .
%      .  .   .   .     .     .       .     .    256     .   -23040
%      .  .   .   .     .     .       .     .      .   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 );

  if ( n <= 0 )
    return
  end

  a(1,1) = 1.0;

  if ( n == 1 )
    return
  end

  a(2,2) = 2.0;

  if ( n == 2 )
    return
  end

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

  return
end

