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

%*****************************************************************************80
%
%% bessel_k0_values() returns some values of the K0 Bessel function.
%
%  Discussion:
%
%    The modified Bessel functions In(Z) and Kn(Z) are solutions of
%    the differential equation
%
%      Z^2 W'' + Z * W' - ( Z^2 + N^2 ) * W = 0.
%
%    The modified Bessel function K0(Z) corresponds to N = 0.
%
%    In Mathematica, the function can be evaluated by:
%
%      BesselK[0,x]
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 August 2004
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz and Irene Stegun,
%    Handbook of Mathematical Functions,
%    US Department of Commerce, 1964.
%
%    Stephen Wolfram,
%    The Mathematica Book,
%    Fourth Edition,
%    Wolfram Media / Cambridge University Press, 1999.
%
%  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.2427069024702017E+01, ... 
     0.1752703855528146E+01, ... 
     0.1114529134524434E+01, ... 
     0.7775220919047293E+00, ... 
     0.5653471052658957E+00, ... 
     0.4210244382407083E+00, ... 
     0.3185082202865936E+00, ... 
     0.2436550611815419E+00, ... 
     0.1879547519693323E+00, ... 
     0.1459314004898280E+00, ... 
     0.1138938727495334E+00, ... 
     0.6234755320036619E-01, ... 
     0.3473950438627925E-01, ... 
     0.1959889717036849E-01, ... 
     0.1115967608585302E-01, ... 
     0.6399857243233975E-02, ... 
     0.3691098334042594E-02, ... 
     0.1243994328013123E-02, ... 
     0.1464707052228154E-03, ... 
     0.1778006231616765E-04 ];

  x_vec = [ ...
      0.1E+00, ... 
      0.2E+00, ... 
      0.4E+00, ... 
      0.6E+00, ... 
      0.8E+00, ... 
      1.0E+00, ... 
      1.2E+00, ... 
      1.4E+00, ... 
      1.6E+00, ... 
      1.8E+00, ... 
      2.0E+00, ... 
      2.5E+00, ... 
      3.0E+00, ... 
      3.5E+00, ... 
      4.0E+00, ... 
      4.5E+00, ... 
      5.0E+00, ... 
      6.0E+00, ... 
      8.0E+00, ... 
     10.0E+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
