function p_polynomial_zeros_test ( )

%*****************************************************************************80
%
%% p_polynomial_zeros_test() tests p_polynomial_zeros().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 November 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'p_polynomial_zeros_test:\n' );
  fprintf ( 1, '  p_polynomial_zeros() computes the zeros of P(n,x)\n' );
  fprintf ( 1, '  Check by calling p_polynomial_value() there.\n' );

  for d = 1 : 5

    z1 = p_polynomial_zeros ( d );
    title = sprintf ( '  P(%d,x) zeros from p_polynomial_zeros()', d );
    r8vec_print ( d, z1, title );
%
%  Compare to MATLAB's roots() function.
%
    coef = p_polynomial_coefficients ( d );
    c = coef(d+1,:);
    z2 = roots ( c(end:-1:1) );
    z2 = sort ( z2 );
    title = sprintf ( '  P(%d,x) zeros from MATLAB roots()', d );
    r8vec_print ( d, z2, title );
%
%  Evaluate polynomial at zeros.
%
    lz = p_polynomial_value ( d, d, z1 );
    title = sprintf ( '  Evaluate P(%d,z)', d );
    r8vec_print ( d, lz(1:d,d+1), title );

  end

  return
end
