certification of an algorithm for bessel functions of complex … › ... › 77b ›...

4
JOURNAL OF RESE ARCH of the National Bureau of Sta nd ards - B. Mathematical Sciences Val. 77B, No. 3, J uly-Septembe r 1973 Certification of an Algorithm for Bessel Functions of Complex Argument David J, Sookne 1 Institute for Basic Standards, National Bureau of Standards, Washington, D. C. 20234 (June 4, 1973) Co mput er t es ts of algo rithm BES LCI are d esc ribed, and the r es ults of the t es t are given. Key words: Bac kw ard recur sion; Besse l functiun; bit co mparison; erru r bound s; re lative e rror . 1. Introduction Bess e l fun ction valu es I II (z) , J" (z) ge nera ted by BESLCI [lJ we re com pared with chec k valu es calc ulated via the ascending series ( Z)" " (z2 / 4)k l ,,(z) = 2 using multiprec ision arithme ti c [2).2 Th e 60·bit mantissa of each part of the test value was sub· tracted from the correspo nding manti ssa of the check value, and the r es ult expressed as a multiple, m, say, of the last bit. For most errors mentioned in this ce rtifi ca tion. 1 m 1 7. Bit co mp ar ison was u se d in preference to calc ulation of relative error in or d er to simplify co mput a tion s. An e rror of m bits in the manti ssa co rresponds to a relative error betw ee n 171 .2 - 60 and 111 2- 59 This t es t is too strict, however , near a zero of the r eal or im aginary part of the function being tested. For complex values of z, it is more r eali stic to co mpar e the bit e rror with th e grea ter of the real and im agi nary parts , sin ce the re lative e rror in a c ompl ex numb er i'Y/ is I, and o'Y/ denoting the r espec tive e rror s in the r eal and ima ginar y parts. For ar gume nt s in th e neighb orhoods of zeroes of Re JII (Z), 1m J,, (z), Re l ,,(z) , or 1m J,,(z), an assess ment of abso lut e errors was made to 60 binary places by right·shifting the mantissa of both test and chec k values before subtract ion. Thi s was done whe ne ver the order n was less than 1 Z 1 and the modulus of the 1 chec k value less th an 2"' These c ases are distinguished by ast erisks in the c omputer printout ; statistics for this t est are compiled separa tely. A bit com pa ri son t es t was also used to check the section of co de in volving the two· term as· ce nding series for s mall 1 Z I. A second f ea tur e of BESLCl which was tested systematica ll y is th e e rr or re turn . This portion of the code determin es whether all orders n = 0, 1, ... , NB- l ca n be calc ulated to the des ired a cc ura cy. A modifi ea ti on occurs if NB is so large com par ed with 1 z 1 that there is und er fl ow in the re pres enta ti on of } NB - l(Z) or I NB- l (z). When this happens, the pro gra m dete rmin es tbe largest AMS Subject Classifica tion: 68A 10. I Prese nt address: W. U. J.S. In stitut e, Arad, Israel. 2 Figures in br ackets indi ca te the li terature references al Ihe end of Ihis paper. 133

Upload: others

Post on 05-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Certification of an algorithm for Bessel functions of complex … › ... › 77B › jresv77Bn3-4p133_A1b.pdf · 2011-05-16 · Certification of an Algorithm for Bessel Functions

JOURNAL OF RESEARCH of the National Bureau of Standards - B. Mathematical Sciences

Val. 77B, No. 3, July-September 1973

Certification of an Algorithm for Bessel Functions of Complex Argument

David J, Sookne 1

Institute for Basic Standards, National Bureau of Standards, Washington, D.C. 20234

(June 4 , 1973)

Co mputer tes ts of a lgo rithm BES LC I are described , and the res ults of th e tes t a re given.

Key words: Backward recurs ion ; Bessel fun ctiun ; bit co mparison; erru r bou nds; re lative error.

1. Introduction

Besse l fun ction values I II (z) , J" (z) generated by BESLCI [lJ we re co m pared with c heck valu es calculated via the ascending series

(Z)" " (z2 /4)k l ,,(z) = 2 .~k!(I/ + k)!'

using multiprecis ion ari thm etic [2).2 Th e 60·bit mantissa of each part of the test value was sub· tracted from the correspo ndin g manti ssa of the check value , and the res ult expressed as a multiple, m , say, of the last bit. For most e rrors mentioned in this certification . 1 m 1 ~ 7. Bit comparison was used in preference to calc ulation of relative error in order to simplify co mputa tion s. An error of m bits in the mantissa corresponds to a relative error between 171 .2 - 60 and 111 • 2- 59•

