function chebyshev_polynomial_test10 ( )

%*****************************************************************************80
%
%% chebyshev_polynomial_test10() compares a function and projection over [A,B].
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 April 2012
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'chebyshev_polynomial_test10():\n' );
  fprintf ( 1, '  t_project_coefficients_ab() computes the Chebyshev interpolant C(F)(N,X)\n' );
  fprintf ( 1, '  of a function F(X) defined over [A,B].\n' );
  fprintf ( 1, '  t_project_value_ab() evaluates that projection.\n' );

  a = 0.0;
  b = 1.5;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Compute projections of order N to exp(x) over [%f, %f],\n', a, b );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   N   Max|F(X)-C(F)(N,X)|\n' );
  fprintf ( 1, '\n' );
  for n = 0 : 10
    c = t_project_coefficients_ab ( n, @exp, a, b );
    m = 101;
    x = ( linspace ( a, b, m ) )';
    v = t_project_value_ab ( m, n, x, c, a, b );
    r = v - exp ( x );
    fprintf ( 1, '  %2d  %12.4g\n', n, max ( abs ( r ) ) );
  end

  return
end
