function chebyshev_test01 ( )

%*****************************************************************************80
%
%% chebyshev_test01() tests chebyshev_coefficients() and chebyshev_interpolant().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 September 2011
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'chebyshev_test01():\n' );
  fprintf ( 1, '  chebyshev_coefficients() computes the coefficients of the\n' );
  fprintf ( 1, '  Chebyshev interpolant.\n' );
  fprintf ( 1, '  chebyshev_interpolant() evaluates the interpolant.\n' );

  n = 5;
  a = -1.0;
  b = +1.0;

  c = chebyshev_coefficients ( a, b, n, @f1 );

  x = chebyshev_zeros ( n );
  x = 0.5 * ( a + b ) + x * 0.5 * ( b - a );

  fx = f1 ( x );
  m = n;
  fc = chebyshev_interpolant ( a, b, n, c, m, x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  F(X) is a trig function:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '      X           C(I)        F(X)       C(F)(X)\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %10f  %10f  %10f  %10f\n', x(i), c(i), fx(i), fc(i) );
  end

  return
end
