function mcoef = legendre_to_monomial ( n, lcoef )

%*****************************************************************************80
%
%% legendre_to_monomial() converts from Legendre to monomial form.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 February 2024
%
%  Author:
%
%    John Burkardt.
%
%  Input:
%
%    integer n: the order of the polynomial.
%
%    real lcoef(1:n+1): the Legendre coefficients of the polynomial.
% 
%  Output:
%
%    real mcoef(1:n+1): the monomial coefficients of the polynomial.
%
  if ( n < 0 )
    return
  end
%
%  Force lcoef to be a column vector!
%
  lcoef = lcoef(:);
%
%  Get matrix.
%
  A = legendre_to_monomial_matrix ( n + 1 );

  mcoef = A * lcoef;

  return
end
