function value = poly_eval ( c, x )

%*****************************************************************************80
%
%% poly_eval() evaluates a polynomial naively.
%
%  Discussion:
%
%    The power sum form of a polynomial is:
%
%      p(x) = c(0) + c(1) * x + ... + c(n-1) * x^(n-1) + c(n) * x^(n)
%
%    Because MATLAB doesn't allow 0 indexing, we use an adjusted formula:
%
%      p(x) = c(1) + c(2) * x + ... + c(n) * x^(n-1) + c(n+1) * x^(n)
%
%    Because we want to use max() on the result, and for moronic reasons,
%    max returns a scalar value for a row vector but a vector value for
%    a column vector, we reluctantly define our result here as a row vector.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 January 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D: the degree.
%
%    complex C(D+1): the polynomial coefficients.  
%
%    complex X: the evaluation point.
%
%  Output:
%
%    complex VALUE: the polynomial value.
%
  d = length ( c ) - 1;
  n = length ( x );

  value = c(1) * ones ( 1, n );
  xi = ones ( 1, n );
  for i = 1 : d
    xi = xi .* x;
    value = value + c(i+1) * xi;
  end

  return
end
