function [ n_data, x, c, s ] = dixon_elliptic_values ( n_data )

%*****************************************************************************80
%
%% dixon_elliptic_values() returns some values of the Dixon elliptic functions.
%
%  Discussion:
%
%    In Mathematica, the functions can be evaluated by:
%
%      c = DixonCM [ x ]
%      s = DixonSM [ x ]
%
%    The values should satisfy the condition
%
%      c^3 + s^3 = 1
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 December 2023
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Stephen Wolfram,
%    The Mathematica Book,
%    Fourth Edition,
%    Cambridge University Press, 1999,
%    ISBN: 0-521-64314-7,
%    LC: QA76.95.W65.
%
%  Input:
%
%    integer n_data.  The user sets n_data to 0 before the first 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.
%
%    real C, S: the values of the cm and sm functions.
%
  n_max = 21;

  c_vec = [ ...
 1.000000, ...
 0.999667, ...
 0.997337, ...
 0.991040, ...
 0.978892, ...
 0.959182, ...
 0.930494, ...
 0.891817, ...
 0.842651, ...
 0.783054, ...
 0.713636, ...
 0.635486, ...
 0.550033, ...
 0.458886, ...
 0.363655, ...
 0.265799, ...
 0.166510, ...
 0.0666355, ...
-0.0333615, ...
-0.133414, ...
-0.233857 ];

  s_vec = [ ...
 0.000000, ...
 0.0999833, ...
 0.199734, ...
 0.298657, ...
 0.395785, ...
 0.489826, ...
 0.579255, ...
 0.662445, ...
 0.737828, ...
 0.804069, ...
 0.860228, ...
 0.905873, ...
 0.941134, ...
 0.966693, ...
 0.983705, ...
 0.993701, ...
 0.998459, ...
 0.999901, ...
 1.00001, ...
 1.00079, ...
 1.00425 ];

  x_vec = [ ...
    0.0, ...
    0.1, ...
    0.2, ...
    0.3, ...
    0.4, ...
    0.5, ...
    0.6, ...
    0.7, ...
    0.8, ...
    0.9, ...
    1.0, ...
    1.1, ...
    1.2, ...
    1.3, ...
    1.4, ...
    1.5, ...
    1.6, ...
    1.7, ...
    1.8, ...
    1.9, ...
    2.0 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    x = 0;
    c = 0.0;
    s = 0.0;
  else
    x = x_vec(n_data);
    c = c_vec(n_data);
    s = s_vec(n_data);
  end

  return
end

