function hypergeom_test ( )

%*****************************************************************************80
%
%% hypergeom_test() tests hypergeom().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 July 2022
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hypergeom_test():\n' );
  fprintf ( 1, '  hypergeom() evaluates the generalized\n' );
  fprintf ( 1, '  hypergeometric function pFq(z).\n' );

  hypergeom_test01 ( );
  hypergeom_test02 ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hypergeom_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end
function hypergeom_test01 ( )

%*****************************************************************************80
%
%% hypergeom_test01() tests hypergeom().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 July 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hypergeom_test01():\n' );
  fprintf ( 1, '  Test hypergeom() on the example in the documentation.\n' );

  a = zeros ( 2, 1 );
  b = zeros ( 3, 1 );
  
  a(1) = complex ( 1.0,  1.0 );
  a(2) = complex ( 1.0,  0.0 );
  b(1) = complex ( 2.0, -1.0 );
  b(2) = complex ( 3.0,  0.0 );
  b(3) = complex ( 3.0,  0.0 );

  z = 1.5;

  value = hypergeom ( a, b, z );

  exact = complex ( 1.02992154295955, 0.106416425916656 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Computed value: %14.10g\n', value );
  fprintf ( 1, '  Exact value:    %14.10g\n', exact );

  return
end
function hypergeom_test02 ( )

%*****************************************************************************80
%
%% hypergeom_test02() tests hypergeom().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 July 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hypergeom_test02():\n' );
  fprintf ( 1, '  Test hypergeom() on a sequence pFq(z) with q=p+1.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   n   p   q     z                pFq(z)\n' ); 

  for n = 1 : 5

    z = - ( n * pi / 2.0 ) ^ 2;
    fprintf ( 1, '\n' );

    for ip = 2 : 9

      iq = ip + 1;
      a = zeros ( ip, 1 );
      b = zeros ( iq, 1 );

      a(1:ip) = 1.25;
      b(1) = 0.5;
      b(2:iq) = 2.25;

      value = hypergeom ( a, b, z );

      fprintf ( 1, '\n' ); 
      fprintf ( 1, '  %2d  %2d  %2d  %14.6g  %14.6g', n, ip, iq, z, value );

    end

  end

  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

