function c2 = poly_square ( c1 )

%*****************************************************************************80
%
%% poly_square returns the coefficients of the square of a polynomial.
%
%  Input:
%
%    real c1(d1+1): the coefficients of the polynomial.
%
%  Output:
%
%    real c2(d2+1): the coefficients of the square of the polynomial.
%
  d1 = length ( c1 ) - 1;
  d2 = 2 * d1;
  c2(1:d2+1) = 0.0;
  
  for i = 0 : d1
    for j = 0 : d1
      c2(i+j+1) = c2(i+j+1) + c1(i+1) * c1(j+1);
    end
  end
  
  return
end   
