function mcoef = bernstein_to_monomial ( n, bcoef )

%*****************************************************************************80
%
%% bernstein_to_monomial() converts from Bernstein 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 bcoef(1:n+1): the Bernstein coefficients of the polynomial.
% 
%  Output:
%
%    real mcoef(1:n+1): the monomial coefficients of the polynomial.
%
  if ( n < 0 )
    return
  end
%
%  Force bcoef to be a column vector!
%
  bcoef = bcoef(:);
%
%  Get matrix.
%
  A = bernstein_to_monomial_matrix ( n );

  mcoef = A * bcoef;

  return
end
