dbesy1.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* dbesy1.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__20 = 20;
  8. static integer const c__2 = 2;
  9. static integer const c__1 = 1;
  10. /* Initialized data */
  11. static double const by1cs[20] = { .0320804710061190862932352018628015,
  12. 1.26270789743350044953431725999727,
  13. .00649996189992317500097490637314144,
  14. -.0893616452886050411653144160009712,
  15. .0132508812217570954512375510370043,
  16. -8.97905911964835237753039508298105e-4,
  17. 3.64736148795830678242287368165349e-5,
  18. -1.00137438166600055549075523845295e-6,
  19. 1.99453965739017397031159372421243e-8,
  20. -3.02306560180338167284799332520743e-10,
  21. 3.60987815694781196116252914242474e-12,
  22. -3.48748829728758242414552947409066e-14,
  23. 2.78387897155917665813507698517333e-16,
  24. -1.86787096861948768766825352533333e-18,
  25. 1.06853153391168259757070336e-20,
  26. -5.27472195668448228943872e-23,
  27. 2.27019940315566414370133333333333e-25,
  28. -8.59539035394523108693333333333333e-28,
  29. 2.88540437983379456e-30,
  30. -8.64754113893717333333333333333333e-33 };
  31. static double const twodpi = .636619772367581343075535053490057;
  32. static float const r__1 = (float) d1mach_(3) * (float).1;
  33. static integer const nty1 = initds_(by1cs, &c__20, &r__1);
  34. static double const xmin = exp(max(+log(d1mach_(1)), -log(d1mach_(2))) + .01) * 1.571;
  35. static double const xsml = sqrt(d1mach_(3) * 4.);
  36. double dbesy1_(double const *x)
  37. {
  38. /* System generated locals */
  39. double ret_val, d__1;
  40. /* Local variables */
  41. double y;
  42. double ampl;
  43. double theta;
  44. /* ***BEGIN PROLOGUE DBESY1 */
  45. /* ***PURPOSE Compute the Bessel function of the second kind of order */
  46. /* one. */
  47. /* ***LIBRARY SLATEC (FNLIB) */
  48. /* ***CATEGORY C10A1 */
  49. /* ***TYPE DOUBLE PRECISION (BESY1-S, DBESY1-D) */
  50. /* ***KEYWORDS BESSEL FUNCTION, FNLIB, ORDER ONE, SECOND KIND, */
  51. /* SPECIAL FUNCTIONS */
  52. /* ***AUTHOR Fullerton, W., (LANL) */
  53. /* ***DESCRIPTION */
  54. /* DBESY1(X) calculates the double precision Bessel function of the */
  55. /* second kind of order for double precision argument X. */
  56. /* Series for BY1 on the interval 0. to 1.60000E+01 */
  57. /* with weighted error 8.65E-33 */
  58. /* log weighted error 32.06 */
  59. /* significant figures required 32.17 */
  60. /* decimal places required 32.71 */
  61. /* ***REFERENCES (NONE) */
  62. /* ***ROUTINES CALLED D1MACH, D9B1MP, DBESJ1, DCSEVL, INITDS, XERMSG */
  63. /* ***REVISION HISTORY (YYMMDD) */
  64. /* 770701 DATE WRITTEN */
  65. /* 890531 Changed all specific intrinsics to generic. (WRB) */
  66. /* 890531 REVISION DATE from Version 3.2 */
  67. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  68. /* 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) */
  69. /* ***END PROLOGUE DBESY1 */
  70. /* ***FIRST EXECUTABLE STATEMENT DBESY1 */
  71. if (*x <= 0.) {
  72. xermsg_("SLATEC", "DBESY1", "X IS ZERO OR NEGATIVE", &c__1, &c__2, (
  73. ftnlen)6, (ftnlen)6, (ftnlen)21);
  74. }
  75. if (*x > 4.) {
  76. goto L20;
  77. }
  78. if (*x < xmin) {
  79. xermsg_("SLATEC", "DBESY1", "X SO SMALL Y1 OVERFLOWS", &c__3, &c__2, (
  80. ftnlen)6, (ftnlen)6, (ftnlen)23);
  81. }
  82. y = 0.;
  83. if (*x > xsml) {
  84. y = *x * *x;
  85. }
  86. d__1 = y * .125 - 1.;
  87. ret_val = twodpi * log(*x * .5) * dbesj1_(x) + (dcsevl_(&d__1, by1cs, &
  88. nty1) + .5) / *x;
  89. return ret_val;
  90. L20:
  91. d9b1mp_(x, &ampl, &theta);
  92. ret_val = ampl * sin(theta);
  93. return ret_val;
  94. } /* dbesy1_ */