function [ n_data, n, m, x, fx ] = pm_polynomial_values ( n_data )

%*****************************************************************************80
%
%% pm_polynomial_values(): selected values of Legendre polynomials Pm(n,m,x).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 March 2012
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz, Irene Stegun,
%    Handbook of Mathematical Functions,
%    National Bureau of Standards, 1964,
%    ISBN: 0-486-61272-4,
%    LC: QA47.A34.
%
%    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.
%
%    integer N, integer M, real X, the arguments of the function.
%
%    real FX, the value of the function.
%
  n_max = 20;

  fx_vec = [ ...
      0.0000000000000000E+00, ...
     -0.5000000000000000E+00, ...
      0.0000000000000000E+00, ...
      0.3750000000000000E+00, ...
      0.0000000000000000E+00, ...
     -0.8660254037844386E+00, ...
     -0.1299038105676658E+01, ...
     -0.3247595264191645E+00, ...
      0.1353164693413185E+01, ...
     -0.2800000000000000E+00, ...
      0.1175755076535925E+01, ...
      0.2880000000000000E+01, ...
     -0.1410906091843111E+02, ...
     -0.3955078125000000E+01, ...
     -0.9997558593750000E+01, ...
      0.8265311444100484E+02, ...
      0.2024442836815152E+02, ...
     -0.4237997531890869E+03, ...
      0.1638320624828339E+04, ...
     -0.2025687389227225E+05  ];

  m_vec = [ ...
    0, 0, 0, 0, ...
    0, 1, 1, 1, ...
    1, 0, 1, 2, ...
    3, 2, 2, 3, ...
    3, 4, 4, 5 ];

  n_vec = [ ...
    1,  2,  3,  4, ...
    5,  1,  2,  3, ...
    4,  3,  3,  3, ...
    3,  4,  5,  6, ...
    7,  8,  9, 10 ];

  x_vec = [ ...
     0.00E+00, ...
     0.00E+00, ...
     0.00E+00, ...
     0.00E+00, ...
     0.00E+00, ...
     0.50E+00, ...
     0.50E+00, ...
     0.50E+00, ...
     0.50E+00, ...
     0.20E+00, ...
     0.20E+00, ...
     0.20E+00, ...
     0.20E+00, ...
     0.25E+00, ...
     0.25E+00, ...
     0.25E+00, ...
     0.25E+00, ...
     0.25E+00, ...
     0.25E+00, ...
     0.25E+00 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

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

  return
end
