function [ n_data, x, fx ] = airy_hi_values ( n_data )

%*****************************************************************************80
%
%% airy_hi_values() returns some values of the Airy Hi function.
%
%  Discussion:
%
%    The function is defined by:
%
%      AIRY_HI(x) = Integral ( 0 <= t < infinity ) exp(x*t-t^3/3) dt / pi
%
%    The data was reported by McLeod.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 September 2004
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz and Irene Stegun,
%    Handbook of Mathematical Functions,
%    US Department of Commerce, 1964.
%
%    Allan McLeod,
%    Algorithm 757, MISCFUN: A software package to compute uncommon
%      special functions,
%    ACM Transactions on Mathematical Software,
%    Volume 22, Number 3, September 1996, pages 288-301.
%
%  Input:
%
%    integer N_DATA.  The user sets N_DATA to 0 before the first call.  
%    Thereafter, it should simply be the value returned by the previous call.
%
%  Output:
%
%    integer N_DATA.  On each call, the routine increments N_DATA by 1, and
%    returns the corresponding data; when there is no more data, the
%    output value of N_DATA will be 0 again.
%
%    real X, the argument of the function.
%
%    real FX, the value of the function.
%
  n_max = 20;

  fx_vec = [ ...
     0.40936798278458884024E+00, ...
     0.37495291608048868619E+00, ...
     0.22066960679295989454E+00, ...
     0.77565356679703713590E-01, ...
     0.39638826473124717315E-01, ...
     0.38450072575004151871E-01, ...
     0.35273216868317898556E-01, ...
     0.31768535282502272742E-01, ...
     0.28894408288051391369E-01, ...
     0.24463284011678541180E-01, ...
     0.41053540139998941517E+00, ...
     0.44993502381204990817E+00, ...
     0.97220515514243332184E+00, ...
     0.83764237105104371193E+02, ...
     0.80327744952044756016E+05, ...
     0.15514138847749108298E+06, ...
     0.11995859641733262114E+07, ...
     0.21472868855967642259E+08, ...
     0.45564115351632913590E+09, ...
     0.32980722582904761929E+12 ];

  x_vec = [ ...
      -0.0019531250E+00, ...
      -0.1250000000E+00, ...
      -1.0000000000E+00, ...
      -4.0000000000E+00, ...
      -8.0000000000E+00, ...
      -8.2500000000E+00, ...
      -9.0000000000E+00, ...
     -10.0000000000E+00, ...
     -11.0000000000E+00, ...
     -13.0000000000E+00, ...
       0.0019531250E+00, ...
       0.1250000000E+00, ...
       1.0000000000E+00, ...
       4.0000000000E+00, ...
       7.0000000000E+00, ...
       7.2500000000E+00, ...
       8.0000000000E+00, ...
       9.0000000000E+00, ...
      10.0000000000E+00, ...
      12.0000000000E+00 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    x = 0.0;
    fx = 0.0;
  else
    x = x_vec(n_data);
    fx = fx_vec(n_data);
  end

  return
end
