recursive computation of certain integralsrelation itself, but also on the particular solution to be...

20
Recursive Computation of Certain Integrals WALTER GAUTSCHI Oak Ridge National Laboratory, Oak Ridge, Tennessee* DEDICATED TO THE ~/~EMORY OF MILTON ABRAMOWITZ Introduction 1. It is well known that only very few computing methods yield the desired numerical answer in all circumstances. There are usually cases--not only arti- ficially constructed ones--in which a particular method simply fails to work. Fortunately, suitable modifications are often at hand which may turn the method into one of general applicability. What follows may be considered an elementary example in illustration of this remark. The "method" in question simply consists of evaluating a finite sequence of real numbers by means of a linear first-order recurrence relation. Such calcula- tions occur quite frequently, particularly in connection with the evaluation of definite integrals, so that a detailed analysis of the process is thought justified. 2. Consider, e.g., the problem of evaluating the integral 1 1 = f t e dt (2.1) J- 1 for a fixed positive value of x and for n = 0(1)N. Integration by parts yields the following recurrence relation ~+1 = x-~[(n+l)~ + (-1)~+1e x - e -x] (n = 0, 1, 2, ...), (2.2) which appears to lend itself naturally to the successive computation of the t~, if one starts with ~o = x-l(C - e-X). (2.3) It turns out, however; that unless x is relatively large, there occurs a cancellation of significant figures in summing the three terms on the right of (2.2). Even if only half a significant figure is lost per step of the recurrence, five figures are lost after ten steps, so that the numbers one obtains will soon become quite meaningless. To give a numerical example, let x = 1, N = 10. Carrying five significant * Received August, 1960. Operated by Union Carbide Corporation for the U. S. Atomic Energy Commission, Oak Ridge, Tennessee. Part of this paper was prepared while the author was guest worker at the National Bureau of Standards, Washington, D. C. This and other similar integrals are basic in the theory of molecular structure (cf., e.g., [12]). Methods of computing this integral have previously been discussed (see, e.g., [3], [41). 2t

Upload: others

Post on 18-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

R e c u r s i v e C o m p u t a t i o n o f C e r t a i n I n t e g r a l s

WALTER GAUTSCHI

Oak Ridge National Laboratory, Oak Ridge, Tennessee*

DEDICATED TO THE ~/~EMORY OF MILTON ABRAMOWITZ

Introduction

1. I t is well known tha t only very few computing methods yield the desired numerical answer in all circumstances. There are usually cases--not only arti- ficially constructed ones- - in which a part icular method simply fails to work. For tunate ly , suitable modifications are often at hand which m ay turn the method into one of general applicability. What follows may be considered an elementary example in illustration of this remark.

The "me thod" in question simply consists of evaluating a finite sequence of real numbers by means of a linear first-order recurrence relation. Such calcula- tions occur quite frequently, particularly in connection with the evaluation of definite integrals, so tha t a detailed analysis of the process is thought justified.

2. Consider, e.g., the problem of evaluating the integral 1

1 = f t e dt (2.1)

J- 1

for a fixed positive value of x and for n = 0 (1 )N. Integrat ion by parts yields the following recurrence relation

~+1 = x - ~ [ ( n + l ) ~ + (-1)~+1e x - e -x] (n = 0, 1, 2, . . . ) , (2.2)

which appears to lend itself natural ly to the successive computat ion of the t~, if one starts with

~o = x - l ( C - e-X). (2.3)

I t turns out, however; tha t unless x is relatively large, there occurs a cancellation of significant figures in summing the three terms on the right of (2.2). Even if only half a significant figure is lost per step of the recurrence, five figures are lost after ten steps, so that the numbers one obtains will soon become quite meaningless.

To give a numerical example, let x = 1, N = 10. Carrying five significant

* Received August, 1960. Operated by Union Carbide Corporation for the U. S. Atomic Energy Commission, Oak Ridge, Tennessee. Part of this paper was prepared while the author was guest worker at the National Bureau of Standards, Washington, D. C.

This and other similar integrals are basic in the theory of molecular structure (cf., e.g., [12]). Methods of computing this integral have previously been discussed (see, e.g., [3], [41).

2t

Page 2: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

2 2 W A L T E R GAUTSCI{[

digits, the reetlrrence (2.2) yields the following results:

,,. ~,,(1) n ~,,(:1)

0 2.35040 1 - .73576 6 .40304 2 .87888 7 ~ .26488 3 - . 44952 8 .2313(~ 4 .55232 9 - 1.00392 5 -.3245(} 10 - Z6888__0

The underlined figures, and in the last en t ry even the sign, are in error. The successive errors due to cancellation tend to accumulate so rapidly, as n increases, tha t the whole method of computat ion appears questionable. I t is a simple observation, however, tha t if errors grow in one direction of n they decrease in the opposite direction. Proceeding therefore in decreasing order of n we m ay expect to be more successful.: Indeed, s tart ing with the correct 5S value of Oh0( 1 ) and recurring backwards we obtain all values correctly to 5 significant figures. On the other hand, if :c = 5, N = 10, forward recurrence with (2.2) gives satis- factory results.

3. The example just given suggests the problem of finding criteria as to when forward and when backward recurrence is more adequate, numerically. We shall consider this question for a lineal" first order recurrence relation

f~+~ = a~f~ + b, (n = O, 1 ,2 , . . . ) (3.1)

under the assumption tha t the coefficients a,, and the particular solution ]'~ in which we are interested satisfy

a~ ¢ 0 , f~ ¢ 0 for a l ln . (3.2)

The coefficients a , , b, may depend on fur ther parameters , such as x in (2.2). Since cancellation of significant figures means deterioration of percentage

(i.e., relative) accuracy, the numerical execution of (3.1) is more adequate ly described by

y~+~ = (a,~y~ ~- b, ) (1 -p e,+,) (n = 0, 1, 2, - - . , N - l ) , (3.3)

where e~, e 2 , . - , are small quantities, the percentage errors introduced at the successive steps. I t will generally be true tha t the initial value, fo , too, is affected with a certain relative error, which may be denoted by eo :

yo = f0(1 + e0). (3.3')

Similarly, backward recurrence may be described by

y~,* a,, (y~+~ - b,~)(1 + n~) (re = N - I , N - 2 , . . . , 0) , (3.4)

y_~* = fN(1 -+ v~) (3.4')

2 The idea of reversing recurrence schemes to guard against dangerous error accumula- tion is already expressed in [3] and has later been successfully exploited in connection with the evaluation of Bessel functions (see introduction in [21, also [5, 8, 15]) and various other higher functions (see [1, 13, 14]).

Page 3: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

t:~ECURSIVE COMPUTATION OF CERTAIN INTEGRALS 23

where the v~ are of the same order of magnitude as the E,,. The problem in question then is, under what conditions the set of values (y0, y~, " " , y~) is to be preferred over the set of values (y0*, y~*, . . - , yN*) as potential approxi- mations to f0, fn, • ' • , f ~ , respectively.

4. In this form the problem appears to be difficult to deM with. We shall say only a little about it in section 8. In general, we shall assume for simplicity tha t the errors e,~, n ~ 1, are negligible compared with e0, and similarly, ~/~, n < N, negligible compared with ~N • This assumption is naturally justified if computa- tions are done by hand (but not necessarily if a digital computer is employed), since in hand computing one usually carries a few more digits ("guard digits") than would be required by the precision of the data.

Criteria for forward and backward recurrence can then be derived in quite an elementary manner, as is shown in section 5. Other related questions will also be discussed, such as the invariance of these criteria with respect to linear substitutions on f~ (section 6), and the computation, or choice, of the initial value in case of backward recursion (section 7). In sections 9-11 the results are applied to the recurrence (2.2) and to the recursive computation of the exponential integrals

I" E , ( x ) = t ~ ' e -~' dt. (4.1)

In this second example some additional complications arise which are briefly dealt with in section 12. Finally, in sections 13-15 we prove a few properties of the special functions (2.1), (4.1) tha t are needed in the following and which may have independent interest in themselves.

Forward vs. B a c k w a r d Recurrence

5. Let f~ be a particular solution of the recurrence relation (3.1) for which (3.2) holds. Suppose tha t f~ be calculated for n = 0(1)N, once by forward recurrence (3.3), yielding {y~}, and once by backward recurrence (3.4), yielding I Y,~*}. Suppose, furthermore, that in both calculations one starts with an initial value having a relative error e and carries out M1 succeeding calculations with infinite precision. Tha t is to say, let

~,~= 0 f o r n > 0, ~/~ = 0 f o r n < N, E0 = ~7~ = ~ (5.1)

in (3.3), (3.4). If e = 0 the two resulting sequences coincide exactly with {f,}. In general, the initial error e will be propagated during forward and backward recurrence. We define the relative ampl i f i ca t ion factors p , , pn* by

(y,~ - f , , ) f f ~ = p,~e, (y,,* - f ~ ) / f , = p,,*e. (5.2)

The sequence {y,~} is considered better or worse than {y~*} depending on whether I Pn ] < f Pn* f or [ Pn I > I P n$ I for n = 0, 1, - . . , N, and they are con- sidered equally good if [ P~ ] = I P,~* [ for n = 0, 1, --- , N. I t is readily seen tha t no other cases are possible, and, in fact, {y~} is better than, worse than, or

Page 4: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

2:J~ WALTER, G A U T S C [ I I

as good as {y,~*} depend ing on whether I pN I is less than t , greater than 1, or equal

to 1, respectively. This becomes clear if we observe tha t under the assumption (5.1) both {y,,}

and {y,d} are solutions of the line~r difference equation (3.1), the first, satisfying

yo = fo(1 + e), (5.7;)

the second satisfying

yN* = .Lv(1 + e). (5.4)

Hence,

y,, = f,~ + ch~, y,,* = f,~ + c*h,~,

where h~ is a solution of the homogeneous difference equation (3.1.) (with all b,~ = 0). We may normalize hn so that h0 = 1, which gives h~ = aoa~ . . . a,~_~ (n > 0). F rom (5.3), (5.4) we find c = foe, c* = fNE/h~¢ , so tha t

f~ h~ )

Therefore,

:fob,, f ~ h , ~ _ p~, (5.5) P'* -- f~ ' P'** -- hN f~ px '

from which our assertion follows immediately. The two sequences {p~}, {p.*} are essentially the same, except for different

normalizations, viz. p0 = 1 for the first, p~-* = 1 for the second sequence. I t should be noted that the above criterion depends not only on the recurrence

relation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is bet ter for one solution and worse for another solution of one and the same recurrence relation. Consider, e.g.,

A+l = (nq-1)f~ + :d '+~ (x > 0), (5.6)

for which bo th

f~l) = n!e~,(x) = hi (1 q- x q- xe /2 ! q- . - . q- x ' / n ! )

and

f~2) = n ! ( e ~ ( x ) -- e ~)

are solutions. The corresponding amplification factors are seen from (5.5) to be

p~l)= 1led.),

p~) = (1 -- e ~ ) / ( e , ( x ) -- e~),

and we have

tp~l) l < 1, I p~)l > 1 for a l l N > 0 .

Page 5: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

R E C U R S I V E C O M P U T A T I O N OF C E R T A I N I N T E G R A L S 25

(~. One could be tempted to try to control the propagation of error by sub- ~l:.ituting

F,~ = XnA (M ~ 0), (6.1)

with suitable X,~, and calculating F,~ from the transformed recurrence relation

F n + l Xn+l = ~ - a,, F ~ + X~+~ b,~. ( 6 . 2 )

The following result shows tha t nothing is gained in this way. The amplification factor p~ in (5.5) is invariant with respect to any linear sub-

slitution of the form (6.1). In fact, the solution H~ of the homogeneous difference equation associated

with (6.2) is n--1 n--t X~+i X~ X~

Therefore, if R,~ is the amplification factor for F,, ,

Fo H~ Xo fo X. h~ R ~ - - - On.

F,, Xo Xn f~

As a further simple remark, suppose, as before, tha t f~ satisfies (3.1) for n = 0, 1, 2, • • - , but that we are interested in calculating f,, for n = no(l) (no+N) with some no > 0. Then the criterion of section 5 on forward and backward recurrence still applies if [ p~-I is replaced by ] P~O+N/P~O I, the On being defined by (5.5).

7. In applications to definite integrals most of the work goes usually into the computation of the initial values, particularly so if backward recurrence has to be employed. I t is therefore of interest to point out a situation in which knowledge of the initial value is not required at all. This, in fact, is the case whenever

I O , ~ l - - ~ as n- - ) ~ . (7.1)

Let m >= 0 be fixed and let it be required to calculate f,,~. We show tha t under the assumption (7.1) we can obtain fm to any required accuracy by recurring back- ward starting with n = v sufficiently large and taking zero as the initial value. Let the resulting sequence be denoted ,y" j,~(~) (n = m, r e + l , . . . , v). By con-

st.ruction,

f(,) , = O. ( 7 . 2 )

,,. #v ) Since a*, , for each v, is a solution of the difference equation (3.1) we have

f(,) = f,~ + e~')h,, n "

t;rom (7.2), c (~) = - f J h , , so that

,,, = f m - g h . , = f = 1 f.,hT- = f = 1 - - •

Page 6: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

2 ~ WALTER GAUTSCHI

Since I ,o~ i --~ :~ as v ~ ~ , it follows f, , = lira . . . . fl,~>. Moreover, we see that

( f ,~-- .(,) .

SO tha t for any given e > O,

[(f,~ -- f~:))/f,,, I < e as soon as [p,,,/OO~ [ < e. (7.3)

8. So far we have assumed tha t only tile initial values of the recurrence are affected by errors. We shall now briefly consider the more realistic situation where small errors are introduced at each step of the recurrence.

Assuming that forward recurrence proceeds according to (3.3) and backward recurrence according to (3.4), a simple inductive argument shows that, if products of ~'s and ~'s are neglected, we have

where the coefficients cr,,k are expressible in terms of the amplification factors ( 5 . 5 ) :

~ = p , ~ / o ~ . ( s . 1 )

Thus, in place of (5.2) we now have more generally

(y~ - - f~) / f ,~ = a, kEk, ( y J --f i~) / f~ = ~ a,kn~ (n = O, 1, . . . , N ) . ( 8 . 2 ) k=0 k= n

We can write this more elegantly in matr ix form, if we introduce the ( N + 1)- vectors r, r* with the left-hand sides of (8.2), respectively, as components and the ( N + I ) × ( N + I ) matr ix S with elements a,~k • We decompose S into

S = I + SL + S R ,

with I the ident i ty matr ix and SL , S~ triangular matrices, the first having zeros on and above, the second on and below the main diagonal. Then (8.2) can be writ ten in the form

r = ( I + S t ) t , r* = ( I + S~)~, (8 .2 ' )

where e, n are the vectors with components e~, ~ respectively. Note that the elements of S satisfy

~ = 1, ~ k = ~r,~Z~Ik • ( 8 . 3 )

--1 In particular, ~,~ = a ,~ .

One possible way of comparing forward with backward recurrence is to compare

the two quantit ies

m = max li ( I + S,.)e 11~ m* = max H ( I + & ) , I1~ (s.4) .#0 lt~ II ' , , 0 ] t , 1I '

where {{ i~, {I !{2, i{ I~ denote suitable vector norms, a Forward recurrence would

a A more n a t u r a l a p p r o a c h , p e r h a p s , would be to cons ide r t h e e~ , ~ as i n d e p e n d e n t r a n - d o m v a r i a b l e s w i t h i d e n t i c a l p r o b a b i l i t y d i s t r i b u t i o n s , a n d to p re fe r f o r w a r d r e c u r r e n c e o v e r b a c k w a r d r e c u r r e n c e if t he p r o b a b i l i t y P r (]i r il < li r* ]i ) -g ½. T h i s c o n d i t i o n , h o w e v e r , does n o t a p p e a r to l end i t s e l f eas i ly to a q u a n t i t a t i v e d i scuss ion .

Page 7: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

RECURSIVE COMPUTATION OF CERTAIN INTEGRALS 27

be considered better than backward recurrence if

m =< m*, (8 .5 )

It appears difficult, in general, to translate this condition into a simple con- dition in terms of the c~k. In tile special case, however, where I! II1 is defined to mean the absolute vMue of the last component, II 112 the absolute value of the first componeng, 4 and I/ II denotes any vector norm, condition (8.5) turns out to be equivalent to the criterion derived in section 5. In other words, this cri- terion remains valid if in comparing forward with backward recurrence, only the error of the end result is taken into consideration, assuming the overall error introduced during the process of recurrence (as measured by II I1) the same in both directions. In fact, we then have, using (8.3),

k=0 k=0 k=0

t k=0

Thus,

m = Ip~lm*,

so that (8.5) holds if and only if I or 1 5 1.

Examples

9. Consider as a first example the integral in (2.1), i.e.,

~=(x) = f : t"e-~' dt

Here we have from (5.5)

(x > 0). (9.1)

n!~o(X) (n = 0, 1, 2, . . . ) . (9.2) I l = x" J I

The following theorem is believed to hold: THEOREM 1. For each fixed x > 0 the sequence {1P,~ 1} defined in (9.2) cannot

possess a "relative maximum," i.e., there is no n >= 1 for which the inequalities

Ipn- t Ip l, Ip l->- I p +il (9.3)

are valid simultaneously. We do not have a complete proof of Theorem 1, but can reduce it to the proof

of the inequalities

(nA- 1) [ /~(n- t - 1)! > 1 (n = 1 , 2 , 3 , . . . ) , (9.4) cosh (n + 1)

which have been verified numerically for n ~ 10. The sequence to the left of

4 II I!1 a n d II ]I~ are on ly seminorms , n o t v e c t o r n o r m s in t h e usual sense .

Page 8: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

28 WALTER GAUTSCE[I

(9.4) is decreasing in this range (except at is equal to 1.

We show that, under the assumption tha t

P" ~ 1 implies . P ~ - - l ,

From (9.2), using the recurrence relation I

n = 1), and its limit, as n --~ ~ ,

(9.4) is true,

Pn+l I -- > i. (9.5)

(2.2), we have

1 + (-1)~+ie~ + e¢-'{ x~. I"

(9.6)

First let n be odd. Then, ~,~ being negative, the first inequality in (9.5), by (9.6), is equivalent to (e ~ + e-~)/x [ $,, f ~ 2, which in turn is equivalent to x l~, 1/ cosh x N 1. Similarly, the second inequality is equivalent to x~,~+~/sinh x < 1, and this in turn, by the recurrence relation (2.2), is equivalent to ( n + l ) 1 ~- I/sinh :r > 1. Therefore, we have to prove tha t

x t ~ ( x ) I (n + 1) tB,~(x) I > 1 (nodd) . (9.7) Fn(x) ~ < 1 implies G~(:c) -= cosh x = sinh x

By the same argument, for even n it has to be shown tha t

K,,(x) -xS~(x) < 1 implies L,~(x)--= (n + 1)~,~(x) > 1 (n even). (9.8) sinh x - cosh x

By Lemma 8 of the Appendix, F~(x) is increasing fl'om 0 to 2, whereas, by Lemma 7, G~(x) is decreasing from 2 ( n + l ) / ( n + 2 ) to zero. Therefore, there is a unique positive value x = x~ for which Fn(x) = G~(x). Implication (9.7) then foltows if we show tha t F~(x~) > 1. I t is readily seen that x~ > n + l , Xn being the root of x tanh x = n + 1, so tha t from the monotonicity of F~, and (9.4),

F~(x~) > F~(~ + i) = (n + i) I#~(n + i) I > i. cosh (n + 1)

Similarly, if n is even, K~(x) is increasing from 2 / ( n + 1 ) to 2, by Lemma 5, and L~@) decreasing from 2 to 0, by Lemma 6. We have K,~(:c) = L,~(:c) for the root :r~ of ( tanh ~:)/x = 1 / ( n + 1 ) . Here, x~ < n + l , so tha t

L,~(x~) > L~(n + 1) =

which proves (9.8). We observe now that

(n + 1 )~ (n + i) > I,

cosh (n ~ 1)

as n---> ~:. (9.9)

In fact, expressing ~,~ in terms of the incomplete gamma function.,

~ ( z ) = x -~ - 'W(n+ l , - x ) - r @ + l , :~)],

Page 9: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

RECURSIVE COMPUTATION OF CERTAIN INTEGRALS 29

i~ follows from well-known asymptotic relations (see, e.g. [6, p. 140]) tha t

n + l 9J --~C

n + l

Therefore, I P,, [ tends to infinity, as n --~

as n ( e v e n ) - + ~ ,

as n ( o d d ) - + ~ .

, essentially as ( n + l ) ! / x "~+~.

(9.10)

As a consequence of Theorem 1 and (9.9) the sequence {1 P~ I} (n = 0, 1, 2, . •-) will behave in one of two possible ways. If Im l ~ 1 or, equivalently, z =< 1 .9150 . . . , then I P~ [ i s steadily increasing for n >= 1 from I P*I to ~ . If x > 1 .9150. . . , then [p,, I first decreases until it reaches a minimum value, and from there on steadily increases to ~ .

This proper ty has the following important consequence: I f the integral (9.1) is generated by means of the recurrence relation (2.2), in the proper direction ac- cording to the criterion of section 5, then the error amplification is less than 1 through- out the range of recurrence.

By the criterion just mentioned, forward recurrence through n = 0 ( 1 ) N is proper if the expression in (9.2) is less than or equal to 1 for n = N, and back- wm'd recurrence is proper otherwise. Since, by Lemma 9, this expression decreases from oc to 0 as x varies from zero to infinity, there is a unique x = xN for which I p,v(x~v)l = 1. Therefore, forward or backward recurrence is adequate depending on whether x ~ XN or x < XN respectively. By Lemma 13, a good approximation

to x~v is given by

1 XN ~ - {N + } In N + In [(1 + e)x/N]}. (9.11) e

10. Assume now tha t backward recurrence is adequate, i.e.,

x < x~;. (10.1)

Since (9.9) holds, the procedure of section 7 can be used, which consists in starting the recurrence with n = v > N for v sufficiently large, using zero as initial value. Given the integer p > 0, let us estimate how large v must be taken in order to obtain the values of ~ ( x ) , n = 0 (1)N, with relative errors less than

10 -~. According to (7.3) we choose v such tha t

o2 n! ~(x) = ~ . x~-~ ==--=an(x) < 10-~' for n = 0, . . . , N . (10.2) P~

Since

i o+l / I

and since each factor on the right, by Lemma 2 and 9.10), is less than (e x + e-~')/(e ~ - e-X), which in turn is less than 1 + ( l / x ) , we have

Page 10: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

30 WALTER GAUTSCHI

(10.2) is then certainly satisfied if

n ! x) ~-'~ ~-T (1 + . < 10 -p for n = 0,1, - . . , N .

Using (9.11), inequality (10.1) may be replaced, approximately, by z < N/e , so that we require

~Z l - l - < 10 -p for n = 0,1, . . - , N . (10.3)

i t is possible to derive from (10.3) an essentially equivalent, but for practical purposes more convenient condition, via.,

= XN, X > 1 -4- 2.31 1 - F ~ . •

We omit here the somewhat lengthy, but elementary derivation.

11. As a second example we consider the exponential integral

f" E,,(x) = t-% -~' dt (x > 0), (11.1)

which satisfies the recurrence relation

E,~+~ - 1 (e-~ _ xEn) (n = 1, 2, 3 , . . . ) . n

For conformity of notation we set f~ = E~+x, so that

1 f ~ + ~ - - - ( e - z - z f ~ ) (n = 0 , 1 , 2 , . . . ) . (11.2)

n + l

The amplification factors (5.5) associated with (11.2) are given by

- x ~ E ~ ( x ) (n = 0, 1 ,2 , . . . ) . (11.3) l o,, I n!E~+~(x)

THEOREM 2. The O~ defined in (11.3) have the property that for each fixed x > O,

P~+~i < i p'~ • (11.4) ' P n ] l On-1

In particular, the sequence {] p,, I} cannot possess a "relative minimum", i.e., there is no n ~ 1 J~r which simultaneously I o~_*~ I >= I P~ I.

En+i(x) < E~(x)E,~+2(z) (cf. PROOF. Using the well-known inequality '~ [9, p. 26]),

- - i i " P,~ i (n + 1)E~+2 < nE~+l ~p~-il

The second part of Theorem 2 is a trivial consequence of (11.4). Combining Theorem 2 with the fact that

p~ ~ 0 as n ~ ~o,

Page 11: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

I I E C U t g S I V E C O M P U T A T I O N O F C E R T A I N I N T E G R A L S 31

we conclude again Chat the sequence/l p~ I} behaves in one of two possible ways. If I pll ~ 1 or, equivalently, x __< .61006-.. , then Ion t is steadily decreasing from 1 to O. If x > .61006-. . , then I o~ I first increases until it reaches a maxi- mum value, and from there on steadily decreases to zero.

Since E,,(x) = x'~--~IP(1 - n , x), we can write

_ 1 r ( 0 , x )

I p~ I n! r ( - n , x)'

which, as function of x, increases steadily from zero to infinity in the interval 0 N x < ~c (Lemma4) . Thus, I P~l ~ l if and only if x ~ xNwithx~r the unique root of I P.~l = 1. Using the criterion of section 5 it follows, therefore, that recurrence (11.2) through n = 0(1)N is better in forward direction i f x =< x s , and better in backward direction i f x > xN . By Lemma 10, the following approxi- mation for xA~ can be used,

xN ~ e- N -b ½ In N -k In i - ~ f " (11.5)

12. I t has been observed in the previous section that for x > .61006.. . the sequence {1 P- I} defined by (11.3) will possess a maximum. Let this be assumed at n = n*. The larger x is, the larger I P,* I. If N < n*, then backward recurrence is s~ill adequate, since the amplification factors involved remain less than 1. If N > n*, however, amplification factors greater than 1 will occur, no mat ter whether forward or backward recurrence is used. Thus, in this case, a certain loss of accuracy is unavoidable, if the recurrence (11.2) is started at n = 0 or at n = N. A way out of this difficulty is to start the recurrence at n = n* and generate the f~ for n < n* by backward, and the f~ for n > n* by forward recurrence. Then all amplification factors involved will be less than 1. (Cf. the remark at the end of section 6.)

I t can be shown tha t n* ~ x, the approximation being better the larger x. Given a large x, the recursive computation of E,~(x) for n = 0(1)N, N > x, may therefore proceed as follows:

(i) Determine the integer n* closest to x and compute E, . (n*) by means of known asymptotic relations (see, e.g., [7]).

(ii) Compute En.(x) = E, . (n* + (x - n*) ) by means of Taylor 's series, evaluating the necessary derivatives E~, ) (n*) = ( - 1) ~ E,,,_~(n*) by backward

recurrence. (iii) Compute E , ( x ) , n < n*, by backward recurrence; En(x), n* < n ~ N,

by forward recurrence, using in both cases the result of (ii) as initial value. For further details of this computation we refer to [10].

A P P E N D I X

:13. We first establish two inequalities for the integral

(x > o). (13.1)

Page 12: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

32 W~.kLTi~:~ GAUTSCH[

Repeated use will be made of the fitets that fl,,(x) > 0 for n even, FL,(x) < 0 for n odd,

f~,,(O) = 2 / ( n ÷ 1) (n even), ~,,(0) = 0 (rz odd) (13.2)

and

t t3~(x) l ~ e ~ / x as x-- , o0. (13.3)

LEMM:k 1. For any non-negative integer n we have

¢~,~(x)~,~+a(x) 2> 1 (0 < x < ~ ) (13.4)

PnOOF. We first observe that the two indices in both numerator and denomi- nator of (13.4) have different parity so that the products in the numerator and denominator are both negative. Hence (13.4) is equivalent to

f , ~ ( x ) ~- ~ , ,~+~ - ~,~+~n+~ < O.

Using

~,/(z) = - 2 . + ~ ( x ) , (13 .5)

we have '2 2

Writing

= fo 1 --1)"e ~t e -~ ) ~ ( x ) F ( ( + dt, (13.6)

it follows readily from Schwarz's inequality that 2 ~+2 < 5~fl~+4. Therefore y ( x ) < 0, and sincere(0) = 0, it follows f,~(x) < 0, which proves Lemma 1.

A simple corollary of Lemma 1 is the following L~:MM, 2. For a fixed x > 0 consider the quotients

] ~,~+,(x) r~(x) - ~+2(x) (n = O, 1, 2 , . . . ) . q ~ ( x ) = i - ~ - ~ ' ~,~(~)

Then q, increases as n increases through even or through odd integers and r, increases i f n increases through all integers.

In fact,

%+2_ r~+l_ ~,~n+z > 1. qn r,~ ~,~+, fh+2

LEMMA 3. For odd n ~ 1 we have

~J(x) < ~_~(x)~+l(X)

PRooF. From (13.6) we have for n odd,

J O

(0 =< x < ~ ) . (13.7)

f f F(e~ ~ e -~) t~(e ~=t - e -~ t ) d t < + dt.

Page 13: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

R E C U R S I V E C O M P U T A T I O N O F C E R T A I N I N T E G R A L S 33

Using Schwarz's inequality,

fo t~+l(e~C e-~e) fo I _-< + dt

= ~ , , + ~ ( x ) ~ _ ~ ( x ) ,

t~-l(e~t-~-e -~t) dt

from which (13.7) follows immediately.

14. In this section we deduce some monotonic features of the incomplete gamma function

r(a,x) = e-tt ~-~ dt (14.1)

and of the integral ¢~(x) in (13.1). LEMMA 4. For any real numbers a, b with a > b the function

f ( x ) - r (a , x) (14.2) r(b, x)

is steadily increasing to infinity in the interval 0 ~ x < ~ . I f , in addition, b ~ O, then f ( x ) increases from zero to infinity.

PROOF. By straightforward differentiation,

e--XX a - 1

f ' ( x ) - r~(b ' x) [xb-~r(a' x) - r(b, x)].

Sinceb ~ a < 0 ,

z b - a r ( a , X) -- r(b, x) = e - t t a - l (X b-a - - t b-a) dt > O,

which proves the monotonicity of f ( x ) .

As x --~ ~ we have r (a , x) ~ xa-~e -~, so that f ( x ) ~ x a-b, f ( x ) ~ ~ .

As x--~ 0,

[ r ( a ) (a > 0) r ( a , x ) ~ - l n x ( a = 0 )

[ - - x / a (a < 0),

from which f ( x ) --~ 0 whenever b __< 0 and b < a. LEMMA 5. For even n ~ 2 the function

x~,~(z) f , ( x ) - sinh x

is steadily increasing from 2 / ( n + 1) to 2 in the interval 0 ~ x =< ~ . PROOF. The function (14.3) is identical to 2~,,(x)/~o(X). Using (13.5),

1 2 t ~0:f~ (x) = ~0~,,' - ~ o ' = - ~0~+1 + ~ 1 .

Let

g ,~ (x ) = ~n~l - - ~,,+1~0.

(14.3)

Page 14: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

~ WALTER GAUTSCHI

Obviously, g& ) 0. Furthermore, usit~g (io.~.) and Lemma 2,

~ )

Thus , g,,(x) > 0, which p roves the m o n o t o n i c i t y of f , , (x) . T h e rest of L e m m a 5 follows f r o m (13.2) and (13.3) .

L~:~.~u~ 6. For even n ~ O the f'u~ction

_ ,8, , (z) ( 14 .4 ) f,~(x) eosh x

is steadily decreasing from, 2 / ( n @ 1 ) to zero 'in the interval 0 N x =< ~ . PaOOF. Us ing (13.5) ,

(eosh x)2 f ~ ' ( z ) = /~,,' cosh :v - ~ s inh x = - f i , ,+ l eosh x - /3~ sinh z.

Leg

g,~(x) = - - ~ + ~ eosh :c - 5~ sinh x.

Obvious ly , g~(0) = O. F u r t h e r m o r e ,

g~/(x) = (¢~,~+2 -- /3~) cosh x < 0,

so t h a t g~(x) < 0, i.e., f , ,(x) is s tead i ly decreasing. T h e rest of L e m m a 6 follows f r o m (13.2) and (13.3).

I n the s ame w a y as L e m m a 6 one p roves LEM:,*A 7. For odd n >= 1 the function

f~(x) - [B,~(x) I (14.5) s i n h x

is steadily decreasing.from 2 / (n + 2) to zero in the interval 0 -< x ~ ~ . LEMMA 8. FOr odd n ~ 1 the f~nction

f,,(x) - x i ~ ( x ) I ( 1 4 . 6 ) " e o s h x

is steadily ,increasing from zero to 2 in the interval 0 ~ x ~ ~ . PROOF. T h e func t ion (14.6) can be wr i t t en in the f o r m

~o - x ~

Differen t ia t ing , and using ( t 3 . 5 ) ,

- - 2 / ~6) (~0 :c~,) :f~ (~" = (,2o - z ¢ O ( - ~ , , + x~,,+,) + z ~ , , ( - 2 2 , + zS~)

• ¢,, i - ~ f o . ( 1 4 . 7 )

Page 15: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

RECURSIVE COMPUTATION OF CERTAIN INTEGRALS 35

B v Lem:ma 2, and Lernma 3 with n = 1,

J ~ >

Since fl0fl,~ < 0, fl~fl~ > 0, all three terms in (14.7) are non-negative and f i J ( x ) > O. The rest of Lemm~ 8 follows from (13.2) and (13.3).

L:~:MMA 9. For any integer n ~ 1 the funct ion

X n

L, (x ) - j ~ ( z ) i (14.8) #0(x)

is steadily increasing j~om zero to infinity in the interval 0 -< x -< ~ . PRooF. We have

~o(x) f~(x) = (--1)nx~fl ,(x).

Differentiating both sides, and using (13.5),

= ( - 1 ) ~ (nx°-~#. - x '~÷~ + x" ~ ~0/.'(x) #o /"

Multiplying by #0 and using the recurrence relation (2 .2) ,

3o%' (x ) = (-1)~{nx~--~of l~ - x~-~flo[(-1)~+~e~ - e -~ --F (n -F 1)#,]--k Xn#lf~}

= (--1)nx"-~{Xflo[(--1)ne ~ H- e -x] -- xfln(flo -- x#l)}.

Observing tha t

x # o = e ~ - e - ~ , # o - x # ~ = e ~ + e - ~

and again using (2.2) with n replaced by n - 1, we finally obtain

~:~ '~x~ ~x~-~{ (e ~ 0j~ ~ , = ( - 1 ) - e -~) [ ( - 1 ) % ~ + e -~]

- ( e ~ + e - ~ ) [ ( - 1 ) ~ e " - e - x + n # . _ l ] } ( 1 4 . 9 )

= (-1)'x'~-2{211 _ ( - 1 ) ~] - n ( e • q- e-')#,_~}.

If n is even, it follows immediately from (14.9) that f , ' ( x ) > O for x > 0. If n is odd, then #,,_~(0) = 2/n , so that the expression in braces vanishes for x = 0. I ts derivative is equal to

n (e ~ q- e-~)fl, _ n ( e ~ - e-~)fl._l ,

which is negative for x > 0, n odd. Therefore a g a i n f J ( x ) > 0. This proves the monotonicity of f~ (x ) . The remaining par t of Lemma 9 follows

from (:13.2) and (13.3).

15. We establish now some asymptotic results for the exponential integral E , (x) and for the integral #, (x) in ( 13.1 ). We shall use the following asymptotic formula due to P61ya and Szeg5 [11, p. 81]. Let ~(t) , h( t ) be functions of class

b

C 2 in the finite or infinite interval [a, b] such that ~ ~(t) exp [nh(t)] dt exists Ja

Page 16: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

~6 WALTER GAUTSCHI

for n = 0, 1, 2, • • • . Let r be an interior point of In, b], and

h( t ) < h ( r ) for a =< t < r, h ' (~) > O,

Then, for any real a, ~, as n --~ ~ ,

fa r+~lnn l n+~D~ eSh, (r ,~ah'(r)--le nh(r) ~( t ) e =h(*) dt ~ h'(r--~

LEMMA 10. Let x= be the unique positive root of the equation

x E ~ ( z ) - 1 n!E'.+~(z)

Th,en, as n ~ ~ ,

e

PRooF. Let

~(~) ~ O.

(n --> c¢).

(n > 0).

(n--~ 0¢).

(~5.1)

(15.2)

(15.3)

v n-~+(~I~)e "(l+h~) ( n - - + ~ ) . (15.5)

x~E l ( x ) F(0, x) (15.4) p,,(x) = n!E,,+1(x) = n ! F ( - n , x) "

I t is clear from Lemma 4 tha t equat ion (15.2) has a unique positive root. Let r > 0 , a, fl be real numbers, and

r,, = rn + a l n n + ~, a~ = r~/n.

Then, by a substi tut ion of variables,

f7 f7 r ( - n , r~) = e-t t -'~-1 dt = n -~ e-~tt -~-1 dt. n n

The last integral can be writ ten in the form

t ow h ie h (15.1) applies with ~,(t) = ( - t ) -~, h(t) = t - In ( - t ) , - ~ _< t _~ b, - r < b < 0. We obtain

r ( - n , ~-~) ~ e4c1+~) n . . . . (~+~)-~ e -~c'+'~') ( n ~ ~ ).

Using the well-known relation F(0,x) ,~ e-~ /x (x ~ ~ ) and Stirling's formula, we fur thermore have

1 F ( 0 , T~) ~ - - " - " - ~ e a -~ )"

Therefore, from (15.4),

Page 17: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

RECURSIVE COMPUTATION OF CERTAIN INTEGRALS 37

If we now require tha t the right-hand expression in (15.5) be equal to 1, we are led to the following values for r, a, ~:

r - , a = - - B = In . e 2e ' e l + e

With these values, r~ = ( , , where

I ( i ~~ =E n - t - 2 1 n n + l n l - t - e / "

I t remains to show tha t

x,~ - - ( ~ - - ~ 0 a s n - - ~ ~ . ( 1 5 . 6 )

We prove this indirectly: Assume, contrary to (15.6), tha t x~ > ~ + c infinitely often for some c > 0. Then, by Lemma 4,

1 = p,(x~) > p~(~ + c) for infinitely many n. (15.7)

However, by (15.5) and the way ~ was determined, p~(~ + c) ~ e ~' (n --~ ~ ), which violates (15.7). Similarly, x. < ~, - c, c > 0, cannot hold for infinitely many n. This completes the proof of Lemma 10.

Before deriving the analogous result for fin(x) we prove the following two lemmas.

LEMMA 11. Let a > --1 and a # O. Then

fo I e anO~ x ' e a ~ d x - ( 0 < 0 ~ < 1 ; n = 0 , 1 , 2 , ' . . ) , (15.8)

n + l where

0~ - - * 1 a s n --~ ~ . ( 1 5 . 9 )

PROOF. Ident i ty (15.8) follows from the (generalized) mean-value theorem for integrals.

To prove (15.9) we solve (15.8) for 0" :

I = ~ n ( n + l ) + I n an

Thus

x n e a~ d x } .

lim 0, = lira 1 In e "(a'+ln'? d ,

provided the limit on the right exists. Using (15.1), with r = 1, a = B = 0,

f0 ean t e ~C~+Ln~) d x - (1 + a)n (1 + e~), ~--÷0asn--~ ~ .

Therefore,

fo 1 ln[(1 + a)n] + ln(1 + e~) ~1 (n--~ ~ ) , 1 In e ~(~+l'~) dx = 1 an an an

which proves (15.9).

Page 18: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

ON WALTEt~ GA UTSCHI

l.,~cvx, ix :12. L~c r > 0 , ~, fl be real, arid r,~ = rn + ~ hi /~ + ~. 2h.n,

~' t'~e - t dt ~ . , , , - .... > 0 as ~--> ~ . (15.10)

l r" g"e t dt

PeooF. Let 0 < e < 1. Substituting t = r n z in the integrals of (15.t0), we fil~d for n suttieiently large,

0 ~ con

,l qc e frnl(rn) Xn e ......... dX Jo :,in ....... (,:/j ao <

f01-e [ ~/(" '~ ) x'~e ...... dx x"e ..... dx

By the mean value t.heorem,

:: d x - -

and by Lemma 11, l--e i

where

(1 + e)"+~ n + l

---r n~n e , 0 < , ~ , , < i.--F~,

x % "<I-~'~ dz ( t - ~),~+1 ,(~-~,~o~ n + I

0 ~ - - ~ 1 a s n ~ ~ .

Hence, for e sufficiently small,

(1 + ~ + ~

This proves (15.10). We are now ready to prove LE:~MA 13. Le t x~ be the un ique po~'itive root o f the equat ion

n! ~o(Z) - 1

T]te'l~

(n ~ 1). (15.1~)

1 x ~ , = - { n + ½ h ~ n + l n [ ( l + e ) x / ~ ] } + o ( 1 ) ( ~ + ~ ) . (15.12) e

PRooF. I t is clear from Lemma 9 tha t equation (15.11) has a unique positive root. Let

n! 2 o ( x ) _ n' . (e" - - e - x ) p,,(z) -

From (13.6), by a simple substitution of variables,

f f :c~+1 I Cr,(x) t = t%' dt q- ( - 1 ) " t % - ' dr. (15.13)

Page 19: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

RECUI~SIVE COMPUTATION OF C E R T A I N I N T E G R A L S

Hence ,

39

9 r > 0, t hen b y ( l o . l o ) and L e m m a 12, a s h - - , m,

f0 TM .n+t ~ tnet

n[ e TM p~(T~) ~ ( n - - ~ ~ ) . (15.14)

fo TM l~'e t dl

T h e in t eg ra l in the d e n o m i n a t o r can be w r i t t e n in the fo rm

~n Tn]r~

fo ,"et dt = nn+l fo en(t+ln° d,,

to which (15.1) is a p p l i c a b l e wi th 9 ( t ) ~ 1, h(t) -~ t + I n t . W e o b t a i n then

f rom (15 .14) , a f t e r a shor t c o m p u t a t i o n ,

re~l~ -~+(~'/~)e ~(l+h~ (n ~ ~ ). p n ( r n ) ~ n

D e t e r m i n i n g the c o n s t a n t s r , ~, ~ such t h a t t he r i g h t - h a n d express ion is equa l

to 1, we ge t r,~ = (~ where

+ lnn + In +

I t is t h e n shown in the same w a y as in t he proof of L e m m a 10 t h a t x , - ~ --~ 0

as n ---> ~ .

ACKNOWLEDGEMENTS

The author is indebted to Professor A. Ostrowski for discussion and helpful criticism, and to Mr. G. F. Miller for discussion of the material in section 12.

REFERENCES

[1] M. ABaA~mWlTZ, Review 58, Math. Tables Aids Comput. 10 (1956), 176. [2] British Association for the Advancement of Science, Mathematical Tables, Vol. X,

Bessel Functions, Part II , Functions of Positive Integer Order (Cambridge University Press, 1952).

[3] A. S. COOLIDGE, A quantmn mechanics treatment of the water molecule. Phys. Rev. ~ (1932), 189-209.

[4] F. J. CORBAT6, On the computation of auxiliary functions for two-center integrals by means of a high-speed computer. J. Chem. Phys. 24 (1956), 452-453.

[5] F. J. CORBAT6 and J. L. URETSKY, Generation of spherical Besscl functions in digital computers, o r. Assoc. Comput. Mach. 6 (1959), 366--375.

[6] A. ERDI~LYI, ET AL., Higher Transcendental Functions, Vol. 2 (McGraw-Hill-Book Co., New York, 1953).

[7] W. GAUTSCm, Exponential integral e -~ t -~ dt for large values of n. J. Res. Nat. Bur.

Standards 62 (1959), 123-125.

Page 20: Recursive Computation of Certain Integralsrelation itself, but also on the particular solution to be calculated. In fact, it is possible that. forward recurrence is better for one

40 WALTER GAUTSCHI

[8] M. GOL~)S'r~;IN and R. M. THALE~¢, R, ecurrence techniques for the calculntion of Bessel functions. Math. Tables Aids Com.p~t. I3 (1959), 102-108.

[9] E. HOVF, Mathe~tatic(zt Problems of Radiative Equilibriu.m. Cambridge Tracts in Mathe- matics and Mathematical Physics, No. 31 (Cambridge University Press, 1934).

[10] (L F. 3,[ILLI~Za, Tables ~f Generalized Exponential Integrals. National Physical L~bora- tory, Mathemt~tical Tables, Vol. 3 (H. M. Stationery Office, London), to appear.

[11] G. PSLYA and G. SZEG0, Aufgaben und .Lehrsiitze aus der Analysis, Vol. 1 (Springer, Berlin, 2nd ed. 1954).

[12] It. PREt ss, Integraltafeln zur Quantenchemie, Vols. 1-4 (Springer, Be~'lin, 1956-60). [t3] A. ROT~ZN:BnRG, The ea.lculation of toroidal harmonics. Math. Comped. 14 (1960), 274-

276, [14] I. A. STE(~t-N and M. AB~AMOWITZ, Gener,~tion of Coulomb wave functions by means

of recurrence relations. Phys. Rev. 98 (1955), 1851-1852. [15] - - - - , Generat.ioI~ of Bessel functions on high-speed computers. Math. Tables Aids

Comput. 1I (1957), 255-257.