function pn_polynomial_value_test ( )

%*****************************************************************************80
%
%% PN_POLYNOMIAL_VALUE_TEST tests PN_POLYNOMIAL_VALUE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    17 March 2012
%
%  Author:
%
%    John Burkardt
%
  m = 1;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'PN_POLYNOMIAL_VALUE_TEST:\n' );
  fprintf ( 1, '  PN_POLYNOMIAL_VALUE evaluates the normalized Legendre polynomial Pn(n,x).\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '                        Tabulated                 Computed\n' );
  fprintf ( 1, '     N        X          Pn(N,X)                   Pn(N,X)                     Error\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( 1 )

    [ n_data, n, x, fx1 ] = pn_polynomial_values ( n_data );

    if ( n_data == 0 )
      break
    end

    v = pn_polynomial_value ( m, n, x );
    fx2 = v(1,n+1);

    e = fx1 - fx2;

    fprintf ( 1, '  %4d  %12f  %24.16g  %24.16g  %8g\n', n, x, fx1, fx2, e );

  end

  return
end
