function [px] = horner2(a,x)
%
% Evaluation of the polynomial
%              p(x) = a_1 x^n + ... + a_{n+1}
%   by the Horner method
%
%    p(x)=a_{n+1}+x*(a_n+x*(a_{n-1} +x*(.....+x*a_1)))
%
% Input parameters:
%   a     array holding the coefficients of the polynomial
%         (a(1) is the coefficient of the term o degree p)
%   x     array of nodes at which  the polynomial is evaluated
%
% Output parameters:
%   px    array of values p(x)
%
% function [px] = horner2(a,x)
%
n=length(a)-1;
px=a(1);
for j=2:n+1
px=a(j)+px.*x;
end
