function c = gram_polynomial_coefficients ( n, m )

%*****************************************************************************80
%
%% gram_polynomial_coefficients returns Gram polynomial coefficients.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 June 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Germund Dahlquist, Ake Bjorck,
%    Numerical Methods in Scientific Computing,
%    Volume 1,
%    SIAM, 2008,
%    ISBN: 978-0-898716-44-3,
%    LC: QA297.D335 2008.
%    
%  Input:
%
%    integer n, the index of the polynomial.
%    n < m.
%
%    integer m, the number of points used in defining the polynomial.
%
%  Output:
%
%    real c(n+1), the coefficients of the polynomial. starting with constant.
%
  a = zeros ( n + 1, 1 );
  b = zeros ( n + 1, 1 );
  c = zeros ( n + 1, 1 );

  for step = 0 : n
    if ( step == 0 )
      c(1) = 1.0;
    else
      a = b;
      b = c;
      c(1:step) = - gram_beta ( step - 1, m ) * a(1:step);
      c(2:step+1) = c(2:step+1) + b(1:step);
    end
  end 

  return
end