This tes t is too stri ct , however, near a zero of the real or im agin ary part of th e fun ction be ing tested. For co mpl ex values of z, it is more reali stic to compare the bit error with the greater of the real and im aginary parts , since the relative error in a complex number ~+ i'Y/ is (o~+ iO'Y/) /I ~+ i'Y/ I, o~ and o'Y/ de notin g th e respective errors in the real and imaginary parts. For arguments in th e neighborhoods of zeroes of Re JII (Z), 1m J,, (z), Re l ,,(z) , or 1m J,,(z), an assess me nt of absolute errors was made to 60 bin ary places by right·shifting the mantissa of both test and c heck values before subtraction. Thi s was done whenever the order n was less than 1 Z 1 and the modulus of the

1 check value less than 2"' These cases are distinguished by asterisks in the computer printout;

statistics for thi s test are co mpiled separately. A bit co m pa ri son tes t was also used to check the section of code in volving the two· term as·

cending series for s mall 1 Z I. A second feature of BESLCl whi ch was tes ted sys te matica ll y is th e error re turn . Thi s portion

of the code determin es whether all orders n = 0, 1, ... , NB- l can be calculated to the des ired accuracy. A modifi ea tion occ urs if NB is so large com pared with 1 z 1 that there is underfl ow in the r eprese ntation of } NB - l(Z) or I NB - l (z). When th is happens, th e progra m determines tbe larges t

AMS Subject Classification : 68A 10. I Present address: W.U.J.S. In stitut e, Arad, Is rael.

2 Figu res in brackets indica te the li te rature refe rences a l Ihe end of Ihis paper.

133

Page 2: Certification of an algorithm for Bessel functions of complex … › ... › 77B › jresv77Bn3-4p133_A1b.pdf · 2011-05-16 · Certification of an Algorithm for Bessel Functions

value NCALC (> Izl) such that accurate values can be calculated for n = O, 1, ... , NCALC-I; these values are then calculated. To test this, BESLCI was called with ~B= 5600. In each case, the program returned NCALC < NB, insuring that the error return loop had been executed. Then the values of NCALC and the Bessel functiol ! of order NCALC-I were checked by calling BESLCI with NB set equal to NCALC; this involved another execution of the error return loop. In each case, the new NCALC was identical with the old. Finally, the Bessel function value of order [lzlJ was checked by calling BESLCI with NB = [ I z I J + 1; this involved no execution of the error return loop. In both cases , bit comparisons on 60 significant bits were performed.

Results of the tests are des cribed in the next two sections.

2. The Bit Comparison Test

Arguments z were chosen as follows. Let Rj denote the set of rational numbers 2j '/I, where fJ is a 60-bit fraction , with t ~ fJ < 1. Two complex arguments were generated in each of the sets

} =- 6(1)6

BI.'= {x+ iy: x = 0, YERd k =- 6(1)6

j , k = -6(1)6,

using a pseudorandom number generator [3]. One of the two arguments was used to generate l's and the other j's. For each argument , functions of order 0 , 1, ... , 10 were tested. It should be noted that the sets Cjl." includ e co mplex arguments with real and imaginary parts of quite disparate magnitudes.

Summary statistics for the tests are:

T est on 60 Significant Bits

903 results correct to 60 bits * 1329 results in error by 1 multiple of last bit 967 results in error by 2 multiples of last bit 657 results in error by 3 multiples of last bit 404 results in error by 4 multiples of last bit 333 results in error by 5 multipJes of last bit 247 results in error by 6 multiples of last bit 208 results in error by 7 multiples of last bit

1422 results in error by more than 7 multiples of last bit

6470 (Total)

Test on 60 Binary Places

320 results correct to 60 places ** 479 results in error by 1 multiple of last place 279 results in error by 2 multiples of last place 160 results in error by 3 multiples of last place

82 results in error by 4 multiples of last place 59 results in error by 5 multiples of last place 45 results in error by 6 multiples of last place

*Exduding 202 result s for pure real or imaginary argument. for which test and check values arc both zero. ** Excluding 370 result s for pure real or imaginary argument.

134

Page 3: Certification of an algorithm for Bessel functions of complex … › ... › 77B › jresv77Bn3-4p133_A1b.pdf · 2011-05-16 · Certification of an Algorithm for Bessel Functions

--------~

26 results in error by 7 multiples of last place 88 results in error by more than 7 multiples of last place

1538 (Total)

In the first test, the maximum error was (6651 )~ . This occ urred in the real part of }II (Z) at n=lO and z= (.1216 . . . )-i(.01928 . .. ), for which }1I(z) =- 2- 7 1 'p - i ' 2 -6L q, with t ~ p, q < 1. It is appropriate to assess this error relative to 1}II(z) I· This can be done fa irl y s imply by dividing the bit error by 29 , since 9 is the differe nce between the bin a ry expone nts of Re } II(Z) and 1m },,(z). This "relative error" is 7. On a pplying this techniqu e to all the bi t erro rs , the maxi­mum relative error was found to be (34)8. Allowing for the fac t that one manti ssa can be no more than twice the other, we see that the relative error is bounded by (70)~ , showing that BESLCI yielded values correct to 54 bits out of 60.

