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

%*****************************************************************************80
%
%% elliptic_ea_values() returns values of the complete elliptic integral E(A).
%
%  Discussion:
%
%    This is one form of what is sometimes called the complete elliptic 
%    integral of the second kind.
%
%    The function is defined by the formula:
%
%      E(A) = integral ( 0 <= T <= PI/2 ) 
%        sqrt ( 1 - sin^2 ( A ) * sin^2 ( T ) ) dT
%
%    In Mathematica, the function can be evaluated by:
%
%      EllipticE[(Sin[Pi*A/180])^2]
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 September 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, measured
%    in degrees.
%
%    real FX, the value of the function.
%
  n_max = 19;

  fx_vec = [ ...
     1.570796326794897E+00, ...
     1.567809073977622E+00, ...
     1.558887196601596E+00, ...
     1.544150496914673E+00, ...
     1.523799205259774E+00, ...
     1.498114928422116E+00, ...
     1.467462209339427E+00, ...
     1.432290969306756E+00, ...
     1.393140248523812E+00, ...
     1.350643881047676E+00, ...
     1.305539094297794E+00, ...
     1.258679624779997E+00, ...
     1.211056027568459E+00, ...
     1.163827964493139E+00, ...
     1.118377737969864E+00, ...
     1.076405113076403E+00, ...
     1.040114395706010E+00, ...
     1.012663506234396E+00, ...
     1.000000000000000E+00 ];

  x_vec = [ ...
      0.0E+00, ...
      5.0E+00, ... 
     10.0E+00, ...
     15.0E+00, ...
     20.0E+00, ...
     25.0E+00, ...
     30.0E+00, ...
     35.0E+00, ...
     40.0E+00, ...
     45.0E+00, ...
     50.0E+00, ...
     55.0E+00, ...
     60.0E+00, ...
     65.0E+00, ...
     70.0E+00, ...
     75.0E+00, ...
     80.0E+00, ...
     85.0E+00, ...
     90.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
