function trig_discrete_interp_project_test ( )

%*****************************************************************************80
%
%% trig_discrete_interp_project projects data onto a trigonometric basis.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 July 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer n, the number of data values.
%
%    real y(2*n+1), the data values at 2*n+1 equally spaced ???
%
%  Output:
%
%    real a0, the constant coefficient.
%
%    real a(n), the cosine coefficients.
%
%    real b(n), the sine coefficients.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'trig_discrete_interp_project_test\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  N  max interp error\n' );
  fprintf ( 1, '\n' );

  n = 2;
% for n = 1 : 5
    nt = 2 * n + 1;
    t = ( -n : n ) * 2.0 * pi / ( 2.0 * n + 1 );
%   yt = exp ( sin ( t ) );
    yt = 1.0 - 2.0 * cos(t) + 3.0 * cos(2*t) + 4.0*sin(t)-5.0*sin(2*t); 
    [ a0, a, b ] = trig_discrete_interp_project ( n, yt )
    gt = trig_discrete_interp_value ( n, a0, a, b, nt, t );
    size ( t )
    size ( gt )
    size ( yt )
    for i = 1 : nt
      fprintf ( 1, '  %2d  %8.4f  %14.6g  %14.6g\n', i, t(i), gt(i), yt(i) );
    end
    e = max ( abs ( yt - gt ) );
    fprintf ( 1, '  %2d  %g14.6\n', n, e );
% end

  return
end