In the test on 60 binary places, the maximum error was found to be (77)~, showing that at least 54 binary places are correct. (Indeed, the first 57 places were correct in 94% of the cases. )

The test on the two-term ascending series used only the argument set Cj k (see above), where j and k each take the values -16 and -100. The rela tive error was bounded by (60)8, in comparison with (70)s for the test described above.

3. Testing of Error Return

The following argume nts z= x + iy were used:

j , k =-9 (3) 12

) =- 9 (3) 12

k =- 9 (3) 12;

the values of NB are described in section 1. Afte r th e } 's were calculated us ing x + iy as the argu­ment , the l's we re calculated using y+ ix. Thi s showed th at BESLCl gave results in acco rd (to 60 bits) with the equations

}II(Z) = }I/(Z) , II/(z) = ( - i) I/},,( iz) .

In the tes t on Bessel fun c tion values of orde r NCALC-I , the larges t error was 5 multiples of the last bit; mos t were ze ro.

In the test on order [ I z I] , the errors were large r, owing to the greater number of back-recursion ste ps. To calc ulate } ~o!H ; (4096 + i . 2- 9), for exam pIe, th e subroutin e call with NB = 5600 in volved approximately 900 more steps th an th e call with NB = 4097. Bearin g in mind that each ste p in cludes 2 multi plications and 3 ad ditions for both th e real and imagin ary parts of the fun ction value and also that th e computer uses trun cation in fl oatin g-point arithm eti c rather than roundoff, we see that the error of (2 234)H = 1180 in the last bit in the real part of.} 4 0!)f; (4096 + i . 2- 9 ) is to .be expected. The imaginary part of j .1o,,,;(4096 + i ,2 - 9 ) was a bout 2- 15 tim es the s ize of the real part , a nd th e bit error , (72461407)H, was a bout 214 times as big, which, agai n, is to be expected.

Th e errors me ntioned in the preceding paragraphs we re the worst cases. F or a ll othe r a rgu­ments, the errors were within the expected tolera nce, based on th e numbe r of recursion ste ps, and th e relative sizes of x and y.

4. Summary and Conclusions

For n = 0(1 ) 10 a nd the valu es of z tested , BESLCI yi elded j 1/ (z) and I I/ (z) on the UNIVAC 1108 with either a relative e rror or a n abso lute error bounded by 10 - 16• The latter assess ment a pplied

135

Page 4: Certification of an algorithm for Bessel functions of complex … › ... › 77B › jresv77Bn3-4p133_A1b.pdf · 2011-05-16 · Certification of an Algorithm for Bessel Functions

when n < I z I and the magnitude of the real or imaginary part of the Bessel function value being tested is less than t; the former applies in aU other cases.

The error return feature was tested and foun d to be executed accurately in aU cases. This test also confirmed th e error bounds described above for values of z in the square IRe z I < 64 and 11m zl < 64.

For other values of nand z, si milar accuracy may be ex pected since the tes ts we have used include large and small values of Iz l and Izl/n .

Calculations were performed on a UNIV kC ll08 under EXEC 2. All were carried out with double-precision mantissa of 60 bits, corresponding to just over 18 figures. Subroutine executions took approximately O.SN milliseconds , where

N= max (Izl, NB)+10.

S. References and Note

[1) Algorithm BESLCI , see previous paper. [21 Maximon , Leonard C .. FORTRAN Program for Arbitrary, Precision Arithmetic , unpubli shed data . (3) A lin ear congruenti a l generator X ,,+1 = aXn (mod 2mt) with Xo= a = 51". The 60 bits generated were used as the mantissa,

and the romple ment of the leftmos t bit taken for the s ign bit.

(paper 77B3&4-388)

136