function filon_test01 ( )

%*****************************************************************************80
%
%% filon_test01 tests filon_tab_cos().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 May 2014
%
%  Author:
%
%    John Burkardt
%
  a = 0.0;
  b = 2.0 * pi;
  n = 11;
%
%  Set the X values.
%
  x = linspace ( a, b, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'FILON_TEST01\n' );
  fprintf ( 1, '  FILON_TAB_COS estimates the integral of.\n' );
  fprintf ( 1, '  F(X) * COS ( T * X )\n' );
  fprintf ( 1, '  Use integrands F(X)=1, X, X^2.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  A = %g\n', a );
  fprintf ( 1, '  B = %g\n', b );
  fprintf ( 1, '  N = %d\n', n );
  fprintf ( 1, '\n' );
  fprintf ( 1, '       T        Approximate             Exact\n' );

  for k = 1 : 3

    if ( k == 1 )
      t = 1.0;
    elseif ( k == 2 )
      t = 2.0;
    elseif ( k == 3 )
      t = 10.0;
    end

    fprintf ( 1, '\n' );

    for i = 1 : 3

      if ( i == 1 )
        ftab = zero_integrand ( n, x );
      elseif ( i == 2 )
        ftab = one_integrand ( n, x );
      elseif ( i == 3 )
        ftab = two_integrand ( n, x );
      end

      result = filon_tab_cos ( n, ftab, a, b, t );

      if ( i == 1 )
        exact = ( sin ( t * b ) - sin ( t * a ) ) / t;
      elseif ( i == 2 )
        exact = ( ( cos ( t * b ) + t * b * sin ( t * b ) ) ...
                - ( cos ( t * a ) + t * a * sin ( t * a ) ) ) / t^2;
      elseif ( i == 3 )
        exact = ( ( 2.0 * t * b * cos ( t * b ) ...
              + ( t * t * b^2 - 2.0 ) * sin ( t * b ) ) ...
                - ( 2.0 * t * a * cos ( t * a ) ...
              + ( t * t * a^2 - 2.0 ) * sin ( t * a ) ) ) / t^3;
      end

      fprintf ( 1, '  %10.4g  %24.16g  %24.16g\n',  t, result, exact );

    end

  end

  return
end
