del_0 = avg;
e = zeros(1,length(lambda));

for j = 1:length(lambda)
    e(j) = del(j)/(lambda(j)-del_0);
end

hold on;
plot(lambda,e,'r.');

% finding the signs of the roots. 
% We extrapolate from only one half of the parabola as to avoid
% the gash in the parabola from the numerical division
if(del_0>0)
   initial = 1;
   final = floor(1/2*length(lambda));
else
   initial = floor(1/2*length(lambda));
   final = length(lambda);
end

coeff = polyfit(lambda(initial:final),e(initial:final),2)
lambda_0 = -coeff(2)/(2*coeff(1))
discr = sqrt(coeff(2)^2 - 4*coeff(1)*coeff(3))/(2*coeff(1))