function lcoef = bernstein_to_legendre01 ( n, bcoef )

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

  lcoef = A * bcoef;

  return
end
