function p = laguer(a, x)

%  The function p = laguer(a,x) evaluates a Laguerre polynomial
%  expansion with coefficients a at the values x, by using Clenshaw's
%  algorithm.   The vector x could be a scalar or vector, and the
%  coefficients in the vector a are ordered in increasing order of
%  the index.  

N = length(a)-1;

unp1  =  zeros(size(x));
un    =  a(N+1)*ones(size(x));

for n =  N:-1:1
unm1  =  (1/n)*(2*n-1-x).*un-n/(n+1)*unp1+a(n);
unp1  =  un;  un  =  unm1;
end

p = unm1;




