function [lambda_n_fun,points]=leb_function(a,b,n,x,w)
%------------------------------------------------------------------
% This function computes the Lebesgue function of F-H interpolant on [a,b].
%
% INPUTS:
% a,b - endpoints of the interval
% n - number of nodes
% x - vector of nodes
% w - vector of F-H weights
%
%OUTPUTS:
% lambda_n - Lebesgue constant
% points - vector of equidistant points
% lambda_n_fun - vector containing the value of the Lebesgue function at
% points
% 
%-----------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%           
% Version: May 2015		
%  ----------------------------------------------------------------								
N=5000;
points=linspace(a,b,N)';

C=eval_bi(x,w,points);%bi function evaluating at points
D=abs(C);
lambda_n_fun=sum(D,1)';%Lebesgue function evaluating at points