function yi = chebyshev_value_1d ( nd, c, xmin, xmax, ni, xi )

%*****************************************************************************80
%
%% chebyshev_value_1d() evaluates a Chebyshev interpolant, given its coefficients.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer ND, the number of data points.
%    ND must be at least 1.
%
%    real C(ND,1), the Chebyshev coefficients.
%
%    real XMIN, XMAX, the interpolation interval.
%
%    integer NI, the number of interpolation points.
%
%    real XI(NI,1), the interpolation points, which
%    must be each be in the interval [XMIN,XMAX].
%
%  Output:
%
%    real YI(NI,1), the interpolated values.
%
  if ( nd == 1 )

    yi = c;

  else

    xi = xi(:);

    x = ( 2.0 * xi - xmin - xmax ) / ( xmax - xmin );

    a = cos ( acos ( x ) * ( 0 : nd - 1 ) );

    yi = a * c;

  end

  return
end
