function bcoef = monomial_to_bernstein ( n, mcoef )

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

  return
end
