function [e1result,x]=e1(x);
e1result=[];
persistent ae11cs ae12cs ae13cs ae14cs e1 e11cs e12cs eta first firstCall ntae11 ntae12 ntae13 ntae14 nte11 nte12 xmax xmaxt ; if isempty(firstCall),firstCall=1;end;
if isempty(ae11cs), ae11cs=zeros(1,39); end;
if isempty(ae12cs), ae12cs=zeros(1,25); end;
if isempty(ae13cs), ae13cs=zeros(1,25); end;
if isempty(ae14cs), ae14cs=zeros(1,26); end;
if isempty(e1result), e1result=0; end;
if isempty(e11cs), e11cs=zeros(1,19); end;
if isempty(e12cs), e12cs=zeros(1,16); end;
if isempty(eta), eta=0; end;
if isempty(xmax), xmax=0; end;
if isempty(xmaxt), xmaxt=0; end;
if isempty(ntae11), ntae11=0; end;
if isempty(ntae12), ntae12=0; end;
if isempty(ntae13), ntae13=0; end;
if isempty(ntae14), ntae14=0; end;
if isempty(nte11), nte11=0; end;
if isempty(nte12), nte12=0; end;
%***BEGIN PROLOGUE E1
%***PURPOSE Compute the exponential integral E1(X).
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C5
%***TYPE SINGLE PRECISION (E1-S, DE1-D)
%***KEYWORDS E1 FUNCTION, EXPONENTIAL INTEGRAL, FNLIB,
% SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% E1 calculates the single precision exponential integral, E1(X), for
% positive single precision argument X and the Cauchy principal value
% for negative X. If principal values are used everywhere, then, for
% all X,
%
% E1(X) = -Ei(-X)
% or
% Ei(X) = -E1(-X).
%
%
% Series for AE11 on the interval -1.00000D-01 to 0.
% with weighted error 1.76E-17
% log weighted error 16.75
% significant figures required 15.70
% decimal places required 17.55
%
%
% Series for AE12 on the interval -2.50000D-01 to -1.00000D-01
% with weighted error 5.83E-17
% log weighted error 16.23
% significant figures required 15.76
% decimal places required 16.93
%
%
% Series for E11 on the interval -4.00000D+00 to -1.00000D+00
% with weighted error 1.08E-18
% log weighted error 17.97
% significant figures required 19.02
% decimal places required 18.61
%
%
% Series for E12 on the interval -1.00000D+00 to 1.00000D+00
% with weighted error 3.15E-18
% log weighted error 17.50
% approx significant figures required 15.8
% decimal places required 18.10
%
%
% Series for AE13 on the interval 2.50000D-01 to 1.00000D+00
% with weighted error 2.34E-17
% log weighted error 16.63
% significant figures required 16.14
% decimal places required 17.33
%
%
% Series for AE14 on the interval 0. to 2.50000D-01
% with weighted error 5.41E-17
% log weighted error 16.27
% significant figures required 15.38
% decimal places required 16.97
%
%***REFERENCES (NONE)
%***ROUTINES CALLED CSEVL, INITS, R1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 770701 DATE WRITTEN
% 890531 Changed all specific intrinsics to generic. (WRB)
% 891115 Modified prologue description. (WRB)
% 891115 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
% 920618 Removed space from variable names. (RWC, WRB)
%***end PROLOGUE E1
if isempty(first), first=false; end;
if firstCall, ae11cs(1)=[.12150323971606579e0]; end;
if firstCall, ae11cs(2)=[-.065088778513550150e0]; end;
if firstCall, ae11cs(3)=[.004897651357459670e0]; end;
if firstCall, ae11cs(4)=[-.000649237843027216e0]; end;
if firstCall, ae11cs(5)=[.000093840434587471e0]; end;
if firstCall, ae11cs(6)=[.000000420236380882e0]; end;
if firstCall, ae11cs(7)=[-.000008113374735904e0]; end;
if firstCall, ae11cs(8)=[.000002804247688663e0]; end;
if firstCall, ae11cs(9)=[.000000056487164441e0]; end;
if firstCall, ae11cs(10)=[-.000000344809174450e0]; end;
if firstCall, ae11cs(11)=[.000000058209273578e0]; end;
if firstCall, ae11cs(12)=[.000000038711426349e0]; end;
if firstCall, ae11cs(13)=[-.000000012453235014e0]; end;
if firstCall, ae11cs(14)=[-.000000005118504888e0]; end;
if firstCall, ae11cs(15)=[.000000002148771527e0]; end;
if firstCall, ae11cs(16)=[.000000000868459898e0]; end;
if firstCall, ae11cs(17)=[-.000000000343650105e0]; end;
if firstCall, ae11cs(18)=[-.000000000179796603e0]; end;
if firstCall, ae11cs(19)=[.000000000047442060e0]; end;
if firstCall, ae11cs(20)=[.000000000040423282e0]; end;
if firstCall, ae11cs(21)=[-.000000000003543928e0]; end;
if firstCall, ae11cs(22)=[-.000000000008853444e0]; end;
if firstCall, ae11cs(23)=[-.000000000000960151e0]; end;
if firstCall, ae11cs(24)=[.000000000001692921e0]; end;
if firstCall, ae11cs(25)=[.000000000000607990e0]; end;
if firstCall, ae11cs(26)=[-.000000000000224338e0]; end;
if firstCall, ae11cs(27)=[-.000000000000200327e0]; end;
if firstCall, ae11cs(28)=[-.000000000000006246e0]; end;
if firstCall, ae11cs(29)=[.000000000000045571e0]; end;
if firstCall, ae11cs(30)=[.000000000000016383e0]; end;
if firstCall, ae11cs(31)=[-.000000000000005561e0]; end;
if firstCall, ae11cs(32)=[-.000000000000006074e0]; end;
if firstCall, ae11cs(33)=[-.000000000000000862e0]; end;
if firstCall, ae11cs(34)=[.000000000000001223e0]; end;
if firstCall, ae11cs(35)=[.000000000000000716e0]; end;
if firstCall, ae11cs(36)=[-.000000000000000024e0]; end;
if firstCall, ae11cs(37)=[-.000000000000000201e0]; end;
if firstCall, ae11cs(38)=[-.000000000000000082e0]; end;
if firstCall, ae11cs(39)=[.000000000000000017e0]; end;
if firstCall, ae12cs(1)=[.58241749513472674e0]; end;
if firstCall, ae12cs(2)=[-.15834885090578275e0]; end;
if firstCall, ae12cs(3)=[-.006764275590323141e0]; end;
if firstCall, ae12cs(4)=[.005125843950185725e0]; end;
if firstCall, ae12cs(5)=[.000435232492169391e0]; end;
if firstCall, ae12cs(6)=[-.000143613366305483e0]; end;
if firstCall, ae12cs(7)=[-.000041801320556301e0]; end;
if firstCall, ae12cs(8)=[-.000002713395758640e0]; end;
if firstCall, ae12cs(9)=[.000001151381913647e0]; end;
if firstCall, ae12cs(10)=[.000000420650022012e0]; end;
if firstCall, ae12cs(11)=[.000000066581901391e0]; end;
if firstCall, ae12cs(12)=[.000000000662143777e0]; end;
if firstCall, ae12cs(13)=[-.000000002844104870e0]; end;
if firstCall, ae12cs(14)=[-.000000000940724197e0]; end;
if firstCall, ae12cs(15)=[-.000000000177476602e0]; end;
if firstCall, ae12cs(16)=[-.000000000015830222e0]; end;
if firstCall, ae12cs(17)=[.000000000002905732e0]; end;
if firstCall, ae12cs(18)=[.000000000001769356e0]; end;
if firstCall, ae12cs(19)=[.000000000000492735e0]; end;
if firstCall, ae12cs(20)=[.000000000000093709e0]; end;
if firstCall, ae12cs(21)=[.000000000000010707e0]; end;
if firstCall, ae12cs(22)=[-.000000000000000537e0]; end;
if firstCall, ae12cs(23)=[-.000000000000000716e0]; end;
if firstCall, ae12cs(24)=[-.000000000000000244e0]; end;
if firstCall, ae12cs(25)=[-.000000000000000058e0]; end;
if firstCall, e11cs(1)=[-16.113461655571494026e0]; end;
if firstCall, e11cs(2)=[7.7940727787426802769e0]; end;
if firstCall, e11cs(3)=[-1.9554058188631419507e0]; end;
if firstCall, e11cs(4)=[.37337293866277945612e0]; end;
if firstCall, e11cs(5)=[-.05692503191092901938e0]; end;
if firstCall, e11cs(6)=[.00721107776966009185e0]; end;
if firstCall, e11cs(7)=[-.00078104901449841593e0]; end;
if firstCall, e11cs(8)=[.00007388093356262168e0]; end;
if firstCall, e11cs(9)=[-.00000620286187580820e0]; end;
if firstCall, e11cs(10)=[.00000046816002303176e0]; end;
if firstCall, e11cs(11)=[-.00000003209288853329e0]; end;
if firstCall, e11cs(12)=[.00000000201519974874e0]; end;
if firstCall, e11cs(13)=[-.00000000011673686816e0]; end;
if firstCall, e11cs(14)=[.00000000000627627066e0]; end;
if firstCall, e11cs(15)=[-.00000000000031481541e0]; end;
if firstCall, e11cs(16)=[.00000000000001479904e0]; end;
if firstCall, e11cs(17)=[-.00000000000000065457e0]; end;
if firstCall, e11cs(18)=[.00000000000000002733e0]; end;
if firstCall, e11cs(19)=[-.00000000000000000108e0]; end;
if firstCall, e12cs(1)=[-0.037390214792202795e0]; end;
if firstCall, e12cs(2)=[0.042723986062209577e0]; end;
if firstCall, e12cs(3)=[-.1303182079849700544e0]; end;
if firstCall, e12cs(4)=[.01441912402469889073e0]; end;
if firstCall, e12cs(5)=[-.00134617078051068022e0]; end;
if firstCall, e12cs(6)=[.00010731029253063780e0]; end;
if firstCall, e12cs(7)=[-.00000742999951611943e0]; end;
if firstCall, e12cs(8)=[.00000045377325690753e0]; end;
if firstCall, e12cs(9)=[-.00000002476417211390e0]; end;
if firstCall, e12cs(10)=[.00000000122076581374e0]; end;
if firstCall, e12cs(11)=[-.00000000005485141480e0]; end;
if firstCall, e12cs(12)=[.00000000000226362142e0]; end;
if firstCall, e12cs(13)=[-.00000000000008635897e0]; end;
if firstCall, e12cs(14)=[.00000000000000306291e0]; end;
if firstCall, e12cs(15)=[-.00000000000000010148e0]; end;
if firstCall, e12cs(16)=[.00000000000000000315e0]; end;
if firstCall, ae13cs(1)=[-.60577324664060346e0]; end;
if firstCall, ae13cs(2)=[-.11253524348366090e0]; end;
if firstCall, ae13cs(3)=[.013432266247902779e0]; end;
if firstCall, ae13cs(4)=[-.001926845187381145e0]; end;
if firstCall, ae13cs(5)=[.000309118337720603e0]; end;
if firstCall, ae13cs(6)=[-.000053564132129618e0]; end;
if firstCall, ae13cs(7)=[.000009827812880247e0]; end;
if firstCall, ae13cs(8)=[-.000001885368984916e0]; end;
if firstCall, ae13cs(9)=[.000000374943193568e0]; end;
if firstCall, ae13cs(10)=[-.000000076823455870e0]; end;
if firstCall, ae13cs(11)=[.000000016143270567e0]; end;
if firstCall, ae13cs(12)=[-.000000003466802211e0]; end;
if firstCall, ae13cs(13)=[.000000000758754209e0]; end;
if firstCall, ae13cs(14)=[-.000000000168864333e0]; end;
if firstCall, ae13cs(15)=[.000000000038145706e0]; end;
if firstCall, ae13cs(16)=[-.000000000008733026e0]; end;
if firstCall, ae13cs(17)=[.000000000002023672e0]; end;
if firstCall, ae13cs(18)=[-.000000000000474132e0]; end;
if firstCall, ae13cs(19)=[.000000000000112211e0]; end;
if firstCall, ae13cs(20)=[-.000000000000026804e0]; end;
if firstCall, ae13cs(21)=[.000000000000006457e0]; end;
if firstCall, ae13cs(22)=[-.000000000000001568e0]; end;
if firstCall, ae13cs(23)=[.000000000000000383e0]; end;
if firstCall, ae13cs(24)=[-.000000000000000094e0]; end;
if firstCall, ae13cs(25)=[.000000000000000023e0]; end;
if firstCall, ae14cs(1)=[-.1892918000753017e0]; end;
if firstCall, ae14cs(2)=[-.08648117855259871e0]; end;
if firstCall, ae14cs(3)=[.00722410154374659e0]; end;
if firstCall, ae14cs(4)=[-.00080975594575573e0]; end;
if firstCall, ae14cs(5)=[.00010999134432661e0]; end;
if firstCall, ae14cs(6)=[-.00001717332998937e0]; end;
if firstCall, ae14cs(7)=[.00000298562751447e0]; end;
if firstCall, ae14cs(8)=[-.00000056596491457e0]; end;
if firstCall, ae14cs(9)=[.00000011526808397e0]; end;
if firstCall, ae14cs(10)=[-.00000002495030440e0]; end;
if firstCall, ae14cs(11)=[.00000000569232420e0]; end;
if firstCall, ae14cs(12)=[-.00000000135995766e0]; end;
if firstCall, ae14cs(13)=[.00000000033846628e0]; end;
if firstCall, ae14cs(14)=[-.00000000008737853e0]; end;
if firstCall, ae14cs(15)=[.00000000002331588e0]; end;
if firstCall, ae14cs(16)=[-.00000000000641148e0]; end;
if firstCall, ae14cs(17)=[.00000000000181224e0]; end;
if firstCall, ae14cs(18)=[-.00000000000052538e0]; end;
if firstCall, ae14cs(19)=[.00000000000015592e0]; end;
if firstCall, ae14cs(20)=[-.00000000000004729e0]; end;
if firstCall, ae14cs(21)=[.00000000000001463e0]; end;
if firstCall, ae14cs(22)=[-.00000000000000461e0]; end;
if firstCall, ae14cs(23)=[.00000000000000148e0]; end;
if firstCall, ae14cs(24)=[-.00000000000000048e0]; end;
if firstCall, ae14cs(25)=[.00000000000000016e0]; end;
if firstCall, ae14cs(26)=[-.00000000000000005e0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT E1
if( first )
eta = 0.1.*r1mach(3);
[ntae11 ,ae11cs,dumvar3,eta]=inits(ae11cs,39,eta);
[ntae12 ,ae12cs,dumvar3,eta]=inits(ae12cs,25,eta);
[nte11 ,e11cs,dumvar3,eta]=inits(e11cs,19,eta);
[nte12 ,e12cs,dumvar3,eta]=inits(e12cs,16,eta);
[ntae13 ,ae13cs,dumvar3,eta]=inits(ae13cs,25,eta);
[ntae14 ,ae14cs,dumvar3,eta]=inits(ae14cs,26,eta);
%
xmaxt = -log(r1mach(1));
xmax = xmaxt - log(xmaxt);
end;
first = false;
%
if( x<=(-10.) )
%
% E1(X) = -EI(-X) FOR X .LE. -10.
%
e1result = exp(-x)./x.*(1.+csevl(20../x+1.,ae11cs,ntae11));
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x<=(-4.0) ) ;
%
% E1(X) = -EI(-X) FOR -10. .LT. X .LE. -4.
%
e1result = exp(-x)./x.*(1.+csevl((40../x+7.)./3.,ae12cs,ntae12));
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x<=(-1.0) ) ;
%
% E1(X) = -EI(-X) FOR -4. .LT. X .LE. -1.
%
e1result = -log(abs(x)) + csevl((2..*x+5.)./3.,e11cs,nte11);
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x<=1. ) ;
if( x==0. )
xermsg('SLATEC','E1','X IS 0',2,2);
end;
%
% E1(X) = -EI(-X) FOR -1. .LT. X .LE. 1., X .NE. 0.
%
e1result =(-log(abs(x))-0.6875+x) + csevl(x,e12cs,nte12);
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x<=4. ) ;
%
% E1(X) = -EI(-X) FOR 1. .LT. X .LE. 4.
%
e1result = exp(-x)./x.*(1.+csevl((8../x-5.)./3.,ae13cs,ntae13));
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x>xmax ) ;
%
% E1(X) = -EI(-X) FOR X .GT. XMAX
%
xermsg('SLATEC','E1','X SO BIG E1 UNDERFLOWS',1,1);
e1result = 0.;
else;
%
% E1(X) = -EI(-X) FOR 4. .LT. X .LE. XMAX
%
e1result = exp(-x)./x.*(1.+csevl(8../x-1.,ae14cs,ntae14));
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
end;
%
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
end
%DECK EFC