dyairy.cpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. /* dyairy.f -- translated by f2c (version 20100827).
  2. This file no longer depends on f2c.
  3. */
  4. #include "slatec-internal.hpp"
  5. int dyairy_(double *x, double *rx, double *c__, double *bi, double *dbi)
  6. {
  7. /* Initialized data */
  8. static integer n1 = 20;
  9. static integer n4d = 14;
  10. static integer m1d = 19;
  11. static integer m2d = 18;
  12. static integer m3d = 17;
  13. static integer m4d = 12;
  14. static double const fpi12 = 1.30899693899575;
  15. static double const spi12 = 1.83259571459405;
  16. static double const con1 = .666666666666667;
  17. static double const con2 = 7.74148278841779;
  18. static double const con3 = .364766105490356;
  19. static integer n2 = 19;
  20. static double const bk1[20] = { 2.43202846447449,2.57132009754685,
  21. 1.02802341258616,.341958178205872,.0841978629889284,
  22. .0193877282587962,.00392687837130335,6.83302689948043e-4,
  23. 1.14611403991141e-4,1.74195138337086e-5,2.41223620956355e-6,
  24. 3.24525591983273e-7,4.03509798540183e-8,4.70875059642296e-9,
  25. 5.35367432585889e-10,5.70606721846334e-11,5.80526363709933e-12,
  26. 5.76338988616388e-13,5.42103834518071e-14,4.91857330301677e-15 };
  27. static double const bk2[20] = { .574830555784088,-.00691648648376891,
  28. .00197460263052093,-5.24043043868823e-4,1.22965147239661e-4,
  29. -2.27059514462173e-5,2.23575555008526e-6,4.15174955023899e-7,
  30. -2.84985752198231e-7,8.50187174775435e-8,-1.70400826891326e-8,
  31. 2.25479746746889e-9,-1.09524166577443e-10,-3.41063845099711e-11,
  32. 1.11262893886662e-11,-1.75542944241734e-12,1.36298600401767e-13,
  33. 8.76342105755664e-15,-4.64063099157041e-15,7.7877275873296e-16 };
  34. static double const bk3[20] = { .566777053506912,.00263672828349579,
  35. 5.1230335147313e-5,2.10229231564492e-6,1.4221709511389e-7,
  36. 1.28534295891264e-8,7.28556219407507e-10,-3.45236157301011e-10,
  37. -2.11919115912724e-10,-6.56803892922376e-11,-8.14873160315074e-12,
  38. 3.03177845632183e-12,1.73447220554115e-12,1.67935548701554e-13,
  39. -1.49622868806719e-13,-5.15470458953407e-14,8.7574184185783e-15,
  40. 7.9673555352572e-15,-1.29566137861742e-16,-1.1187879441752e-15 };
  41. static double const bk4[14] = { .485444386705114,-.00308525088408463,
  42. 6.98748404837928e-5,-2.82757234179768e-6,1.59553313064138e-7,
  43. -1.12980692144601e-8,9.47671515498754e-10,-9.08301736026423e-11,
  44. 9.70776206450724e-12,-1.13687527254574e-12,1.43982917533415e-13,
  45. -1.95211019558815e-14,2.81056379909357e-15,-4.26916444775176e-16 }
  46. ;
  47. static double const bjp[19] = { .134918611457638,-.319314588205813,
  48. .0522061946276114,.0528869112170312,-.0085810075607735,
  49. -.00299211002025555,4.21126741969759e-4,8.73931830369273e-5,
  50. -1.06749163477533e-5,-1.56575097259349e-6,1.68051151983999e-7,
  51. 1.89901103638691e-8,-1.81374004961922e-9,-1.66339134593739e-10,
  52. 1.4295633578081e-11,1.10179811626595e-12,-8.60187724192263e-14,
  53. -5.71248177285064e-15,4.08414552853803e-16 };
  54. static double const bjn[19] = { .0659041673525697,-.424905910566004,
  55. .28720974519583,.129787771099606,-.0456354317590358,
  56. -.010263017598254,.00250704671521101,3.78127183743483e-4,
  57. -7.11287583284084e-5,-8.08651210688923e-6,1.23879531273285e-6,
  58. 1.13096815867279e-7,-1.4623428317631e-8,-1.11576315688077e-9,
  59. 1.24846618243897e-10,8.18334132555274e-12,-8.07174877048484e-13,
  60. -4.63778618766425e-14,4.09043399081631e-15 };
  61. static double const aa[14] = { -.278593552803079,.00352915691882584,
  62. 2.31149677384994e-5,-4.7131784226356e-6,1.12415907931333e-7,
  63. 2.00100301184339e-8,-2.60948075302193e-9,3.55098136101216e-11,
  64. 3.50849978423875e-11,-5.83007187954202e-12,2.04644828753326e-13,
  65. 1.10529179476742e-13,-2.87724778038775e-14,2.88205111009939e-15 };
  66. static double const bb[14] = { -.490275424742791,-.00157647277946204,
  67. 9.66195963140306e-5,-1.35916080268815e-7,-2.98157342654859e-7,
  68. 1.86824767559979e-8,1.03685737667141e-9,-3.28660818434328e-10,
  69. 2.5709141063278e-11,2.32357655300677e-12,-9.57523279048255e-13,
  70. 1.20340828049719e-13,2.90907716770715e-15,-4.55656454580149e-15 };
  71. static double const dbk1[21] = { 2.95926143981893,3.86774568440103,
  72. 1.80441072356289,.578070764125328,.163011468174708,
  73. .0392044409961855,.00790964210433812,.00150640863167338,
  74. 2.56651976920042e-4,3.93826605867715e-5,5.81097771463818e-6,
  75. 7.86881233754659e-7,9.93272957325739e-8,1.21424205575107e-8,
  76. 1.38528332697707e-9,1.50190067586758e-10,1.58271945457594e-11,
  77. 1.57531847699042e-12,1.50774055398181e-13,1.40594335806564e-14,
  78. 1.24942698777218e-15 };
  79. static double const dbk2[20] = { .549756809432471,.00913556983276901,
  80. -.00253635048605507,6.60423795342054e-4,-1.55217243135416e-4,
  81. 3.00090325448633e-5,-3.76454339467348e-6,-1.33291331611616e-7,
  82. 2.42587371049013e-7,-8.07861075240228e-8,1.71092818861193e-8,
  83. -2.41087357570599e-9,1.53910848162371e-10,2.5646537319063e-11,
  84. -9.88581911653212e-12,1.60877986412631e-12,-1.20952524741739e-13,
  85. -1.0697827841082e-14,5.02478557067561e-15,-8.68986130935886e-16 };
  86. static integer n3 = 14;
  87. static double const dbk3[20] = { .560598509354302,-.00364870013248135,
  88. -5.98147152307417e-5,-2.33611595253625e-6,-1.64571516521436e-7,
  89. -2.06333012920569e-8,-4.2774543157311e-9,-1.08494137799276e-9,
  90. -2.37207188872763e-10,-2.22132920864966e-11,1.07238008032138e-11,
  91. 5.71954845245808e-12,7.51102737777835e-13,-3.81912369483793e-13,
  92. -1.75870057119257e-13,6.69641694419084e-15,2.26866724792055e-14,
  93. 2.69898141356743e-15,-2.67133612397359e-15,-6.54121403165269e-16 }
  94. ;
  95. static double const dbk4[14] = { .493072999188036,.00438335419803815,
  96. -8.37413882246205e-5,3.20268810484632e-6,-1.7566197954827e-7,
  97. 1.22269906524508e-8,-1.01381314366052e-9,9.63639784237475e-11,
  98. -1.02344993379648e-11,1.19264576554355e-12,-1.50443899103287e-13,
  99. 2.03299052379349e-14,-2.91890652008292e-15,4.42322081975475e-16 };
  100. static double const dbjp[19] = { .113140872390745,-.208301511416328,
  101. .0169396341953138,.0290895212478621,-.00341467131311549,
  102. -.00146455339197417,1.63313272898517e-4,3.91145328922162e-5,
  103. -3.96757190808119e-6,-6.51846913772395e-7,5.9870749526928e-8,
  104. 7.44108654536549e-9,-6.21241056522632e-10,-6.18768017313526e-11,
  105. 4.72323484752324e-12,3.91652459802532e-13,-2.74985937845226e-14,
  106. -1.9503649776275e-15,1.26669643809444e-16 };
  107. static double const dbjn[19] = { -.018809126006885,-.14779818082614,
  108. .546075900433171,.152146932663116,-.0958260412266886,
  109. -.016310273169613,.00575364806680105,7.12145408252655e-4,
  110. -1.75452116846724e-4,-1.71063171685128e-5,3.2443558063168e-6,
  111. 2.61190663932884e-7,-4.03026865912779e-8,-2.76435165853895e-9,
  112. 3.59687929062312e-10,2.14953308456051e-11,-2.41849311903901e-12,
  113. -1.28068004920751e-13,1.26939834401773e-14 };
  114. static double const daa[14] = { .277571356944231,-.0044421283341992,
  115. 8.42328522190089e-5,2.5804031841871e-6,-3.42389720217621e-7,
  116. 6.24286894709776e-9,2.36377836844577e-9,-3.16991042656673e-10,
  117. 4.40995691658191e-12,5.18674221093575e-12,-9.64874015137022e-13,
  118. 4.9019057660871e-14,1.77253430678112e-14,-5.55950610442662e-15 };
  119. static double const dbb[14] = { .491627321104601,.00311164930427489,
  120. 8.23140762854081e-5,-4.61769776172142e-6,-6.13158880534626e-8,
  121. 2.8729580465652e-8,-1.81959715372117e-9,-1.44752826642035e-10,
  122. 4.53724043420422e-11,-3.99655065847223e-12,-3.24089119830323e-13,
  123. 1.62098952568741e-13,-2.40765247974057e-14,1.69384811284491e-16 };
  124. static integer m1 = 18;
  125. static integer m2 = 17;
  126. static integer m3 = 12;
  127. static integer n1d = 21;
  128. static integer n2d = 20;
  129. static integer n3d = 19;
  130. /* System generated locals */
  131. integer i__1;
  132. /* Local variables */
  133. integer i__, j;
  134. double t, d1, d2, e1, e2, f1, f2, s1, s2, tc, ax, cv, ex, tt, rtrx,
  135. temp1, temp2;
  136. /* ***BEGIN PROLOGUE DYAIRY */
  137. /* ***SUBSIDIARY */
  138. /* ***PURPOSE Subsidiary to DBESJ and DBESY */
  139. /* ***LIBRARY SLATEC */
  140. /* ***TYPE DOUBLE PRECISION (YAIRY-S, DYAIRY-D) */
  141. /* ***AUTHOR Amos, D. E., (SNLA) */
  142. /* Daniel, S. L., (SNLA) */
  143. /* ***DESCRIPTION */
  144. /* DYAIRY computes the Airy function BI(X) */
  145. /* and its derivative DBI(X) for DASYJY */
  146. /* INPUT */
  147. /* X - Argument, computed by DASYJY, X unrestricted */
  148. /* RX - RX=SQRT(ABS(X)), computed by DASYJY */
  149. /* C - C=2.*(ABS(X)**1.5)/3., computed by DASYJY */
  150. /* OUTPUT */
  151. /* BI - Value of function BI(X) */
  152. /* DBI - Value of the derivative DBI(X) */
  153. /* ***SEE ALSO DBESJ, DBESY */
  154. /* ***ROUTINES CALLED (NONE) */
  155. /* ***REVISION HISTORY (YYMMDD) */
  156. /* 750101 DATE WRITTEN */
  157. /* 890531 Changed all specific intrinsics to generic. (WRB) */
  158. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  159. /* 900328 Added TYPE section. (WRB) */
  160. /* 910408 Updated the AUTHOR section. (WRB) */
  161. /* ***END PROLOGUE DYAIRY */
  162. /* ***FIRST EXECUTABLE STATEMENT DYAIRY */
  163. ax = abs(*x);
  164. *rx = sqrt(ax);
  165. *c__ = con1 * ax * *rx;
  166. if (*x < 0.) {
  167. goto L120;
  168. }
  169. if (*c__ > 8.) {
  170. goto L60;
  171. }
  172. if (*x > 2.5) {
  173. goto L30;
  174. }
  175. t = (*x + *x - 2.5) * .4;
  176. tt = t + t;
  177. j = n1;
  178. f1 = bk1[j - 1];
  179. f2 = 0.;
  180. i__1 = m1;
  181. for (i__ = 1; i__ <= i__1; ++i__) {
  182. --j;
  183. temp1 = f1;
  184. f1 = tt * f1 - f2 + bk1[j - 1];
  185. f2 = temp1;
  186. /* L10: */
  187. }
  188. *bi = t * f1 - f2 + bk1[0];
  189. j = n1d;
  190. f1 = dbk1[j - 1];
  191. f2 = 0.;
  192. i__1 = m1d;
  193. for (i__ = 1; i__ <= i__1; ++i__) {
  194. --j;
  195. temp1 = f1;
  196. f1 = tt * f1 - f2 + dbk1[j - 1];
  197. f2 = temp1;
  198. /* L20: */
  199. }
  200. *dbi = t * f1 - f2 + dbk1[0];
  201. return 0;
  202. L30:
  203. rtrx = sqrt(*rx);
  204. t = (*x + *x - con2) * con3;
  205. tt = t + t;
  206. j = n1;
  207. f1 = bk2[j - 1];
  208. f2 = 0.;
  209. i__1 = m1;
  210. for (i__ = 1; i__ <= i__1; ++i__) {
  211. --j;
  212. temp1 = f1;
  213. f1 = tt * f1 - f2 + bk2[j - 1];
  214. f2 = temp1;
  215. /* L40: */
  216. }
  217. *bi = (t * f1 - f2 + bk2[0]) / rtrx;
  218. ex = exp(*c__);
  219. *bi *= ex;
  220. j = n2d;
  221. f1 = dbk2[j - 1];
  222. f2 = 0.;
  223. i__1 = m2d;
  224. for (i__ = 1; i__ <= i__1; ++i__) {
  225. --j;
  226. temp1 = f1;
  227. f1 = tt * f1 - f2 + dbk2[j - 1];
  228. f2 = temp1;
  229. /* L50: */
  230. }
  231. *dbi = (t * f1 - f2 + dbk2[0]) * rtrx;
  232. *dbi *= ex;
  233. return 0;
  234. L60:
  235. rtrx = sqrt(*rx);
  236. t = 16. / *c__ - 1.;
  237. tt = t + t;
  238. j = n1;
  239. f1 = bk3[j - 1];
  240. f2 = 0.;
  241. i__1 = m1;
  242. for (i__ = 1; i__ <= i__1; ++i__) {
  243. --j;
  244. temp1 = f1;
  245. f1 = tt * f1 - f2 + bk3[j - 1];
  246. f2 = temp1;
  247. /* L70: */
  248. }
  249. s1 = t * f1 - f2 + bk3[0];
  250. j = n2d;
  251. f1 = dbk3[j - 1];
  252. f2 = 0.;
  253. i__1 = m2d;
  254. for (i__ = 1; i__ <= i__1; ++i__) {
  255. --j;
  256. temp1 = f1;
  257. f1 = tt * f1 - f2 + dbk3[j - 1];
  258. f2 = temp1;
  259. /* L80: */
  260. }
  261. d1 = t * f1 - f2 + dbk3[0];
  262. tc = *c__ + *c__;
  263. ex = exp(*c__);
  264. if (tc > 35.) {
  265. goto L110;
  266. }
  267. t = 10. / *c__ - 1.;
  268. tt = t + t;
  269. j = n3;
  270. f1 = bk4[j - 1];
  271. f2 = 0.;
  272. i__1 = m3;
  273. for (i__ = 1; i__ <= i__1; ++i__) {
  274. --j;
  275. temp1 = f1;
  276. f1 = tt * f1 - f2 + bk4[j - 1];
  277. f2 = temp1;
  278. /* L90: */
  279. }
  280. s2 = t * f1 - f2 + bk4[0];
  281. *bi = (s1 + exp(-tc) * s2) / rtrx;
  282. *bi *= ex;
  283. j = n4d;
  284. f1 = dbk4[j - 1];
  285. f2 = 0.;
  286. i__1 = m4d;
  287. for (i__ = 1; i__ <= i__1; ++i__) {
  288. --j;
  289. temp1 = f1;
  290. f1 = tt * f1 - f2 + dbk4[j - 1];
  291. f2 = temp1;
  292. /* L100: */
  293. }
  294. d2 = t * f1 - f2 + dbk4[0];
  295. *dbi = rtrx * (d1 + exp(-tc) * d2);
  296. *dbi *= ex;
  297. return 0;
  298. L110:
  299. *bi = ex * s1 / rtrx;
  300. *dbi = ex * rtrx * d1;
  301. return 0;
  302. L120:
  303. if (*c__ > 5.) {
  304. goto L150;
  305. }
  306. t = *c__ * .4 - 1.;
  307. tt = t + t;
  308. j = n2;
  309. f1 = bjp[j - 1];
  310. e1 = bjn[j - 1];
  311. f2 = 0.;
  312. e2 = 0.;
  313. i__1 = m2;
  314. for (i__ = 1; i__ <= i__1; ++i__) {
  315. --j;
  316. temp1 = f1;
  317. temp2 = e1;
  318. f1 = tt * f1 - f2 + bjp[j - 1];
  319. e1 = tt * e1 - e2 + bjn[j - 1];
  320. f2 = temp1;
  321. e2 = temp2;
  322. /* L130: */
  323. }
  324. *bi = t * e1 - e2 + bjn[0] - ax * (t * f1 - f2 + bjp[0]);
  325. j = n3d;
  326. f1 = dbjp[j - 1];
  327. e1 = dbjn[j - 1];
  328. f2 = 0.;
  329. e2 = 0.;
  330. i__1 = m3d;
  331. for (i__ = 1; i__ <= i__1; ++i__) {
  332. --j;
  333. temp1 = f1;
  334. temp2 = e1;
  335. f1 = tt * f1 - f2 + dbjp[j - 1];
  336. e1 = tt * e1 - e2 + dbjn[j - 1];
  337. f2 = temp1;
  338. e2 = temp2;
  339. /* L140: */
  340. }
  341. *dbi = *x * *x * (t * f1 - f2 + dbjp[0]) + (t * e1 - e2 + dbjn[0]);
  342. return 0;
  343. L150:
  344. rtrx = sqrt(*rx);
  345. t = 10. / *c__ - 1.;
  346. tt = t + t;
  347. j = n3;
  348. f1 = aa[j - 1];
  349. e1 = bb[j - 1];
  350. f2 = 0.;
  351. e2 = 0.;
  352. i__1 = m3;
  353. for (i__ = 1; i__ <= i__1; ++i__) {
  354. --j;
  355. temp1 = f1;
  356. temp2 = e1;
  357. f1 = tt * f1 - f2 + aa[j - 1];
  358. e1 = tt * e1 - e2 + bb[j - 1];
  359. f2 = temp1;
  360. e2 = temp2;
  361. /* L160: */
  362. }
  363. temp1 = t * f1 - f2 + aa[0];
  364. temp2 = t * e1 - e2 + bb[0];
  365. cv = *c__ - fpi12;
  366. *bi = (temp1 * cos(cv) + temp2 * sin(cv)) / rtrx;
  367. j = n4d;
  368. f1 = daa[j - 1];
  369. e1 = dbb[j - 1];
  370. f2 = 0.;
  371. e2 = 0.;
  372. i__1 = m4d;
  373. for (i__ = 1; i__ <= i__1; ++i__) {
  374. --j;
  375. temp1 = f1;
  376. temp2 = e1;
  377. f1 = tt * f1 - f2 + daa[j - 1];
  378. e1 = tt * e1 - e2 + dbb[j - 1];
  379. f2 = temp1;
  380. e2 = temp2;
  381. /* L170: */
  382. }
  383. temp1 = t * f1 - f2 + daa[0];
  384. temp2 = t * e1 - e2 + dbb[0];
  385. cv = *c__ - spi12;
  386. *dbi = (temp1 * cos(cv) - temp2 * sin(cv)) * rtrx;
  387. return 0;
  388. } /* dyairy_ */