function approx_chebyshev_test ( )

%*****************************************************************************80
%
%% approx_chebyshev_test() tests approx_chebyshev().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 November 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../approx_chebyshev' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'approx_chebyshev_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test approx_chebyshev().\n' );

  a = 0.0;
  b = 2.0;

  m = 101;
  xp = linspace ( a, b, m );
  xp = xp';
  fp = humps_fun ( xp );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  N  Maxerr\n' );
  fprintf ( 1, '\n' );
  for n = 1 : 20
    [ xp, yp, maxerr ] = approx_chebyshev ( 'humps_fun(x)', a, b, n );
    fprintf ( '  %2d  %14.6g\n', n, maxerr );
  end

  for n = 1 : 20
    [ xp, yp, maxerr ] = approx_chebyshev ( 'humps_fun(x)', a, b, n );
    clf ( );
    hold ( 'on' );
    plot ( xp, fp, 'b-', 'linewidth', 3 );
    plot ( xp, yp, 'r-', 'linewidth', 3 );
    label = sprintf ( 'Degree %d Chebyshev Approximation', n );
    title ( label, 'fontsize', 16 );
    grid ( 'on' );
    hold ( 'off' )
    pause ( 4.0 )
  end

  filename = 'humps_chebyshev.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'approx_chebyshev_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../approx_chebyshev' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

