function value = r8poly_pval ( n, a, x )

%*****************************************************************************80
%
%% r8poly_pval() evaluates a real polynomial in power sum form.
%
%  Discussion:
%
%    The power sum form is:
%
%      p(x) = a(0) + a(1) * x + ... + a(n-1) * x^(n-1) + a(n) * x^(n)
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    11 July 2004
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the dimension of A.
%
%    real A(1:N+1), the coefficients of the polynomial.
%    A(1) is the constant term.
%
%    real X, the point at which the polynomial is to be evaluated.
%
%  Output:
%
%    real VALUE, the value of the polynomial at X.
%
  value = 0.0;
  for i = n : -1 : 0
    value = value * x + a(i+1);
  end

  return
end
