dbsk1e.cpp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /* dbsk1e.f -- translated by f2c (version 20100827).
  2. This file no longer depends on f2c.
  3. */
  4. #include "slatec-internal.hpp"
  5. /* Table of constant values */
  6. static integer const c__3 = 3;
  7. static integer const c__16 = 16;
  8. static integer const c__38 = 38;
  9. static integer const c__33 = 33;
  10. static integer const c__2 = 2;
  11. static integer const c__1 = 1;
  12. /* Initialized data */
  13. static double const bk1cs[16] = { .025300227338947770532531120868533,
  14. -.35315596077654487566723831691801,
  15. -.12261118082265714823479067930042,
  16. -.0069757238596398643501812920296083,
  17. -1.7302889575130520630176507368979e-4,
  18. -2.4334061415659682349600735030164e-6,
  19. -2.2133876307347258558315252545126e-8,
  20. -1.4114883926335277610958330212608e-10,
  21. -6.6669016941993290060853751264373e-13,
  22. -2.4274498505193659339263196864853e-15,
  23. -7.023863479386287597178379712e-18,
  24. -1.6543275155100994675491029333333e-20,
  25. -3.2338347459944491991893333333333e-23,
  26. -5.3312750529265274999466666666666e-26,
  27. -7.5130407162157226666666666666666e-29,
  28. -9.1550857176541866666666666666666e-32 };
  29. static double const ak1cs[38] = { .27443134069738829695257666227266,
  30. .07571989953199367817089237814929,
  31. -.0014410515564754061229853116175625,
  32. 6.6501169551257479394251385477036e-5,
  33. -4.3699847095201407660580845089167e-6,
  34. 3.5402774997630526799417139008534e-7,
  35. -3.3111637792932920208982688245704e-8,
  36. 3.4459775819010534532311499770992e-9,
  37. -3.8989323474754271048981937492758e-10,
  38. 4.7208197504658356400947449339005e-11,
  39. -6.047835662875356234537359156289e-12,
  40. 8.1284948748658747888193837985663e-13,
  41. -1.1386945747147891428923915951042e-13,
  42. 1.654035840846228232597294820509e-14,
  43. -2.4809025677068848221516010440533e-15,
  44. 3.8292378907024096948429227299157e-16,
  45. -6.0647341040012418187768210377386e-17,
  46. 9.8324256232648616038194004650666e-18,
  47. -1.6284168738284380035666620115626e-18,
  48. 2.7501536496752623718284120337066e-19,
  49. -4.7289666463953250924281069568e-20,
  50. 8.2681500028109932722392050346666e-21,
  51. -1.4681405136624956337193964885333e-21,
  52. 2.6447639269208245978085894826666e-22,
  53. -4.82901575648563878979698688e-23,
  54. 8.9293020743610130180656332799999e-24,
  55. -1.6708397168972517176997751466666e-24,
  56. 3.1616456034040694931368618666666e-25,
  57. -6.0462055312274989106506410666666e-26,
  58. 1.1678798942042732700718421333333e-26,
  59. -2.277374158265399623286784e-27,
  60. 4.4811097300773675795305813333333e-28,
  61. -8.8932884769020194062336e-29,1.7794680018850275131392e-29,
  62. -3.5884555967329095821994666666666e-30,
  63. 7.2906290492694257991679999999999e-31,
  64. -1.4918449845546227073024e-31,
  65. 3.0736573872934276300799999999999e-32 };
  66. static double const ak12cs[33] = { .06379308343739001036600488534102,
  67. .02832887813049720935835030284708,
  68. -2.475370673905250345414545566732e-4,
  69. 5.771972451607248820470976625763e-6,
  70. -2.068939219536548302745533196552e-7,
  71. 9.739983441381804180309213097887e-9,
  72. -5.585336140380624984688895511129e-10,
  73. 3.732996634046185240221212854731e-11,
  74. -2.825051961023225445135065754928e-12,
  75. 2.372019002484144173643496955486e-13,
  76. -2.176677387991753979268301667938e-14,
  77. 2.157914161616032453939562689706e-15,
  78. -2.290196930718269275991551338154e-16,
  79. 2.582885729823274961919939565226e-17,
  80. -3.07675264126846318762109817344e-18,
  81. 3.851487721280491597094896844799e-19,
  82. -5.0447948976415289771172825088e-20,
  83. 6.888673850418544237018292223999e-21,
  84. -9.77504154195011830300213248e-22,
  85. 1.437416218523836461001659733333e-22,
  86. -2.185059497344347373499733333333e-23,
  87. 3.4262456218092206316453888e-24,-5.531064394246408232501248e-25,
  88. 9.176601505685995403782826666666e-26,
  89. -1.562287203618024911448746666666e-26,
  90. 2.725419375484333132349439999999e-27,
  91. -4.865674910074827992378026666666e-28,
  92. 8.879388552723502587357866666666e-29,
  93. -1.654585918039257548936533333333e-29,
  94. 3.145111321357848674303999999999e-30,-6.092998312193127612416e-31,
  95. 1.202021939369815834623999999999e-31,
  96. -2.412930801459408841386666666666e-32 };
  97. static float const eta = (float) d1mach_(3) * (float).1;
  98. static integer const ntk1 = initds_(bk1cs, &c__16, &eta);
  99. static integer const ntak1 = initds_(ak1cs, &c__38, &eta);
  100. static integer const ntak12 = initds_(ak12cs, &c__33, &eta);
  101. static double const xmin = exp(max(+log(d1mach_(1)), -log(d1mach_(2))) + .01);
  102. static double const xsml = sqrt(d1mach_(3) * 4.);
  103. double dbsk1e_(double const *x)
  104. {
  105. /* System generated locals */
  106. double d__1;
  107. /* Local variables */
  108. double y;
  109. /* ***BEGIN PROLOGUE DBSK1E */
  110. /* ***PURPOSE Compute the exponentially scaled modified (hyperbolic) */
  111. /* Bessel function of the third kind of order one. */
  112. /* ***LIBRARY SLATEC (FNLIB) */
  113. /* ***CATEGORY C10B1 */
  114. /* ***TYPE DOUBLE PRECISION (BESK1E-S, DBSK1E-D) */
  115. /* ***KEYWORDS EXPONENTIALLY SCALED, FNLIB, HYPERBOLIC BESSEL FUNCTION, */
  116. /* MODIFIED BESSEL FUNCTION, ORDER ONE, SPECIAL FUNCTIONS, */
  117. /* THIRD KIND */
  118. /* ***AUTHOR Fullerton, W., (LANL) */
  119. /* ***DESCRIPTION */
  120. /* DBSK1E(S) computes the double precision exponentially scaled */
  121. /* modified (hyperbolic) Bessel function of the third kind of order */
  122. /* one for positive double precision argument X. */
  123. /* Series for BK1 on the interval 0. to 4.00000E+00 */
  124. /* with weighted error 9.16E-32 */
  125. /* log weighted error 31.04 */
  126. /* significant figures required 30.61 */
  127. /* decimal places required 31.64 */
  128. /* Series for AK1 on the interval 1.25000E-01 to 5.00000E-01 */
  129. /* with weighted error 3.07E-32 */
  130. /* log weighted error 31.51 */
  131. /* significant figures required 30.71 */
  132. /* decimal places required 32.30 */
  133. /* Series for AK12 on the interval 0. to 1.25000E-01 */
  134. /* with weighted error 2.41E-32 */
  135. /* log weighted error 31.62 */
  136. /* significant figures required 30.25 */
  137. /* decimal places required 32.38 */
  138. /* ***REFERENCES (NONE) */
  139. /* ***ROUTINES CALLED D1MACH, DBESI1, DCSEVL, INITDS, XERMSG */
  140. /* ***REVISION HISTORY (YYMMDD) */
  141. /* 770701 DATE WRITTEN */
  142. /* 890531 Changed all specific intrinsics to generic. (WRB) */
  143. /* 890531 REVISION DATE from Version 3.2 */
  144. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  145. /* 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) */
  146. /* ***END PROLOGUE DBSK1E */
  147. /* ***FIRST EXECUTABLE STATEMENT DBSK1E */
  148. if (*x <= 0.) {
  149. xermsg_("SLATEC", "DBSK1E", "X IS ZERO OR NEGATIVE", &c__2, &c__2, (
  150. ftnlen)6, (ftnlen)6, (ftnlen)21);
  151. }
  152. if (*x > 2.) {
  153. goto L20;
  154. }
  155. if (*x < xmin) {
  156. xermsg_("SLATEC", "DBSK1E", "X SO SMALL K1 OVERFLOWS", &c__3, &c__2, (
  157. ftnlen)6, (ftnlen)6, (ftnlen)23);
  158. }
  159. y = 0.;
  160. if (*x > xsml) {
  161. y = *x * *x;
  162. }
  163. d__1 = y * .5 - 1.;
  164. return exp(*x) * (log(*x * .5) * dbesi1_(x) + (dcsevl_(&d__1, bk1cs, &ntk1) + .75) / *x);
  165. L20:
  166. if (*x <= 8.) {
  167. d__1 = (16. / *x - 5.) / 3.;
  168. return (dcsevl_(&d__1, ak1cs, &ntak1) + 1.25) / sqrt(*x);
  169. } else {
  170. d__1 = 16. / *x - 1.;
  171. return (dcsevl_(&d__1, ak12cs, &ntak12) + 1.25) / sqrt(*x);
  172. }
  173. } /* dbsk1e_ */