function bcoef = legendre01_to_bernstein ( n, lcoef )

%*****************************************************************************80
%
%% legendre01_to_bernstein() converts from Legendre01 to Bernstein form.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 February 2024
%
%  Author:
%
%    John Burkardt.
%
%  Input:
%
%    integer n: the order of the polynomial.
%
%    real lcoef(1:n+1): the Legendre01 coefficients of the polynomial.
% 
%  Output:
%
%    real bcoef(1:n+1): the Bernstein coefficients of the polynomial.
%
  if ( n < 0 )
    return;
  end
%
%  Guarantee a column vector!.
%
  lcoef = lcoef(:);
%
%  Get the matrix.
%
  A = legendre01_to_bernstein_matrix ( n );
%
%  Apply the transformation.
%
  bcoef = A * lcoef;

  return
end
