% Written by Min-Hua Huang
% June 9, 2011
% Evaluating the upper limt of the error for EI1(x) in the section 4.3 of 
% "Indefinite Integration of the Gamma Integral".
clear; clc; format long;
fprintf('Estimating the error resulted from the numer of summation terms t.\n\n');
fprintf('The taget of analysis: E1(x), the first-order exponential integral.\n\n');
fprintf('The default setting: x=-0.5, c=10.\n\n');
x=0.5; c=10; n=10^5;
record=ones(1,2);
for p=2:1:5
t=10^p;
sum=0;
for i=0:1:1000000
    d=h(t+1+i,x,n)-h(t+1+i,c,n);
    sum=sum+d;
end    
record(p-1,1)=p;
record(p-1,2)=sum;
fprintf('When t=10^%1i, the error is %5.2e.\n\n',p,sum);
end
