function x = r8vec_cheby_extreme ( n, a, b )

%*****************************************************************************80
%
%% r8vec_cheby_extreme() returns the Chebyshev Extreme nodes for [A,B];
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 March 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of entries in the vector.
%
%    real A, B, the first and last entries.
%
%  Output:
%
%    real X(N), a vector of Chebyshev Extreme nodes.
%
  x = zeros ( n, 1 );

  if ( n == 1 )
    x(1,1) = ( a + b ) / 2.0;
  else
    x(1:n,1) = 0.5 * ( a + b + ( b - a ) ...
      * cos ( pi * ( n - (1:n)' ) / ( n - 1 ) ) );
  end

  return
end
