function retval = Lnorm(a,b,x)
% usage: y = Lnorm(a,b,x)
% description:  given input of left endpoint a, right
% endpoint b and vector of interpolation nodes x in
% increasing order between a and b, return the approximate
% infinity norm of the Lagrange interpolation operator
% with interpolation points specified by x.
 
x = x(:); % make x a column
n = length(x);
dx = min(abs(diff(x)))/100; % choose a spacing on [a,b]
m  = round((b-a)/dx);
xnodes = linspace(a,b,m); % row of sampling nodes for norm
Lx = ones(n,m);
for j = 1:n
  for k = [1:j-1,j+1:n]
    Lx(j,:) = Lx(j,:).*(xnodes-x(k))/(x(j)-x(k));
  end
end
retval = sum(abs(Lx));
