function asa032_test01 ( )

%*****************************************************************************80
%
%% asa032_test01() tests gamain().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 January 2008
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'asa032_test01():\n' );
  fprintf ( 1, '  gamain() computes the incomplete Gamma function.\n' );
  fprintf ( 1, '  Compare the result to tabulated values.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '      A             X             ' );
  fprintf ( 1, 'FX                        FX2\n' );
  fprintf ( 1, '                                 ' );
  fprintf ( 1, '(Tabulated)               (GAMAIN)                 DIFF\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( true )

    [ n_data, a, x, fx ] = gamma_inc_p_values ( n_data );

    if ( n_data == 0 )
      break
    end

    [ fx2, ifault ] = gamain ( x, a );

    fprintf ( 1, '  %12.8f  %12.8f  %24.16e  %24.16e  %10.4e\n', ...
    a, x, fx, fx2, abs ( fx - fx2 ) );

  end

  return
end
