1      FUNCTION E1(X)
2C***BEGIN PROLOGUE  E1
3C***DATE WRITTEN   770701   (YYMMDD)
4C***REVISION DATE  820801   (YYMMDD)
5C***CATEGORY NO.  C5
6C***KEYWORDS  E1,EXPONENTIAL INTEGRAL,SPECIAL FUNCTION
7C***AUTHOR  FULLERTON, W., (LANL)
8C***PURPOSE  Computes the exponential integral E1(X).
9C***DESCRIPTION
10C
11C E1(X) calculates the single precision exponential integral
12C for positive, single precision argument X.  It returns the
13C Cauchy principal value for negative X.  If principal values are
14C used everywhere, then for all X
15C
16C     EI(X) = -E1(-X)
17C or
18C     E1(X) = -EI(-X).
19C
20C
21C Series for AE11       on the interval -1.00000D-01 to  0.
22C                                        with weighted error   1.76E-17
23C                                         log weighted error  16.75
24C                               significant figures required  15.70
25C                                    decimal places required  17.55
26C
27C
28C Series for AE12       on the interval -2.50000D-01 to -1.00000D-01
29C                                        with weighted error   5.83E-17
30C                                         log weighted error  16.23
31C                               significant figures required  15.76
32C                                    decimal places required  16.93
33C
34C
35C Series for E11        on the interval -4.00000D+00 to -1.00000D+00
36C                                        with weighted error   1.08E-18
37C                                         log weighted error  17.97
38C                               significant figures required  19.02
39C                                    decimal places required  18.61
40C
41C
42C Series for E12        on the interval -1.00000D+00 to  1.00000D+00
43C                                        with weighted error   3.15E-18
44C                                         log weighted error  17.50
45C                        approx significant figures required  15.8
46C                                    decimal places required  18.10
47C
48C
49C Series for AE13       on the interval  2.50000D-01 to  1.00000D+00
50C                                        with weighted error   2.34E-17
51C                                         log weighted error  16.63
52C                               significant figures required  16.14
53C                                    decimal places required  17.33
54C
55C
56C Series for AE14       on the interval  0.          to  2.50000D-01
57C                                        with weighted error   5.41E-17
58C                                         log weighted error  16.27
59C                               significant figures required  15.38
60C                                    decimal places required  16.97
61C***REFERENCES  (NONE)
62C***ROUTINES CALLED  CSEVL,INITS,R1MACH,XERROR
63C***END PROLOGUE  E1
64      DIMENSION AE11CS(39), AE12CS(25), E11CS(19), E12CS(16),
65     1  AE13CS(25), AE14CS(26)
66      DATA AE11CS( 1) /    .1215032397 1606579E0 /
67      DATA AE11CS( 2) /   -.0650887785 13550150E0 /
68      DATA AE11CS( 3) /    .0048976513 57459670E0 /
69      DATA AE11CS( 4) /   -.0006492378 43027216E0 /
70      DATA AE11CS( 5) /    .0000938404 34587471E0 /
71      DATA AE11CS( 6) /    .0000004202 36380882E0 /
72      DATA AE11CS( 7) /   -.0000081133 74735904E0 /
73      DATA AE11CS( 8) /    .0000028042 47688663E0 /
74      DATA AE11CS( 9) /    .0000000564 87164441E0 /
75      DATA AE11CS(10) /   -.0000003448 09174450E0 /
76      DATA AE11CS(11) /    .0000000582 09273578E0 /
77      DATA AE11CS(12) /    .0000000387 11426349E0 /
78      DATA AE11CS(13) /   -.0000000124 53235014E0 /
79      DATA AE11CS(14) /   -.0000000051 18504888E0 /
80      DATA AE11CS(15) /    .0000000021 48771527E0 /
81      DATA AE11CS(16) /    .0000000008 68459898E0 /
82      DATA AE11CS(17) /   -.0000000003 43650105E0 /
83      DATA AE11CS(18) /   -.0000000001 79796603E0 /
84      DATA AE11CS(19) /    .0000000000 47442060E0 /
85      DATA AE11CS(20) /    .0000000000 40423282E0 /
86      DATA AE11CS(21) /   -.0000000000 03543928E0 /
87      DATA AE11CS(22) /   -.0000000000 08853444E0 /
88      DATA AE11CS(23) /   -.0000000000 00960151E0 /
89      DATA AE11CS(24) /    .0000000000 01692921E0 /
90      DATA AE11CS(25) /    .0000000000 00607990E0 /
91      DATA AE11CS(26) /   -.0000000000 00224338E0 /
92      DATA AE11CS(27) /   -.0000000000 00200327E0 /
93      DATA AE11CS(28) /   -.0000000000 00006246E0 /
94      DATA AE11CS(29) /    .0000000000 00045571E0 /
95      DATA AE11CS(30) /    .0000000000 00016383E0 /
96      DATA AE11CS(31) /   -.0000000000 00005561E0 /
97      DATA AE11CS(32) /   -.0000000000 00006074E0 /
98      DATA AE11CS(33) /   -.0000000000 00000862E0 /
99      DATA AE11CS(34) /    .0000000000 00001223E0 /
100      DATA AE11CS(35) /    .0000000000 00000716E0 /
101      DATA AE11CS(36) /   -.0000000000 00000024E0 /
102      DATA AE11CS(37) /   -.0000000000 00000201E0 /
103      DATA AE11CS(38) /   -.0000000000 00000082E0 /
104      DATA AE11CS(39) /    .0000000000 00000017E0 /
105      DATA AE12CS( 1) /    .5824174951 3472674E0 /
106      DATA AE12CS( 2) /   -.1583488509 0578275E0 /
107      DATA AE12CS( 3) /   -.0067642755 90323141E0 /
108      DATA AE12CS( 4) /    .0051258439 50185725E0 /
109      DATA AE12CS( 5) /    .0004352324 92169391E0 /
110      DATA AE12CS( 6) /   -.0001436133 66305483E0 /
111      DATA AE12CS( 7) /   -.0000418013 20556301E0 /
112      DATA AE12CS( 8) /   -.0000027133 95758640E0 /
113      DATA AE12CS( 9) /    .0000011513 81913647E0 /
114      DATA AE12CS(10) /    .0000004206 50022012E0 /
115      DATA AE12CS(11) /    .0000000665 81901391E0 /
116      DATA AE12CS(12) /    .0000000006 62143777E0 /
117      DATA AE12CS(13) /   -.0000000028 44104870E0 /
118      DATA AE12CS(14) /   -.0000000009 40724197E0 /
119      DATA AE12CS(15) /   -.0000000001 77476602E0 /
120      DATA AE12CS(16) /   -.0000000000 15830222E0 /
121      DATA AE12CS(17) /    .0000000000 02905732E0 /
122      DATA AE12CS(18) /    .0000000000 01769356E0 /
123      DATA AE12CS(19) /    .0000000000 00492735E0 /
124      DATA AE12CS(20) /    .0000000000 00093709E0 /
125      DATA AE12CS(21) /    .0000000000 00010707E0 /
126      DATA AE12CS(22) /   -.0000000000 00000537E0 /
127      DATA AE12CS(23) /   -.0000000000 00000716E0 /
128      DATA AE12CS(24) /   -.0000000000 00000244E0 /
129      DATA AE12CS(25) /   -.0000000000 00000058E0 /
130      DATA E11 CS( 1) / -16.1134616555 71494026E0 /
131      DATA E11 CS( 2) /   7.7940727787 426802769E0 /
132      DATA E11 CS( 3) /  -1.9554058188 631419507E0 /
133      DATA E11 CS( 4) /    .3733729386 6277945612E0 /
134      DATA E11 CS( 5) /   -.0569250319 1092901938E0 /
135      DATA E11 CS( 6) /    .0072110777 6966009185E0 /
136      DATA E11 CS( 7) /   -.0007810490 1449841593E0 /
137      DATA E11 CS( 8) /    .0000738809 3356262168E0 /
138      DATA E11 CS( 9) /   -.0000062028 6187580820E0 /
139      DATA E11 CS(10) /    .0000004681 6002303176E0 /
140      DATA E11 CS(11) /   -.0000000320 9288853329E0 /
141      DATA E11 CS(12) /    .0000000020 1519974874E0 /
142      DATA E11 CS(13) /   -.0000000001 1673686816E0 /
143      DATA E11 CS(14) /    .0000000000 0627627066E0 /
144      DATA E11 CS(15) /   -.0000000000 0031481541E0 /
145      DATA E11 CS(16) /    .0000000000 0001479904E0 /
146      DATA E11 CS(17) /   -.0000000000 0000065457E0 /
147      DATA E11 CS(18) /    .0000000000 0000002733E0 /
148      DATA E11 CS(19) /   -.0000000000 0000000108E0 /
149      DATA E12 CS( 1) /  -0.0373902147 92202795E0 /
150      DATA E12 CS( 2) /   0.0427239860 62209577E0 /
151      DATA E12 CS( 3) /   -.1303182079 849700544E0 /
152      DATA E12 CS( 4) /    .0144191240 2469889073E0 /
153      DATA E12 CS( 5) /   -.0013461707 8051068022E0 /
154      DATA E12 CS( 6) /    .0001073102 9253063780E0 /
155      DATA E12 CS( 7) /   -.0000074299 9951611943E0 /
156      DATA E12 CS( 8) /    .0000004537 7325690753E0 /
157      DATA E12 CS( 9) /   -.0000000247 6417211390E0 /
158      DATA E12 CS(10) /    .0000000012 2076581374E0 /
159      DATA E12 CS(11) /   -.0000000000 5485141480E0 /
160      DATA E12 CS(12) /    .0000000000 0226362142E0 /
161      DATA E12 CS(13) /   -.0000000000 0008635897E0 /
162      DATA E12 CS(14) /    .0000000000 0000306291E0 /
163      DATA E12 CS(15) /   -.0000000000 0000010148E0 /
164      DATA E12 CS(16) /    .0000000000 0000000315E0 /
165      DATA AE13CS( 1) /   -.6057732466 4060346E0 /
166      DATA AE13CS( 2) /   -.1125352434 8366090E0 /
167      DATA AE13CS( 3) /    .0134322662 47902779E0 /
168      DATA AE13CS( 4) /   -.0019268451 87381145E0 /
169      DATA AE13CS( 5) /    .0003091183 37720603E0 /
170      DATA AE13CS( 6) /   -.0000535641 32129618E0 /
171      DATA AE13CS( 7) /    .0000098278 12880247E0 /
172      DATA AE13CS( 8) /   -.0000018853 68984916E0 /
173      DATA AE13CS( 9) /    .0000003749 43193568E0 /
174      DATA AE13CS(10) /   -.0000000768 23455870E0 /
175      DATA AE13CS(11) /    .0000000161 43270567E0 /
176      DATA AE13CS(12) /   -.0000000034 66802211E0 /
177      DATA AE13CS(13) /    .0000000007 58754209E0 /
178      DATA AE13CS(14) /   -.0000000001 68864333E0 /
179      DATA AE13CS(15) /    .0000000000 38145706E0 /
180      DATA AE13CS(16) /   -.0000000000 08733026E0 /
181      DATA AE13CS(17) /    .0000000000 02023672E0 /
182      DATA AE13CS(18) /   -.0000000000 00474132E0 /
183      DATA AE13CS(19) /    .0000000000 00112211E0 /
184      DATA AE13CS(20) /   -.0000000000 00026804E0 /
185      DATA AE13CS(21) /    .0000000000 00006457E0 /
186      DATA AE13CS(22) /   -.0000000000 00001568E0 /
187      DATA AE13CS(23) /    .0000000000 00000383E0 /
188      DATA AE13CS(24) /   -.0000000000 00000094E0 /
189      DATA AE13CS(25) /    .0000000000 00000023E0 /
190      DATA AE14CS( 1) /   -.1892918000 753017E0 /
191      DATA AE14CS( 2) /   -.0864811785 5259871E0 /
192      DATA AE14CS( 3) /    .0072241015 4374659E0 /
193      DATA AE14CS( 4) /   -.0008097559 4575573E0 /
194      DATA AE14CS( 5) /    .0001099913 4432661E0 /
195      DATA AE14CS( 6) /   -.0000171733 2998937E0 /
196      DATA AE14CS( 7) /    .0000029856 2751447E0 /
197      DATA AE14CS( 8) /   -.0000005659 6491457E0 /
198      DATA AE14CS( 9) /    .0000001152 6808397E0 /
199      DATA AE14CS(10) /   -.0000000249 5030440E0 /
200      DATA AE14CS(11) /    .0000000056 9232420E0 /
201      DATA AE14CS(12) /   -.0000000013 5995766E0 /
202      DATA AE14CS(13) /    .0000000003 3846628E0 /
203      DATA AE14CS(14) /   -.0000000000 8737853E0 /
204      DATA AE14CS(15) /    .0000000000 2331588E0 /
205      DATA AE14CS(16) /   -.0000000000 0641148E0 /
206      DATA AE14CS(17) /    .0000000000 0181224E0 /
207      DATA AE14CS(18) /   -.0000000000 0052538E0 /
208      DATA AE14CS(19) /    .0000000000 0015592E0 /
209      DATA AE14CS(20) /   -.0000000000 0004729E0 /
210      DATA AE14CS(21) /    .0000000000 0001463E0 /
211      DATA AE14CS(22) /   -.0000000000 0000461E0 /
212      DATA AE14CS(23) /    .0000000000 0000148E0 /
213      DATA AE14CS(24) /   -.0000000000 0000048E0 /
214      DATA AE14CS(25) /    .0000000000 0000016E0 /
215      DATA AE14CS(26) /   -.0000000000 0000005E0 /
216      DATA NTAE11, NTAE12, NTE11, NTE12, NTAE13, NTAE14 /6*0/
217      DATA XMAX /0./
218C***FIRST EXECUTABLE STATEMENT  E1
219      IF (NTAE11.NE.0) GO TO 10
220      ETA = 0.1*R1MACH(3)
221      NTAE11 = INITS (AE11CS, 39, ETA)
222      NTAE12 = INITS (AE12CS, 25, ETA)
223      NTE11 = INITS (E11CS, 19, ETA)
224      NTE12 = INITS (E12CS, 16, ETA)
225      NTAE13 = INITS (AE13CS, 25, ETA)
226      NTAE14 = INITS (AE14CS, 26, ETA)
227C
228      XMAX = -ALOG (R1MACH(1))
229      XMAX = XMAX - ALOG(XMAX)
230C
231 10   IF (X.GT.(-10.)) GO TO 20
232C
233C E1(X) = -EI(-X) FOR X .LE. -10.
234C
235      E1 = EXP(-X)/X * (1.+CSEVL (20./X+1., AE11CS, NTAE11))
236      RETURN
237C
238 20   IF (X.GT.(-4.0)) GO TO 30
239C
240C E1(X) = -EI(-X) FOR -10. .LT. X .LE. -4.
241C
242      E1 = EXP(-X)/X * (1.+CSEVL ((40./X+7.)/3., AE12CS, NTAE12))
243      RETURN
244C
245 30   IF (X.GT.(-1.0)) GO TO 40
246C
247C E1(X) = -EI(-X) FOR -4. .LT. X .LE. -1.
248C
249      E1 = -ALOG(ABS(X)) + CSEVL ((2.*X+5.)/3., E11CS, NTE11)
250      RETURN
251C
252 40   IF (X.GT.1.) GO TO 50
253      IF (X.EQ.0.) CALL XERROR ( 'E1      X IS 0', 14, 2, 2)
254C
255C E1(X) = -EI(-X) FOR -1. .LT. X .LE. 1.,  X .NE. 0.
256C
257      E1 = (-ALOG(ABS(X)) - 0.6875 + X) + CSEVL (X, E12CS, NTE12)
258      RETURN
259C
260 50   IF (X.GT.4.) GO TO 60
261C
262C E1(X) = -EI(-X) FOR 1. .LT. X .LE. 4.
263C
264      E1 = EXP(-X)/X * (1.+CSEVL ((8./X-5.)/3., AE13CS, NTAE13))
265      RETURN
266C
267 60   IF (X.GT.XMAX) GO TO 70
268C
269C E1(X) = -EI(-X) FOR 4. .LT. X .LE. XMAX
270C
271      E1 = EXP(-X)/X * (1. + CSEVL (8./X-1., AE14CS, NTAE14))
272      RETURN
273C
274C E1(X) = -EI(-X) FOR X .GT. XMAX
275C
276 70   CALL XERROR ( 'E1      X SO BIG E1 UNDERFLOWS', 30, 1, 1)
277      E1 = 0.
278      RETURN
279C
280      END
281