function x = chebyshev_grid ( n )

%*****************************************************************************80
%
%% chebyshev_grid() computes the Chebyshev grid.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 March 2024
%
%  Author:
%
%    Original MATLAB version by Lloyd Trefethen.
%    This version by John Burkardt.
%
%  Reference:
%
%    Lloyd Trefethen,
%    Spectral methods in MATLAB,
%    SIAM, 2000,
%    LC: QA377.T65
%    ISBN: 978-0-898714-65-4
%
%  Input:
%
%    integer n: the order of the grid.
%
%  Output:
%
%    real x(n+1): the Chebyshev grid.
%
  if ( n == 0 )
    x = 1.0; 
  else
    x = cos ( pi * (0:n) / n )'; 
  end

  return
end
