function gcoef = monomial_to_gegenbauer ( n, alpha, mcoef )

%*****************************************************************************80
%
%% monomial_to_gegenbauer() converts from monomial to Gegenbauer form.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    26 February 2024
%
%  Author:
%
%    John Burkardt.
%
%  Input:
%
%    integer n: the order of the polynomial.
%
%    real alpha: the Gegenbauer parameter.
%
%    real mcoef(1:n+1): the monomial coefficients of the polynomial.
% 
%  Output:
%
%    real gcoef(1:n+1): the Gegenbauer coefficients of the polynomial.
%
  if ( n < 0 )
    return;
  end
%
%  Force mcoef to be a column vector!.
%
  mcoef = mcoef(:);
%
%  Get the matrix.
%
  A = monomial_to_gegenbauer_matrix ( n + 1, alpha );
%
%  Compute linear map.
%
  gcoef = A * mcoef;

  return
end
