dbesj1.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* dbesj1.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. integer const c__3 = 3;
  7. integer const c__19 = 19;
  8. integer const c__1 = 1;
  9. /* Initialized data */
  10. double const bj1cs[19] = { -.117261415133327865606240574524003,
  11. -.253615218307906395623030884554698,
  12. .0501270809844695685053656363203743,
  13. -.00463151480962508191842619728789772,
  14. 2.47996229415914024539124064592364e-4,
  15. -8.67894868627882584521246435176416e-6,
  16. 2.14293917143793691502766250991292e-7,
  17. -3.93609307918317979229322764073061e-9,
  18. 5.59118231794688004018248059864032e-11,
  19. -6.3276164046613930247769527401488e-13,
  20. 5.84099161085724700326945563268266e-15,
  21. -4.48253381870125819039135059199999e-17,
  22. 2.90538449262502466306018688e-19,
  23. -1.61173219784144165412118186666666e-21,
  24. 7.73947881939274637298346666666666e-24,
  25. -3.24869378211199841143466666666666e-26,
  26. 1.2022376772274102272e-28,
  27. -3.95201221265134933333333333333333e-31,
  28. 1.16167808226645333333333333333333e-33 };
  29. float const r__1 = (float) d1mach_(3) * (float).1;
  30. integer const ntj1 = initds_(bj1cs, &c__19, &r__1);
  31. double const xsml = sqrt(d1mach_(3) * 8.);
  32. double const xmin = d1mach_(1) * 2.;
  33. double dbesj1_(double const *x)
  34. {
  35. /* System generated locals */
  36. double ret_val, d__1;
  37. /* Local variables */
  38. double y;
  39. double ampl;
  40. double theta;
  41. /* ***BEGIN PROLOGUE DBESJ1 */
  42. /* ***PURPOSE Compute the Bessel function of the first kind of order one. */
  43. /* ***LIBRARY SLATEC (FNLIB) */
  44. /* ***CATEGORY C10A1 */
  45. /* ***TYPE DOUBLE PRECISION (BESJ1-S, DBESJ1-D) */
  46. /* ***KEYWORDS BESSEL FUNCTION, FIRST KIND, FNLIB, ORDER ONE, */
  47. /* SPECIAL FUNCTIONS */
  48. /* ***AUTHOR Fullerton, W., (LANL) */
  49. /* ***DESCRIPTION */
  50. /* DBESJ1(X) calculates the double precision Bessel function of the */
  51. /* first kind of order one for double precision argument X. */
  52. /* Series for BJ1 on the interval 0. to 1.60000E+01 */
  53. /* with weighted error 1.16E-33 */
  54. /* log weighted error 32.93 */
  55. /* significant figures required 32.36 */
  56. /* decimal places required 33.57 */
  57. /* ***REFERENCES (NONE) */
  58. /* ***ROUTINES CALLED D1MACH, D9B1MP, DCSEVL, INITDS, XERMSG */
  59. /* ***REVISION HISTORY (YYMMDD) */
  60. /* 780601 DATE WRITTEN */
  61. /* 890531 Changed all specific intrinsics to generic. (WRB) */
  62. /* 890531 REVISION DATE from Version 3.2 */
  63. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  64. /* 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) */
  65. /* 910401 Corrected error in code which caused values to have the */
  66. /* wrong sign for arguments less than 4.0. (WRB) */
  67. /* ***END PROLOGUE DBESJ1 */
  68. /* ***FIRST EXECUTABLE STATEMENT DBESJ1 */
  69. y = abs(*x);
  70. if (y > 4.) {
  71. goto L20;
  72. }
  73. ret_val = 0.;
  74. if (y == 0.) {
  75. return ret_val;
  76. }
  77. if (y <= xmin) {
  78. xermsg_("SLATEC", "DBESJ1", "ABS(X) SO SMALL J1 UNDERFLOWS", &c__1, &
  79. c__1, (ftnlen)6, (ftnlen)6, (ftnlen)29);
  80. }
  81. if (y > xmin) {
  82. ret_val = *x * .5;
  83. }
  84. if (y > xsml) {
  85. d__1 = y * .125 * y - 1.;
  86. ret_val = *x * (dcsevl_(&d__1, bj1cs, &ntj1) + .25);
  87. }
  88. return ret_val;
  89. L20:
  90. d9b1mp_(&y, &ampl, &theta);
  91. ret_val = f2c::d_sign(&ampl, x) * cos(theta);
  92. return ret_val;
  93. } /* dbesj1_ */