7 inline double polevl(
double x,
const double coef[],
int N);
8 inline double p1evl(
double x,
const double coef[],
int N);
9 inline double chbevl(
double,
const double[],
int);
97 valarray<double> x(n);
98 valarray<double> y(n);
100 for(
long i=0; i < n; i++ )
115 for(
long i=0; i < n; i++ )
120 double rn = (double)n;
125 for(
long i=0; i < n; i++ )
133 if(
pow2(sxx) == 0.0 )
146 for(
long i=0; i < n; i++ )
147 sum1 +=
pow2(x[i]*(y[i] - b*x[i]));
150 sigb = sum1/
pow2(sxx);
153 for(
long i=0; i < n; i++ )
154 siga +=
pow2((y[i] - b*x[i])*(1.0 - rn*xavg*x[i]/sxx));
158 siga = sqrt(siga)/rn;
161 for(
long i=0; i < n; i++ )
183 1.00000000000000000000e+00,
184 1.00000000000000000000e+00,
185 2.00000000000000000000e+00,
186 6.00000000000000000000e+00,
187 2.40000000000000000000e+01,
188 1.20000000000000000000e+02,
189 7.20000000000000000000e+02,
190 5.04000000000000000000e+03,
191 4.03200000000000000000e+04,
192 3.62880000000000000000e+05,
193 3.62880000000000000000e+06,
194 3.99168000000000000000e+07,
195 4.79001600000000000000e+08,
196 6.22702080000000000000e+09,
197 8.71782912000000000000e+10,
198 1.30767436800000000000e+12,
199 2.09227898880000000000e+13,
200 3.55687428096000000000e+14,
201 6.40237370572800000000e+15,
202 1.21645100408832000000e+17,
203 2.43290200817664000000e+18,
204 5.10909421717094400000e+19,
205 1.12400072777760768000e+21,
206 2.58520167388849766400e+22,
207 6.20448401733239439360e+23,
208 1.55112100433309859840e+25,
209 4.03291461126605635592e+26,
210 1.08888694504183521614e+28,
211 3.04888344611713860511e+29,
212 8.84176199373970195470e+30,
213 2.65252859812191058647e+32,
214 8.22283865417792281807e+33,
215 2.63130836933693530178e+35,
216 8.68331761881188649615e+36,
217 2.95232799039604140861e+38,
218 1.03331479663861449300e+40,
219 3.71993326789901217463e+41,
220 1.37637530912263450457e+43,
221 5.23022617466601111726e+44,
222 2.03978820811974433568e+46,
223 8.15915283247897734264e+47,
224 3.34525266131638071044e+49,
225 1.40500611775287989839e+51,
226 6.04152630633738356321e+52,
227 2.65827157478844876773e+54,
228 1.19622220865480194551e+56,
229 5.50262215981208894940e+57,
230 2.58623241511168180614e+59,
231 1.24139155925360726691e+61,
232 6.08281864034267560801e+62,
233 3.04140932017133780398e+64,
234 1.55111875328738227999e+66,
235 8.06581751709438785585e+67,
236 4.27488328406002556374e+69,
237 2.30843697339241380441e+71,
238 1.26964033536582759243e+73,
239 7.10998587804863451749e+74,
240 4.05269195048772167487e+76,
241 2.35056133128287857145e+78,
242 1.38683118545689835713e+80,
243 8.32098711274139014271e+81,
244 5.07580213877224798711e+83,
245 3.14699732603879375200e+85,
246 1.98260831540444006372e+87,
247 1.26886932185884164078e+89,
248 8.24765059208247066512e+90,
249 5.44344939077443063905e+92,
250 3.64711109181886852801e+94,
251 2.48003554243683059915e+96,
252 1.71122452428141311337e+98,
253 1.19785716699698917933e+100,
254 8.50478588567862317347e+101,
255 6.12344583768860868500e+103,
256 4.47011546151268434004e+105,
257 3.30788544151938641157e+107,
258 2.48091408113953980872e+109,
259 1.88549470166605025458e+111,
260 1.45183092028285869606e+113,
261 1.13242811782062978295e+115,
262 8.94618213078297528506e+116,
263 7.15694570462638022794e+118,
264 5.79712602074736798470e+120,
265 4.75364333701284174746e+122,
266 3.94552396972065865030e+124,
267 3.31424013456535326627e+126,
268 2.81710411438055027626e+128,
269 2.42270953836727323750e+130,
270 2.10775729837952771662e+132,
271 1.85482642257398439069e+134,
272 1.65079551609084610774e+136,
273 1.48571596448176149700e+138,
274 1.35200152767840296226e+140,
275 1.24384140546413072522e+142,
276 1.15677250708164157442e+144,
277 1.08736615665674307994e+146,
278 1.03299784882390592592e+148,
279 9.91677934870949688836e+149,
280 9.61927596824821198159e+151,
281 9.42689044888324774164e+153,
282 9.33262154439441526381e+155,
283 9.33262154439441526388e+157,
284 9.42594775983835941673e+159,
285 9.61446671503512660515e+161,
286 9.90290071648618040340e+163,
287 1.02990167451456276198e+166,
288 1.08139675824029090008e+168,
289 1.14628056373470835406e+170,
290 1.22652020319613793888e+172,
291 1.32464181945182897396e+174,
292 1.44385958320249358163e+176,
293 1.58824554152274293982e+178,
294 1.76295255109024466316e+180,
295 1.97450685722107402277e+182,
296 2.23119274865981364576e+184,
297 2.54355973347218755612e+186,
298 2.92509369349301568964e+188,
299 3.39310868445189820004e+190,
300 3.96993716080872089396e+192,
301 4.68452584975429065488e+194,
302 5.57458576120760587943e+196,
303 6.68950291344912705515e+198,
304 8.09429852527344373681e+200,
305 9.87504420083360135884e+202,
306 1.21463043670253296712e+205,
307 1.50614174151114087918e+207,
308 1.88267717688892609901e+209,
309 2.37217324288004688470e+211,
310 3.01266001845765954361e+213,
311 3.85620482362580421582e+215,
312 4.97450422247728743840e+217,
313 6.46685548922047366972e+219,
314 8.47158069087882050755e+221,
315 1.11824865119600430699e+224,
316 1.48727070609068572828e+226,
317 1.99294274616151887582e+228,
318 2.69047270731805048244e+230,
319 3.65904288195254865604e+232,
320 5.01288874827499165889e+234,
321 6.91778647261948848943e+236,
322 9.61572319694108900019e+238,
323 1.34620124757175246000e+241,
324 1.89814375907617096864e+243,
325 2.69536413788816277557e+245,
326 3.85437071718007276916e+247,
327 5.55029383273930478744e+249,
328 8.04792605747199194159e+251,
329 1.17499720439091082343e+254,
330 1.72724589045463891049e+256,
331 2.55632391787286558753e+258,
332 3.80892263763056972532e+260,
333 5.71338395644585458806e+262,
334 8.62720977423324042775e+264,
335 1.31133588568345254503e+267,
336 2.00634390509568239384e+269,
337 3.08976961384735088657e+271,
338 4.78914290146339387432e+273,
339 7.47106292628289444390e+275,
340 1.17295687942641442768e+278,
341 1.85327186949373479574e+280,
342 2.94670227249503832518e+282,
343 4.71472363599206132029e+284,
344 7.59070505394721872577e+286,
345 1.22969421873944943358e+289,
346 2.00440157654530257674e+291,
347 3.28721858553429622598e+293,
348 5.42391066613158877297e+295,
349 9.00369170577843736335e+297,
350 1.50361651486499903974e+300,
351 2.52607574497319838672e+302,
352 4.26906800900470527345e+304,
353 7.25741561530799896496e+306
371 1.00000000000000000e+000,
372 6.25000000000000000e-002,
373 7.81250000000000000e-003,
374 1.46484375000000000e-003,
375 3.66210937500000000e-004,
376 1.14440917968750000e-004,
377 4.29153442382812500e-005,
378 1.87754631042480469e-005,
379 9.38773155212402344e-006,
380 5.28059899806976318e-006,
381 3.30037437379360199e-006,
382 2.26900738198310137e-006,
383 1.70175553648732603e-006,
384 1.38267637339595240e-006,
385 1.20984182672145835e-006,
386 1.13422671255136720e-006,
387 1.13422671255136720e-006,
388 1.20511588208582765e-006,
389 1.35575536734655611e-006,
390 1.60995949872403538e-006,
391 2.01244937340504422e-006,
392 2.64133980259412054e-006,
393 3.63184222856691574e-006,
394 5.22077320356494170e-006,
395 7.83115980534741170e-006,
396 1.22361871958553314e-005,
397 1.98838041932649142e-005,
398 3.35539195761345408e-005,
399 5.87193592582354430e-005,
400 1.06428838655551734e-004,
401 1.99554072479159509e-004,
402 3.86636015428371569e-004,
403 7.73272030856743137e-004,
404 1.59487356364203269e-003,
405 3.38910632273931945e-003,
406 7.41367008099226132e-003,
407 1.66807576822325873e-002,
408 3.85742521401628569e-002,
409 9.16138488328867850e-002,
443 1.23128086310509392e+017,
444 5.61771893791699072e+017,
445 2.59819500878660813e+018,
446 1.21790391036872253e+019,
447 5.78504357425143235e+019,
448 2.78405222010850181e+020,
449 1.35722545730289454e+021,
450 6.70130069543304194e+021,
451 3.35065034771652076e+022,
452 1.69626673853148848e+023,
453 8.69336703497387857e+023,
454 4.50968414939269935e+024,
455 2.36758417843116729e+025,
456 1.25777909479155770e+026,
457 6.76056263450462257e+026,
458 3.67605593251188834e+027,
459 2.02183076288153845e+028,
460 1.12464336185285569e+029,
461 6.32611891042231308e+029,
462 3.59798013030269071e+030,
463 2.06883857492404700e+031,
464 1.20251242167460229e+032,
465 7.06476047733828837e+032,
466 4.19470153341960844e+033,
467 2.51682092005176529e+034,
468 1.52582268278138270e+035,
469 9.34566393203596895e+035,
470 5.78262955794725579e+036,
471 3.61414347371703511e+037,
472 2.28142806778387824e+038,
473 1.45441039321222244e+039,
474 9.36276690630368255e+039,
475 6.08579848909739317e+040,
476 3.99380525847016458e+041,
477 2.64589598373648418e+042,
478 1.76944293912377371e+043,
479 1.19437398390854730e+044,
480 8.13667276537697798e+044,
481 5.59396252619667246e+045,
482 3.88081150254894130e+046,
483 2.71656805178425881e+047,
484 1.91857618657263275e+048,
485 1.36698553293300096e+049,
486 9.82520851795594440e+049,
487 7.12327617551805990e+050,
488 5.20889570334758147e+051,
489 3.84156058121884122e+052,
490 2.85716068228151327e+053,
491 2.14287051171113493e+054,
492 1.62054582448154580e+055,
493 1.23566619116717877e+056,
494 9.49918384459768667e+056,
495 7.36186747956320756e+057,
496 5.75145896840875570e+058,
497 4.52927393762189499e+059,
498 3.59511118798737905e+060,
499 2.87608895038990324e+061,
500 2.31884671625185959e+062,
501 1.88406295695463606e+063,
502 1.54257654600660820e+064,
503 1.27262565045545178e+065,
504 1.05787007194109428e+066,
505 8.85966185250666444e+066,
506 7.47533968805249835e+067,
507 6.35403873484462330e+068,
508 5.44064566671070888e+069,
509 4.69255688753798633e+070,
510 4.07665879604862585e+071,
511 3.56707644654254751e+072,
512 3.14348611851561972e+073,
513 2.78984393018261231e+074,
514 2.49342301260070962e+075,
515 2.24408071134063849e+076,
516 2.03369814465245358e+077,
517 1.85574955699536371e+078,
518 1.70496990548949040e+079,
519 1.57709716257777866e+080,
520 1.46867173265055644e+081,
521 1.37687974935989664e+082,
522 1.29943026345840251e+083,
523 1.23445875028548248e+084,
524 1.18045117996049257e+085,
525 1.13618426071197409e+086,
526 1.10067850256472499e+087,
527 1.07316154000060691e+088,
528 1.05303976112559556e+089,
529 1.03987676411152556e+090,
530 1.03337753433582857e+091,
531 1.03337753433582857e+092,
532 1.03983614392542748e+093,
533 1.05283409572449530e+094,
534 1.07257473501932960e+095,
535 1.09938910339481284e+096,
536 1.13374501287590075e+097,
537 1.17626045085874706e+098,
538 1.22772184558381721e+099,
539 1.28910793786300799e+100,
540 1.36162025936780216e+101,
541 1.44672152557828969e+102,
542 1.54618363046179715e+103,
543 1.66214740274643181e+104,
544 1.79719687921957945e+105,
545 1.95445160615129251e+106,
546 2.13768144422797627e+107,
547 2.35144958865077380e+108,
548 2.60129110744491837e+109,
549 2.89393635703247155e+110,
550 3.23759129943007744e+111,
551 3.64229021185883726e+112,
552 4.12034080216530982e+113,
553 4.68688766246304013e+114,
554 5.36062776394210187e+115,
555 6.16472192853341706e+116,
556 7.12795972986676387e+117,
557 8.28625318597011219e+118,
558 9.68455841110256888e+119,
559 1.13793561330455178e+121,
560 1.34418644321600176e+122,
561 1.59622140131900197e+123,
562 1.90548929782455860e+124,
563 2.28658715738947042e+125,
564 2.75819575860104856e+126,
565 3.34431235730377152e+127,
566 4.07588068546397120e+128,
567 4.99295383969336454e+129,
568 6.14757441512245555e+130,
569 7.60762333871403831e+131,
570 9.46198152752558548e+132,
571 1.18274769094069828e+134,
572 1.48582678674425232e+135,
573 1.87585631826461846e+136,
574 2.37999270379823447e+137,
575 3.03449069734274889e+138,
576 3.88794120597039710e+139,
577 5.00572430268688588e+140,
578 6.47615581660115797e+141,
579 8.41900256158150577e+142,
580 1.09973220960658419e+144,
581 1.44339852510864179e+145,
582 1.90348180498702145e+146,
583 2.52211339160780346e+147,
584 3.35756345257788818e+148,
585 4.49074111782292584e+149,
586 6.03443337707455679e+150,
587 8.14648505905065221e+151,
588 1.10486703613374480e+153,
589 1.50538133673222729e+154,
590 2.06049070465223602e+155,
591 2.83317471889682437e+156,
592 3.91332258047623873e+157,
593 5.42973508041078113e+158,
594 7.56769326832252665e+159,
595 1.05947705756515379e+161,
596 1.48988961220099760e+162,
597 2.10446907723390916e+163,
598 2.98571550332560859e+164,
599 4.25464459223899213e+165,
600 6.08946007264205694e+166,
601 8.75359885442295723e+167,
602 1.26380083460731439e+169,
603 1.83251121018060591e+170,
604 2.66859444982550725e+171,
605 3.90281938286980469e+172,
606 5.73226596859002516e+173,
607 8.45509230367028708e+174,
608 1.25241054748116123e+176,
609 1.86296068937822735e+177,
610 2.78279752975872722e+178,
611 4.17419629463809079e+179,
612 6.28738316879862387e+180,
613 9.50966704280791803e+181,
614 1.44428068212645250e+183,
615 2.20252804024284002e+184,
616 3.37262106162184907e+185,
617 5.18540488224359247e+186,
618 8.00496878696354631e+187,
619 1.24077016197934964e+189,
620 1.93094856458036277e+190,
621 3.01710713215681661e+191,
622 4.73308681357100637e+192,
623 7.45461173137433533e+193,
624 1.17876048002356679e+195,
625 1.87128226203741209e+196,
626 2.98235610512212568e+197,
627 4.77176976819540109e+198,
628 7.66465519016386263e+199,
629 1.23592564941392296e+201,
630 2.00065464498878787e+202,
631 3.25106379810678013e+203,
632 5.30329782066168502e+204,
633 8.68415018133350951e+205,
634 1.42745718605669573e+207,
635 2.35530435699354811e+208,
636 3.90097284127056435e+209,
637 6.48536734861231298e+210,
638 1.08224567629967973e+212,
639 1.81276150780196369e+213,
640 3.04770528499205135e+214,
641 5.14300266842408688e+215,
642 8.71096076964329754e+216,
643 1.48086333083936058e+218,
644 2.52672305824465885e+219,
645 4.32701323724397813e+220,
646 7.43705400151308679e+221,
647 1.28289181526100749e+223,
648 2.22100645517061936e+224,
649 3.85899871585895109e+225,
650 6.72912901077904602e+226,
651 1.17759757688633299e+228,
652 2.06815574440662224e+229,
653 3.64512449951667173e+230,
654 6.44731395852011310e+231,
655 1.14439822763732000e+233,
656 2.03845934297897628e+234,
657 3.64374607557492029e+235,
658 6.53596952306251304e+236,
659 1.17647451415125240e+238,
660 2.12500709118569980e+239,
661 3.85157535277408106e+240,
662 7.00505267285786018e+241,
663 1.27842211279655955e+243,
664 2.34111049405869977e+244,
665 4.30179053283286084e+245,
666 7.93142629491058743e+246,
667 1.46731386455845874e+248,
668 2.72370136108663892e+249,
669 5.07289378502386487e+250,
670 9.47997026076334780e+251,
671 1.77749442389312786e+253,
672 3.34391138494894698e+254,
673 6.31163273909113711e+255,
674 1.19526544996538408e+257,
675 2.27100435493422958e+258,
676 4.32910205159337539e+259,
677 8.27940767367233019e+260,
678 1.58861134738587850e+262,
679 3.05807684371781629e+263,
680 5.90591090443003272e+264,
681 1.14427023773331886e+266,
682 2.22417527459413850e+267,
683 4.33714178545856976e+268,
684 8.48453361780332716e+269,
685 1.66508972249390287e+271,
686 3.27814539115987142e+272,
687 6.47433714754074587e+273,
688 1.28272804735651034e+275,
689 2.54942199412106407e+276,
690 5.08291010077887125e+277,
691 1.01658202015577428e+279,
692 2.03951767793752200e+280,
693 4.10452932684926289e+281,
694 8.28601857857694926e+282,
695 1.67791876216183238e+284,
696 3.40827248564122204e+285,
697 6.94435518949399006e+286,
698 1.41925259185283426e+288,
699 2.90946781329831038e+289,
700 5.98259319109465094e+290,
701 1.23390984566327173e+292,
702 2.55265099321589344e+293,
703 5.29675081092297942e+294,
704 1.10238626252334501e+296,
705 2.30123132301748272e+297,
706 4.81820308256785444e+298,
707 1.01182264733924947e+300,
708 2.13115145095829414e+301,
709 4.50205744014939638e+302,
710 9.53873420131653322e+303
717 if( n < 1 || n >= 2*
MXDSF+1 || (n%2) != 1 )
735 p_lf.push_back( 0. );
736 p_lf.push_back( 0. );
743 if( n <
p_lf.size() )
749 for(
unsigned long i=(
unsigned long)
p_lf.size(); i <= n; i++ )
750 p_lf.push_back(
p_lf[i-1] + log10(static_cast<double>(i)) );
791 double xr, xi, wr, wi, ur, ui, vr, vi, yr, yi, t;
807 ur = wr + 6.00009857740312429;
808 vr = ur * (wr + 4.99999857982434025) - wi * wi;
809 vi = wi * (wr + 4.99999857982434025) + ur * wi;
810 yr = ur * 13.2280130755055088 + vr * 66.2756400966213521 +
811 0.293729529320536228;
812 yi = wi * 13.2280130755055088 + vi * 66.2756400966213521;
813 ur = vr * (wr + 4.00000003016801681) - vi * wi;
814 ui = vi * (wr + 4.00000003016801681) + vr * wi;
815 vr = ur * (wr + 2.99999999944915534) - ui * wi;
816 vi = ui * (wr + 2.99999999944915534) + ur * wi;
817 yr += ur * 91.1395751189899762 + vr * 47.3821439163096063;
818 yi += ui * 91.1395751189899762 + vi * 47.3821439163096063;
819 ur = vr * (wr + 2.00000000000603851) - vi * wi;
820 ui = vi * (wr + 2.00000000000603851) + vr * wi;
821 vr = ur * (wr + 0.999999999999975753) - ui * wi;
822 vi = ui * (wr + 0.999999999999975753) + ur * wi;
823 yr += ur * 10.5400280458730808 + vr;
824 yi += ui * 10.5400280458730808 + vi;
825 ur = vr * wr - vi * wi;
826 ui = vi * wr + vr * wi;
827 t = ur * ur + ui * ui;
828 vr = yr * ur + yi * ui + t * 0.0327673720261526849;
829 vi = yi * ur - yr * ui;
830 yr = wr + 7.31790632447016203;
831 ur = log(yr * yr + wi * wi) * 0.5 - 1;
833 yr = exp(ur * (wr - 0.5) - ui * wi - 3.48064577727581257) / t;
834 yi = ui * (wr - 0.5) + ur * wi;
837 yr = ur * vr - ui * vi;
838 yi = ui * vr + ur * vi;
841 wr = xr * 3.14159265358979324;
842 wi = exp(xi * 3.14159265358979324);
844 ur = (vi + wi) * sin(wr);
845 ui = (vi - wi) * cos(wr);
846 vr = ur * yr + ui * yi;
847 vi = ui * yr - ur * yi;
848 ur = 6.2831853071795862 / (vr * vr + vi * vi);
852 return complex<double>( yr, yi );
974 7.96936729297347051624e-4,
975 8.28352392107440799803e-2,
976 1.23953371646414299388e0,
977 5.44725003058768775090e0,
978 8.74716500199817011941e0,
979 5.30324038235394892183e0,
980 9.99999999999999997821e-1,
984 9.24408810558863637013e-4,
985 8.56288474354474431428e-2,
986 1.25352743901058953537e0,
987 5.47097740330417105182e0,
988 8.76190883237069594232e0,
989 5.30605288235394617618e0,
990 1.00000000000000000218e0,
994 -1.13663838898469149931e-2,
995 -1.28252718670509318512e0,
996 -1.95539544257735972385e1,
997 -9.32060152123768231369e1,
998 -1.77681167980488050595e2,
999 -1.47077505154951170175e2,
1000 -5.14105326766599330220e1,
1001 -6.05014350600728481186e0,
1006 6.43178256118178023184e1,
1007 8.56430025976980587198e2,
1008 3.88240183605401609683e3,
1009 7.24046774195652478189e3,
1010 5.93072701187316984827e3,
1011 2.06209331660327847417e3,
1012 2.42005740240291393179e2,
1016 1.55924367855235737965e4,
1017 -1.46639295903971606143e7,
1018 5.43526477051876500413e9,
1019 -9.82136065717911466409e11,
1020 8.75906394395366999549e13,
1021 -3.46628303384729719441e15,
1022 4.42733268572569800351e16,
1023 -1.84950800436986690637e16,
1028 1.04128353664259848412e3,
1029 6.26107330137134956842e5,
1030 2.68919633393814121987e8,
1031 8.64002487103935000337e10,
1032 2.02979612750105546709e13,
1033 3.17157752842975028269e15,
1034 2.50596256172653059228e17,
1038 static const double DR1 = 5.78318596294678452118e0;
1040 static const double DR2 = 3.04712623436620863991e1;
1043 -4.79443220978201773821e9,
1044 1.95617491946556577543e12,
1045 -2.49248344360967716204e14,
1046 9.70862251047306323952e15,
1051 4.99563147152651017219e2,
1052 1.73785401676374683123e5,
1053 4.84409658339962045305e7,
1054 1.11855537045356834862e10,
1055 2.11277520115489217587e12,
1056 3.10518229857422583814e14,
1057 3.18121955943204943306e16,
1058 1.71086294081043136091e18,
1067 double w, z, p, q, xn;
1080 p = (z -
DR1) * (z -
DR2);
1090 p = p * cos(xn) - w * q * sin(xn);
1091 return p *
SQ2OPI / sqrt(x);
1105 double w, z, p, q, xn;
1127 p = p * sin(xn) + w * q * cos(xn);
1128 return p *
SQ2OPI / sqrt(x);
1210 -8.99971225705559398224e8,
1211 4.52228297998194034323e11,
1212 -7.27494245221818276015e13,
1213 3.68295732863852883286e15,
1218 6.20836478118054335476e2,
1219 2.56987256757748830383e5,
1220 8.35146791431949253037e7,
1221 2.21511595479792499675e10,
1222 4.74914122079991414898e12,
1223 7.84369607876235854894e14,
1224 8.95222336184627338078e16,
1225 5.32278620332680085395e18,
1229 7.62125616208173112003e-4,
1230 7.31397056940917570436e-2,
1231 1.12719608129684925192e0,
1232 5.11207951146807644818e0,
1233 8.42404590141772420927e0,
1234 5.21451598682361504063e0,
1235 1.00000000000000000254e0,
1239 5.71323128072548699714e-4,
1240 6.88455908754495404082e-2,
1241 1.10514232634061696926e0,
1242 5.07386386128601488557e0,
1243 8.39985554327604159757e0,
1244 5.20982848682361821619e0,
1245 9.99999999999999997461e-1,
1249 5.10862594750176621635e-2,
1250 4.98213872951233449420e0,
1251 7.58238284132545283818e1,
1252 3.66779609360150777800e2,
1253 7.10856304998926107277e2,
1254 5.97489612400613639965e2,
1255 2.11688757100572135698e2,
1256 2.52070205858023719784e1,
1261 7.42373277035675149943e1,
1262 1.05644886038262816351e3,
1263 4.98641058337653607651e3,
1264 9.56231892404756170795e3,
1265 7.99704160447350683650e3,
1266 2.82619278517639096600e3,
1267 3.36093607810698293419e2,
1271 1.26320474790178026440e9,
1272 -6.47355876379160291031e11,
1273 1.14509511541823727583e14,
1274 -8.12770255501325109621e15,
1275 2.02439475713594898196e17,
1276 -7.78877196265950026825e17,
1281 5.94301592346128195359E2,
1282 2.35564092943068577943E5,
1283 7.34811944459721705660E7,
1284 1.87601316108706159478E10,
1285 3.88231277496238566008E12,
1286 6.20557727146953693363E14,
1287 6.87141087355300489866E16,
1288 3.97270608116560655612E18,
1291 static const double Z1 = 1.46819706421238932572E1;
1292 static const double Z2 = 4.92184563216946036703E1;
1298 double w, z, p, q, xn;
1310 w = w * x * (z -
Z1) * (z -
Z2);
1319 p = p * cos(xn) - w * q * sin(xn);
1320 return p *
SQ2OPI / sqrt(x);
1325 double w, z, p, q, xn;
1347 p = p * sin(xn) + w * q * cos(xn);
1348 return p *
SQ2OPI / sqrt(x);
1401 double pkm2, pkm1, pk, xk, r, ans;
1424 if( x < DBL_EPSILON )
1438 if( n == 2 && x > 0.1 )
1453 ans = pk - (xk/ans);
1466 pkm2 = (pkm1 * r - pk * x) / x;
1473 if( fabs(pk) > fabs(pkm1) )
1536 double an, anm1, anm2, r;
1575 an = r * anm1 / x - anm2;
1646 1.37982864606273237150e-4,
1647 2.28025724005875567385e-3,
1648 7.97404013220415179367e-3,
1649 9.85821379021226008714e-3,
1650 6.87489687449949877925e-3,
1651 6.18901033637687613229e-3,
1652 8.79078273952743772254e-3,
1653 1.49380448916805252718e-2,
1654 3.08851465246711995998e-2,
1655 9.65735902811690126535e-2,
1656 1.38629436111989062502e0
1661 2.94078955048598507511e-5,
1662 9.14184723865917226571e-4,
1663 5.94058303753167793257e-3,
1664 1.54850516649762399335e-2,
1665 2.39089602715924892727e-2,
1666 3.01204715227604046988e-2,
1667 3.73774314173823228969e-2,
1668 4.88280347570998239232e-2,
1669 7.03124996963957469739e-2,
1670 1.24999999999870820058e-1,
1671 4.99999999999999999821e-1
1674 static const double C1 = 1.3862943611198906188e0;
1680 if( x < 0.0 || x > 1.0 )
1686 if( x > DBL_EPSILON )
1699 return C1 - 0.5 * log(x);
1753 static const double BIG = 1.44115188075855872E+17;
1758 double ans, r, t, yk, xk;
1759 double pk, pkm1, pkm2, qk, qkm1, qkm2;
1765 if( n < 0 || x < 0. )
1785 return 1.0/((double)n-1.0);
1798 yk = 1.0 / (xk * xk);
1800 ans = yk * t * (6.0 * x * x - 8.0 * t * x + t * t);
1801 ans = yk * (ans + t * (t - 2.0 * x));
1802 ans = yk * (ans + t);
1803 ans = (ans + 1.0) * exp( -x ) / xk;
1810 psi = -EULER - log(x);
1811 for( i=1; i < n; i++ )
1836 while( t > DBL_EPSILON );
1856 xk =
static_cast<double>(n + (k-1)/2);
1861 xk =
static_cast<double>(k/2);
1863 pk = pkm1 * yk + pkm2 * xk;
1864 qk = qkm1 * yk + qkm2 * xk;
1868 t = fabs( (ans - r)/r );
1877 if( fabs(pk) >
BIG )
1885 while( t > DBL_EPSILON );
1990 2.46196981473530512524e-10,
1991 5.64189564831068821977e-1,
1992 7.46321056442269912687e0,
1993 4.86371970985681366614e1,
1994 1.96520832956077098242e2,
1995 5.26445194995477358631e2,
1996 9.34528527171957607540e2,
1997 1.02755188689515710272e3,
1998 5.57535335369399327526e2
2002 1.32281951154744992508e1,
2003 8.67072140885989742329e1,
2004 3.54937778887819891062e2,
2005 9.75708501743205489753e2,
2006 1.82390916687909736289e3,
2007 2.24633760818710981792e3,
2008 1.65666309194161350182e3,
2009 5.57535340817727675546e2
2012 5.64189583547755073984e-1,
2013 1.27536670759978104416e0,
2014 5.01905042251180477414e0,
2015 6.16021097993053585195e0,
2016 7.40974269950448939160e0,
2017 2.97886665372100240670e0
2021 2.26052863220117276590e0,
2022 9.39603524938001434673e0,
2023 1.20489539808096656605e1,
2024 1.70814450747565897222e1,
2025 9.60896809063285878198e0,
2026 3.36907645100081516050e0
2037 const bool lgUSE_EXPXSQ =
true;
2039 double erfc(
double a)
2048 return 1.0 -
erf(a);
2053 return ( a < 0.0 ) ? 2.0 : 0.0;
2077 return ( a < 0. ) ? 2.0 : 0.0;
2111 static double erf_T[] = {
2112 9.60497373987051638749e0,
2113 9.00260197203842689217e1,
2114 2.23200534594684319226e3,
2115 7.00332514112805075473e3,
2116 5.55923013010394962768e4
2118 static double erf_U[] = {
2120 3.35617141647503099647e1,
2121 5.21357949780152679795e2,
2122 4.59432382970980127987e3,
2123 2.26290000613890934246e4,
2124 4.92673942608635921086e4
2127 double erf(
double x)
2134 return 1.0 -
erfc(x);
2136 y = x *
polevl( z, erf_T, 4 ) /
p1evl( z, erf_U, 5 );
2183 const double exp_M = 128.0;
2184 const double exp_MINV = .0078125;
2199 m = exp_MINV * floor(exp_M * x + 0.5);
2204 u1 = 2 * m * f + f * f;
2216 u = exp(u) * exp(u1);
2315 ASSERT( a > 0. && x > 0. );
2317 if( x < 1.0 || x < a )
2318 return 1.0 -
igam(a,x);
2320 double ax = a * log(x) - x - lgamma(a);
2333 ASSERT( a > 0. && x > 0. );
2335 if( x < 1.0 || x < a )
2336 return (1.0 -
igam(a,x))*exp(x);
2338 double ax = a * log(x) - lgamma(a);
2360 ASSERT( a > 0. && x > 0. );
2362 double ans, ax, c, r;
2364 if( x > 1.0 && x > a )
2365 return 1.0 -
igamc(a,x);
2368 ax = a * log(x) - x - lgamma(a);
2384 while( c/ans > DBL_EPSILON );
2391 double ans, c, yc, r, t, y, z;
2392 double pk, pkm1, pkm2, qk, qkm1, qkm2;
2410 pk = pkm1 * z - pkm2 * yc;
2411 qk = qkm1 * z - qkm2 * yc;
2415 t = fabs( (ans - r)/r );
2424 if( fabs(pk) > igam_big )
2432 while( t > DBL_EPSILON );
2488 inline double polevl(
double x,
const double coef[],
int N)
2492 const double *p = coef;
2498 ans = ans * x + *p++;
2510 inline double p1evl(
double x,
const double coef[],
int N)
2513 const double *p = coef;
2520 ans = ans * x + *p++;
2584 inline double chbevl(
double x,
const double array[],
int n)
2587 const double *p = array;
2598 b0 = x * b1 - b2 + *p++;
2638 inline double ratevl_5_4(
double x,
const double a[5],
const double b[4]);
2639 inline double ratevl_6_3(
double x,
const double a[6],
const double b[3]);
2640 inline double ratevl_6_4(
double x,
const double a[6],
const double b[4]);
2641 inline double ratevl_7_8(
double x,
const double a[7],
const double b[8]);
2642 inline double ratevl_8_7(
double x,
const double a[8],
const double b[7]);
2643 inline double ratevl_10_11(
double x,
const double a[10],
const double b[11]);
2644 inline double ratevl_11_10(
double x,
const double a[11],
const double b[10]);
2645 inline double ratevl_15_6(
double x,
const double a[15],
const double b[6]);
2648 2.4708152720399552679e+03, 5.9169059852270512312e+03, 4.6850901201934832188e+02,
2649 1.1999463724910714109e+01, 1.3166052564989571850e-01, 5.8599221412826100000e-04
2652 2.1312714303849120380e+04, -2.4994418972832303646e+02, 1.0
2655 -1.6128136304458193998e+06, -3.7333769444840079748e+05, -1.7984434409411765813e+04,
2656 -2.9501657892958843865e+02, -1.6414452837299064100e+00
2659 -1.6128136304458193998e+06, 2.9865713163054025489e+04, -2.5064972445877992730e+02, 1.0
2662 1.1600249425076035558e+02, 2.3444738764199315021e+03, 1.8321525870183537725e+04,
2663 7.1557062783764037541e+04, 1.5097646353289914539e+05, 1.7398867902565686251e+05,
2664 1.0577068948034021957e+05, 3.1075408980684392399e+04, 3.6832589957340267940e+03,
2665 1.1394980557384778174e+02
2668 9.2556599177304839811e+01, 1.8821890840982713696e+03, 1.4847228371802360957e+04,
2669 5.8824616785857027752e+04, 1.2689839587977598727e+05, 1.5144644673520157801e+05,
2670 9.7418829762268075784e+04, 3.1474655750295278825e+04, 4.4329628889746408858e+03,
2671 2.0013443064949242491e+02, 1.0
2675 -2.2149374878243304548e+06, 7.1938920065420586101e+05, 1.7733324035147015630e+05,
2676 7.1885382604084798576e+03, 9.9991373567429309922e+01, 4.8127070456878442310e-01
2679 -2.2149374878243304548e+06, 3.7264298672067697862e+04, -2.8143915754538725829e+02, 1.0
2682 0.0, -1.3531161492785421328e+06, -1.4758069205414222471e+05,
2683 -4.5051623763436087023e+03, -5.3103913335180275253e+01, -2.2795590826955002390e-01
2686 -2.7062322985570842656e+06, 4.3117653211351080007e+04, -3.0507151578787595807e+02, 1.0
2689 2.2196792496874548962e+00, 4.4137176114230414036e+01, 3.4122953486801312910e+02,
2690 1.3319486433183221990e+03, 2.8590657697910288226e+03, 3.4540675585544584407e+03,
2691 2.3123742209168871550e+03, 8.1094256146537402173e+02, 1.3182609918569941308e+02,
2692 7.5584584631176030810e+00, 6.4257745859173138767e-02
2695 1.7710478032601086579e+00, 3.4552228452758912848e+01, 2.5951223655579051357e+02,
2696 9.6929165726802648634e+02, 1.9448440788918006154e+03, 2.1181000487171943810e+03,
2697 1.2082692316002348638e+03, 3.3031020088765390854e+02, 3.6001069306861518855e+01, 1.0
2705 throw domain_error(
"bessel_k0" );
2709 double r1 =
ratevl_6_3(y, BESSEL_K0_P1, BESSEL_K0_Q1);
2710 double r2 =
ratevl_5_4(y, BESSEL_K0_P2, BESSEL_K0_Q2);
2711 double factor = log(x);
2712 return r1 - factor * r2;
2717 double r =
ratevl_10_11(y, BESSEL_K0_P3, BESSEL_K0_Q3);
2718 double factor = exp(-x) / sqrt(x);
2728 throw domain_error(
"bessel_k0_scaled" );
2732 double r1 =
ratevl_6_3(y, BESSEL_K0_P1, BESSEL_K0_Q1);
2733 double r2 =
ratevl_5_4(y, BESSEL_K0_P2, BESSEL_K0_Q2);
2734 double factor = log(x);
2735 return exp(x) * (r1 - factor * r2);
2740 double r =
ratevl_10_11(y, BESSEL_K0_P3, BESSEL_K0_Q3);
2741 double factor = 1. / sqrt(x);
2751 throw domain_error(
"bessel_k1" );
2755 double r1 =
ratevl_6_4(y, BESSEL_K1_P1, BESSEL_K1_Q1);
2756 double r2 =
ratevl_6_4(y, BESSEL_K1_P2, BESSEL_K1_Q2);
2757 double factor = log(x);
2758 return (r1 + factor * r2) / x;
2763 double r1 =
ratevl_11_10(y, BESSEL_K1_P3, BESSEL_K1_Q3);
2764 double factor = exp(-x) / sqrt(x);
2774 throw domain_error(
"bessel_k1_scaled" );
2778 double r1 =
ratevl_6_4(y, BESSEL_K1_P1, BESSEL_K1_Q1);
2779 double r2 =
ratevl_6_4(y, BESSEL_K1_P2, BESSEL_K1_Q2);
2780 double factor = log(x);
2781 return exp(x) * (r1 + factor * r2) / x;
2786 double r1 =
ratevl_11_10(y, BESSEL_K1_P3, BESSEL_K1_Q3);
2787 double factor = 1. / sqrt(x);
2797 throw domain_error(
"bessel_k0_k1" );
2801 double r1_0 =
ratevl_6_3(y, BESSEL_K0_P1, BESSEL_K0_Q1);
2802 double r2_0 =
ratevl_5_4(y, BESSEL_K0_P2, BESSEL_K0_Q2);
2803 double r1_1 =
ratevl_6_4(y, BESSEL_K1_P1, BESSEL_K1_Q1);
2804 double r2_1 =
ratevl_6_4(y, BESSEL_K1_P2, BESSEL_K1_Q2);
2805 double factor = log(x);
2806 *k0val = r1_0 - factor * r2_0;
2807 *k1val = (r1_1 + factor * r2_1) / x;
2812 double r0 =
ratevl_10_11(y, BESSEL_K0_P3, BESSEL_K0_Q3);
2813 double r1 =
ratevl_11_10(y, BESSEL_K1_P3, BESSEL_K1_Q3);
2814 double factor = exp(-x) / sqrt(x);
2815 *k0val = factor * r0;
2816 *k1val = factor * r1;
2825 throw domain_error(
"bessel_k0_k1_scaled" );
2829 double r1_0 =
ratevl_6_3(y, BESSEL_K0_P1, BESSEL_K0_Q1);
2830 double r2_0 =
ratevl_5_4(y, BESSEL_K0_P2, BESSEL_K0_Q2);
2831 double r1_1 =
ratevl_6_4(y, BESSEL_K1_P1, BESSEL_K1_Q1);
2832 double r2_1 =
ratevl_6_4(y, BESSEL_K1_P2, BESSEL_K1_Q2);
2835 *k0val = f2 * (r1_0 - f1 * r2_0);
2836 *k1val = f2 * (r1_1 + f1 * r2_1) / x;
2841 double r0 =
ratevl_10_11(y, BESSEL_K0_P3, BESSEL_K0_Q3);
2842 double r1 =
ratevl_11_10(y, BESSEL_K1_P3, BESSEL_K1_Q3);
2843 double factor = 1. / sqrt(x);
2844 *k0val = factor * r0;
2845 *k1val = factor * r1;
2850 -2.2335582639474375249e+15, -5.5050369673018427753e+14, -3.2940087627407749166e+13,
2851 -8.4925101247114157499e+11, -1.1912746104985237192e+10, -1.0313066708737980747e+08,
2852 -5.9545626019847898221e+05, -2.4125195876041896775e+03, -7.0935347449210549190e+00,
2853 -1.5453977791786851041e-02, -2.5172644670688975051e-05, -3.0517226450451067446e-08,
2854 -2.6843448573468483278e-11, -1.5982226675653184646e-14, -5.2487866627945699800e-18
2857 -2.2335582639474375245e+15, 7.8858692566751002988e+12, -1.2207067397808979846e+10,
2858 1.0377081058062166144e+07, -4.8527560179962773045e+03, 1.0
2861 -2.2210262233306573296e-04, 1.3067392038106924055e-02, -4.4700805721174453923e-01,
2862 5.5674518371240761397e+00, -2.3517945679239481621e+01, 3.1611322818701131207e+01,
2863 -9.6090021968656180000e+00
2866 -5.5194330231005480228e-04, 3.2547697594819615062e-02, -1.1151759188741312645e+00,
2867 1.3982595353892851542e+01, -6.0228002066743340583e+01, 8.5539563258012929600e+01,
2868 -3.1446690275135491500e+01, 1.0
2872 -1.4577180278143463643e+15, -1.7732037840791591320e+14, -6.9876779648010090070e+12,
2873 -1.3357437682275493024e+11, -1.4828267606612366099e+09, -1.0588550724769347106e+07,
2874 -5.1894091982308017540e+04, -1.8225946631657315931e+02, -4.7207090827310162436e-01,
2875 -9.1746443287817501309e-04, -1.3466829827635152875e-06, -1.4831904935994647675e-09,
2876 -1.1928788903603238754e-12, -6.5245515583151902910e-16, -1.9705291802535139930e-19
2879 -2.9154360556286927285e+15, 9.7887501377547640438e+12, -1.4386907088588283434e+10,
2880 1.1594225856856884006e+07, -5.1326864679904189920e+03, 1.0
2883 1.4582087408985668208e-05, -8.9359825138577646443e-04, 2.9204895411257790122e-02,
2884 -3.4198728018058047439e-01, 1.3960118277609544334e+00, -1.9746376087200685843e+00,
2885 8.5591872901933459000e-01, -6.0437159056137599999e-02
2888 3.7510433111922824643e-05, -2.2835624489492512649e-03, 7.4212010813186530069e-02,
2889 -8.5017476463217924408e-01, 3.2593714889036996297e+00, -3.8806586721556593450e+00, 1.0
2902 return ratevl_15_6(y, BESSEL_I0_P1, BESSEL_I0_Q1);
2906 double y = 1./x - 1./15.;
2907 double r =
ratevl_7_8(y, BESSEL_I0_P2, BESSEL_I0_Q2);
2908 double factor = exp(x) / sqrt(x);
2923 return exp(-x) *
ratevl_15_6(y, BESSEL_I0_P1, BESSEL_I0_Q1);
2927 double y = 1./x - 1./15.;
2928 double r =
ratevl_7_8(y, BESSEL_I0_P2, BESSEL_I0_Q2);
2929 double factor = 1. / sqrt(x);
2944 return x *
ratevl_15_6(y, BESSEL_I1_P1, BESSEL_I1_Q1);
2948 double y = 1./w - 1./15.;
2949 double r =
ratevl_8_7(y, BESSEL_I1_P2, BESSEL_I1_Q2);
2950 double factor = exp(w) / sqrt(w);
2951 return ( x < 0. ) ? -factor*r : factor*r;
2965 return x * exp(-w) *
ratevl_15_6(y, BESSEL_I1_P1, BESSEL_I1_Q1);
2969 double y = 1./w - 1./15.;
2970 double r =
ratevl_8_7(y, BESSEL_I1_P2, BESSEL_I1_Q2);
2971 double factor = 1. / sqrt(w);
2972 return ( x < 0. ) ? -factor*r : factor*r;
2989 *i0val =
ratevl_15_6(y, BESSEL_I0_P1, BESSEL_I0_Q1);
2990 *i1val = x *
ratevl_15_6(y, BESSEL_I1_P1, BESSEL_I1_Q1);
2994 double y = 1./w - 1./15.;
2995 double r0 =
ratevl_7_8(y, BESSEL_I0_P2, BESSEL_I0_Q2);
2996 double r1 =
ratevl_8_7(y, BESSEL_I1_P2, BESSEL_I1_Q2);
2997 double factor = exp(w) / sqrt(w);
2998 *i0val = factor * r0;
2999 *i1val = ( x < 0. ) ? -factor*r1 : factor*r1;
3016 double r0 =
ratevl_15_6(y, BESSEL_I0_P1, BESSEL_I0_Q1);
3017 double r1 = x *
ratevl_15_6(y, BESSEL_I1_P1, BESSEL_I1_Q1);
3018 double factor = exp(-w);
3019 *i0val = factor * r0;
3020 *i1val = factor * r1;
3024 double y = 1./w - 1./15.;
3025 double r0 =
ratevl_7_8(y, BESSEL_I0_P2, BESSEL_I0_Q2);
3026 double r1 =
ratevl_8_7(y, BESSEL_I1_P2, BESSEL_I1_Q2);
3027 double factor = 1. / sqrt(w);
3028 *i0val = factor * r0;
3029 *i1val = ( x < 0. ) ? -factor*r1 : factor*r1;
3033 inline double ratevl_5_4(
double x,
const double a[5],
const double b[4])
3037 t[0] = a[4] * x2 + a[2];
3038 t[1] = a[3] * x2 + a[1];
3039 t[2] = b[3] * x2 + b[1];
3040 t[3] = b[2] * x2 + b[0];
3045 return (t[0] + t[1]) / (t[2] + t[3]);
3048 inline double ratevl_6_3(
double x,
const double a[6],
const double b[3])
3052 t[0] = a[5] * x2 + a[3];
3053 t[1] = a[4] * x2 + a[2];
3054 t[2] = b[2] * x2 + b[0];
3062 return (t[0] + t[1]) / (t[2] + t[3]);
3065 inline double ratevl_6_4(
double x,
const double a[6],
const double b[4])
3069 t[0] = a[5] * x2 + a[3];
3070 t[1] = a[4] * x2 + a[2];
3071 t[2] = b[3] * x2 + b[1];
3072 t[3] = b[2] * x2 + b[0];
3079 return (t[0] + t[1]) / (t[2] + t[3]);
3082 inline double ratevl_7_8(
double x,
const double a[7],
const double b[8])
3086 t[0] = a[6] * x2 + a[4];
3087 t[1] = a[5] * x2 + a[3];
3088 t[2] = b[7] * x2 + b[5];
3089 t[3] = b[6] * x2 + b[4];
3106 return (t[0] + t[1]) / (t[2] + t[3]);
3109 inline double ratevl_8_7(
double x,
const double a[8],
const double b[7])
3113 t[0] = a[7] * x2 + a[5];
3114 t[1] = a[6] * x2 + a[4];
3115 t[2] = b[6] * x2 + b[4];
3116 t[3] = b[5] * x2 + b[3];
3133 return (t[0] + t[1]) / (t[2] + t[3]);
3136 inline double ratevl_10_11(
double x,
const double a[10],
const double b[11])
3140 t[0] = a[9] * x2 + a[7];
3141 t[1] = a[8] * x2 + a[6];
3142 t[2] = b[10] * x2 + b[8];
3143 t[3] = b[9] * x2 + b[7];
3172 return (t[0] + t[1]) / (t[2] + t[3]);
3175 inline double ratevl_11_10(
double x,
const double a[11],
const double b[10])
3179 t[0] = a[10] * x2 + a[8];
3180 t[1] = a[9] * x2 + a[7];
3181 t[2] = b[9] * x2 + b[7];
3182 t[3] = b[8] * x2 + b[6];
3211 return (t[0] + t[1]) / (t[2] + t[3]);
3214 inline double ratevl_15_6(
double x,
const double a[15],
const double b[6])
3218 t[0] = a[14] * x2 + a[12];
3219 t[1] = a[13] * x2 + a[11];
3220 t[2] = b[5] * x2 + b[3];
3221 t[3] = b[4] * x2 + b[2];
3250 return (t[0] + t[1]) / (t[2] + t[3]);
3271 fprintf(
ioQQQ,
" DISASTER invalid argument x=%g for function e1, requires x > 0\n", x );
3278 const double a[6]= {-.57721566,.99999193,-.24991055,
3279 .05519968,-.00976004,.00107857};
3280 return ((((a[5]*x + a[4])*x + a[3])*x + a[2])*x + a[1])*x + a[0] - log(x);
3287 const double a[4]= {8.5733287401,18.0590169730,8.6347608925,.2677737343};
3288 const double b[4]= {9.5733223454,25.6329561486,21.0996530827,3.9584969228};
3289 double top = (((x + a[0])*x + a[1])*x + a[2])*x + a[3];
3290 double bot = (((x + b[0])*x + b[1])*x + b[2])*x + b[3];
3291 return top/bot/x*exp(-x);
3307 fprintf(
ioQQQ,
" DISASTER invalid argument x=%g for function e1_scaled, requires x > 0\n", x );
3312 return exp(x)*
e1(x);
3319 const double a[4]= {8.5733287401,18.0590169730,8.6347608925,.2677737343};
3320 const double b[4]= {9.5733223454,25.6329561486,21.0996530827,3.9584969228};
3321 double top = (((x + a[0])*x + a[1])*x + a[2])*x + a[3];
3322 double bot = (((x + b[0])*x + b[1])*x + b[2])*x + b[3];
3335 fprintf(
ioQQQ,
" DISASTER invalid argument x=%g for function e2, requires x >= 0\n", x );
3346 const double a[6] = { 1.0000000000, -0.4227844628, -0.4999962685,
3347 0.0832964152, -0.0137254444, 0.0017460335 };
3348 return ((((a[5]*x + a[4])*x + a[3])*x + a[2])*x + a[1])*x + a[0] + x*log(x);
3354 const double a[7] = { 1.0000006037, -0.4227920037, -0.4999593292, 0.0832162574,
3355 -0.0136902608, 0.0018824593, -0.0001622201 };
3356 return (((((a[6]*x + a[5])*x + a[4])*x + a[3])*x + a[2])*x + a[1])*x + a[0] + x*log(x);
3358 else if( x < 2.6666667 )
3362 const double a[4] = { 8.5977992972, 17.4635101763, 7.5697246936, 0.0512652659 };
3363 const double b[4] = { 10.5974966324, 32.6715286491, 33.0501272716, 8.6019987326 };
3365 double top = (((a[3]*y + a[2])*y + a[1])*y + a[0])*y + 1.;
3366 double bot = (((b[3]*y + b[2])*y + b[1])*y + b[0])*y + 1.;
3367 return top/bot*y*exp(-x);
3373 const double a[4] = { 13.3703104742, 46.8560764900, 39.5905932936, 0.9608837426 };
3374 const double b[4] = { 15.3703105373, 71.5967206495, 114.5581563870, 49.5883983926 };
3376 double top = (((a[3]*y + a[2])*y + a[1])*y + a[0])*y + 1.;
3377 double bot = (((b[3]*y + b[2])*y + b[1])*y + b[0])*y + 1.;
3378 return top/bot*y*exp(-x);
3384 const double a[3] = { -1.7217469460, -40.8941038520, -13.3258180489 };
3385 const double b[3] = { 0.2782514490, -46.3371070179, -83.7227541235 };
3387 double top = ((a[2]*y + a[1])*y + a[0])*y + 1.;
3388 double bot = ((b[2]*y + b[1])*y + b[0])*y + 1.;
3389 return top/bot*y*exp(-x);
3405 double val =
expn(2,z);
3412 val = 1.-2.0*x*(1-3.0*x*(1-4.0*x));
3417 void chbfit(
double a,
double b, vector<double>& c,
double (*func)(
double))
3419 const size_t n = c.size();
3420 vector<double> fv(n);
3421 const double fa = PI/n;
3422 for (
size_t k=0; k<n; ++k)
3424 double frac = 0.5*(1.+cos(fa*(k+0.5)));
3425 fv[k] = func(a+(b-a)*frac);
3427 for (
size_t j=0; j<n; ++j)
3430 for (
size_t k=0; k<n; ++k)
3432 s += fv[k]*cos(fa*(k+0.5)*j);
3440 vector<double> c(50);
3444 for (
size_t i=0; i<c.size(); ++i)
3452 for (
double z=1.0; z<zmax; z *= 1.1)
3454 double chfrac = 4/z-2.;
3456 double chbval =
chbevl(chfrac,&c[0]+(c.size()-nterm),nterm);
3457 fprintf(
ioQQQ,
"%.12e e2 %.12e cheb %.12e error %.4e\n",z,expnval,
3458 chbval,2*(chbval-expnval)/(chbval+expnval));
3473 double afac = 2*(al-1.);
3474 for (
long nn = 2; nn<=n; ++nn)
3477 c = (x*(2*nn+afac)*cp-(nn+afac)*cpp)/
double(nn);
3488 return ( S%4 == 0 ) ? 1.0 : -1.0;
3494 double sjs(
long j1,
long j2,
long j3,
long l1,
long l2,
long l3 )
3502 long ij0 = j1+j2+j3+2;
3503 long ij1 = j1+l2+l3+2;
3504 long ij2 = l1+j2+l3+2;
3505 long ij3 = l1+l2+j3+2;
3509 long iwmin=
max(
max(
max(ij0,ij1),ij2),ij3)+1;
3511 long id1 = ij0+ij1-j1-j1;
3512 long id2 = ij0+ij2-j2-j2;
3513 long id3 = ij0+ij3-j3-j3;
3515 long iwmax =
min(
min(id1,id2),id3)-1;
3518 if( iwmax >= iwmin )
3520 for (
long iw=iwmin; iw <= iwmax; iw += 2 )
3544 if( abs(n2%2) == 1 )
3549 inline double Delta(
long j1,
long j2,
long j3)
3555 return fc2(j1+j2-j3)*
fc2(j1-j2+j3)*
fc2(-j1+j2+j3)/
fc2(j1+j2+j3+2);
3558 double SixJFull(
long j1,
long j2,
long j3,
long j4,
long j5,
long j6)
3575 long tlo =
max(
max(
max(j1+j2+j3,j1+j5+j6),j4+j2+j6),j4+j5+j3);
3576 long thi =
min(
min(j1+j2+j4+j5,j2+j3+j5+j6),j3+j1+j6+j4);
3579 double term =
sg(tlo)*
fc2(tlo+2)/
3580 (
fc2(tlo-j1-j2-j3)*
fc2(tlo-j1-j5-j6)*
fc2(tlo-j4-j2-j6)*
fc2(tlo-j4-j5-j3)*
3581 fc2(j1+j2+j4+j5-tlo)*
fc2(j2+j3+j5+j6-tlo)*
fc2(j3+j1+j6+j4-tlo));
3582 for(
long t=tlo; t <= thi; t += 2 )
3586 /
double((t-j1-j2-j3)*(t-j1-j5-j6)*(t-j4-j2-j6)*(t-j4-j5-j3))
3587 *double((j1+j2+j4+j5+2-t)*(j2+j3+j5+j6+2-t)*(j1+j3+j4+j6+2-t));
3608 void rec6j(
double *sixcof,
double l2,
double l3,
3609 double l4,
double l5,
double l6,
double *l1min,
3610 double *l1max,
double *lmatch,
long ndim,
long *ier)
3615 double tiny = 1e-300;
3616 double srtiny = sqrt(tiny);
3617 double huge = 1e300;
3618 double srhuge = sqrt(huge);
3662 *l1min =
max(fabs(l2 - l3),fabs(l5 - l6));
3663 *l1max =
min(l2 + l3,l5 + l6);
3665 if ( (
frac(l2 + l3 + l5 + l6 + eps) >= 2*eps) ||
3666 (
frac(l4 + l2 + l6 + eps) >= 2*eps) ||
3667 (l4 + l2 - l6 < 0.) ||
3668 (l4 - l2 + l6 < 0.) ||
3669 (-(l4) + l2 + l6 < 0.) ||
3670 (l4 + l3 - l5 < 0.) ||
3671 (l4 - l3 + l5 < 0.) ||
3672 (-(l4) + l3 + l5 < 0.) ||
3673 (*l1min >= *l1max + eps)
3680 "DO NOT SATISFY TRIANGULAR CONDITIONS OR\n"
3682 "L2+L3+L5+L6 OR L2+L4+L6 NOT INTEGER\n",
3687 int nfin = int (*l1max - *l1min + 1. + eps);
3695 " EXCEED STORAGE PROVIDED (%4d,%4ld)\n",
3696 l2,l3,l4,l5,l6,nfin,ndim);
3700 int sign2 = 0x1 & int (l2 + l3 + l5 + l6 + eps) ? -1 : 1;
3704 sixcof[0] = sign2 / sqrt((2*(*l1min) + 1.) * ( 2*l4 + 1.));
3711 double sum1 = (2*l1 + 1.) * tiny;
3715 double c1old=0., oldfac=0., sumfor, x;
3718 for (lstep=1; ; ++lstep) {
3720 double a1 = (l1 + l2 + l3 + 1.) * (l1 - l2 + l3) *
3721 (l1 + l2 - l3) * (-l1 + l2 + l3 + 1.);
3722 double a2 = (l1 + l5 + l6 + 1.) * (l1 - l5 + l6) *
3723 (l1 + l5 - l6) * (-l1 + l5 + l6 + 1.);
3724 double newfac = sqrt(a1 * a2);
3725 double c1, denom=0.;
3726 if (l1 >= 1. + eps) {
3727 double dv = 2. * (l2 * (l2 + 1.) * l5 * (l5 + 1.) +
3728 l3 * (l3 + 1.) * l6 * (l6 + 1.) -
3729 l1 * (l1 - 1.) * l4 * (l4 + 1.)) -
3730 (l2 * (l2 + 1.) + l3 * (l3 + 1.) - l1 * (l1 - 1.)) *
3731 (l5 * (l5 + 1.) + l6 * (l6 + 1.) - l1 * (l1 - 1.));
3732 denom = (l1 - 1.) * newfac;
3733 c1 = -(2*l1 - 1.) * dv / denom;
3738 c1 = -2. * (l2 * (l2 + 1.) + l5 * (l5 + 1.) - l4 * (l4 + 1.)) /
3747 sum1 += tiny * (2*l1 + 1.) * c1 * c1;
3748 if (lstep+1 == nfin) {
3755 double c2 = -l1 * oldfac / denom;
3756 x = c1 * sixcof[lstep-1] + c2 * sixcof[lstep - 2];
3759 sum1 += (2*l1 + 1.) * x * x;
3765 if (lstep+1 == nfin || c1old <= fabs(c1)) {
3770 if (fabs(x) >= srhuge) {
3776 for (i = 0; i < lstep+1; ++i) {
3777 sixcof[i] /= srhuge;
3789 if (lstep+1 == nfin) {
3798 double x2 = sixcof[lstep-1];
3799 double x3 = sixcof[lstep-2];
3805 sixcof[nfin-1] = srtiny;
3806 double sum2 = (2*l1 + 1.) * tiny;
3810 for(lstep=1;;++lstep) {
3812 double a1s = (l1 + l2 + l3) * (l1 - l2 + l3 - 1.) *
3813 (l1 + l2 - l3 - 1.) * (-l1 + l2 + l3 + 2.);
3814 double a2s = (l1 + l5 + l6) * (l1 - l5 + l6 - 1.) *
3815 (l1 + l5 - l6 - 1.) * (-l1 + l5 + l6 + 2.);
3816 double newfac = sqrt(a1s * a2s);
3817 double dv = 2. * (l2 * (l2 + 1.) * l5 * (l5 + 1.) + l3 * (l3 + 1.) *
3818 l6 * (l6 + 1.) - l1 * (l1 - 1.) * l4 * (l4 + 1.)) -
3819 (l2 * (l2 + 1.) + l3 * (l3 + 1.) - l1 * (l1 - 1.)) *
3820 (l5 * (l5 + 1.) + l6 * (l6 + 1.) - l1 * (l1 - 1.));
3821 double denom = l1 * newfac;
3822 double c1 = -(2*l1 - 1.) * dv / denom;
3828 if (lstep == nfin-nlim) {
3832 sum2 += (2*l1 - 3.) * c1 * c1 * tiny;
3836 double c2 = -(l1 - 1.) * oldfac / denom;
3838 y = c1 * sixcof[nfin-lstep] + c2 * sixcof[nfin-lstep+1];
3839 if (lstep == nfin-nlim) {
3842 sixcof[nfin-lstep-1] = y;
3844 sum2 += (2*l1 - 3.) * y * y;
3847 if (fabs(y) >= srhuge) {
3853 for (i = 0; i < lstep+1; ++i) {
3854 int index = nfin-i-1;
3855 sixcof[index] /= srhuge;
3868 double y2 = sixcof[nfin-lstep];
3869 double y1 = sixcof[nfin-lstep+1];
3872 double ratio = (x1 * y1 + x2 * y2 + x3 * y3) /
3873 (x1 * x1 + x2 * x2 + x3 * x3);
3874 if (fabs(ratio) >= 1.) {
3875 for (n = 0; n < nlim; ++n) {
3876 sixcof[n] = ratio * sixcof[n];
3878 sumuni = ratio * ratio * sumfor + sumbac;
3883 for (n = nlim; n < nfin; ++n) {
3884 sixcof[n] = ratio * sixcof[n];
3886 sumuni = sumfor + ratio * ratio * sumbac;
3892 int sign1 = sixcof[nfin-1] >= 0. ? 1 : -1;
3893 double cnorm = sign1*sign2 / sqrt((2*l4 + 1.) * sumuni);
3895 for (n = 0; n < nfin; ++n) {
3896 sixcof[n] = cnorm * sixcof[n];
3954 static const int N = 624;
3955 static const int M = 397;
3957 static const unsigned long UMASK = 0x80000000UL;
3958 static const unsigned long LMASK = 0x7fffffffUL;
3959 inline unsigned long MIXBITS(
unsigned long u,
unsigned long v)
3961 return (u & UMASK) | (v &
LMASK);
3963 inline unsigned long TWIST(
unsigned long u,
unsigned long v)
3965 return (
MIXBITS(u,v) >> 1) ^ (v&1UL ? MATRIX_A : 0UL);
3977 state[0]= s & 0xffffffffUL;
3978 for (j=1; j<
N; j++) {
3979 state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j);
3984 state[j] &= 0xffffffffUL;
3986 nleft = 1; initf = 1;
3998 k = (N>key_length ? N : key_length);
4000 state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL))
4002 state[i] &= 0xffffffffUL;
4004 if (i>=N) { state[0] = state[N-1]; i=1; }
4005 if (j>=key_length) j=0;
4007 for (k=N-1; k; k--) {
4008 state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL))
4010 state[i] &= 0xffffffffUL;
4012 if (i>=N) { state[0] = state[N-1]; i=1; }
4015 state[0] = 0x80000000UL;
4016 nleft = 1; initf = 1;
4021 unsigned long *p=
state;
4031 for (j=N-M+1; --j; p++)
4032 *p = p[M] ^
TWIST(p[0], p[1]);
4035 *p = p[M-N] ^
TWIST(p[0], p[1]);
4037 *p = p[M-
N] ^
TWIST(p[0], state[0]);
4050 y ^= (y << 7) & 0x9d2c5680UL;
4051 y ^= (y << 15) & 0xefc60000UL;
4067 y ^= (y << 7) & 0x9d2c5680UL;
4068 y ^= (y << 15) & 0xefc60000UL;
4071 return (
long)(y>>1);
4084 y ^= (y << 7) & 0x9d2c5680UL;
4085 y ^= (y << 15) & 0xefc60000UL;
4088 return (
double)y * (1.0/4294967295.0);
4102 y ^= (y << 7) & 0x9d2c5680UL;
4103 y ^= (y << 15) & 0xefc60000UL;
4106 return (
double)y * (1.0/4294967296.0);
4120 y ^= (y << 7) & 0x9d2c5680UL;
4121 y ^= (y << 15) & 0xefc60000UL;
4124 return ((
double)y + 0.5) * (1.0/4294967296.0);
4132 return (a*67108864.0+b)*(1.0/9007199254740992.0);
4147 0.000000000000000000e+0,
4148 9.933599239785286114e-2,
4149 1.947510333680280496e-1,
4150 2.826316650213119286e-1,
4151 3.599434819348881042e-1,
4152 4.244363835020222959e-1,
4153 4.747632036629779306e-1,
4154 5.105040575592317787e-1,
4155 5.321017070563654290e-1,
4156 5.407243187262986750e-1,
4157 5.380794985696822201e-1,
4158 5.262066799705525356e-1,
4159 5.072734964077396141e-1,
4160 4.833975173848241360e-1,
4161 4.565072375268972572e-1,
4162 4.282490710853986254e-1,
4163 3.999398943230814126e-1,
4164 3.725593489740788250e-1,
4165 3.467727691148722451e-1,
4166 3.229743193228178382e-1,
4167 3.013403889237919660e-1,
4168 2.818849389255277938e-1,
4169 2.645107599508319576e-1,
4170 2.490529568377666955e-1,
4171 2.353130556638425762e-1,
4172 2.230837221674354811e-1,
4173 2.121651242424990041e-1,
4174 2.023745109105139857e-1,
4175 1.935507238593667923e-1,
4176 1.855552345354997718e-1,
4177 1.782710306105582873e-1,
4178 1.716003557161446928e-1,
4179 1.654619998786752031e-1,
4180 1.597885804744950500e-1,
4181 1.545240577369634525e-1,
4182 1.496215930807564847e-1,
4183 1.450417730540888593e-1,
4184 1.407511741154154125e-1,
4185 1.367212216746364963e-1,
4186 1.329272910810892667e-1,
4187 1.293480012360051155e-1,
4188 1.259646584343461329e-1,
4189 1.227608160065229225e-1,
4190 1.197219228088390280e-1,
4191 1.168350399532972540e-1,
4192 1.140886102268249801e-1,
4193 1.114722685321253072e-1,
4194 1.089766845891902214e-1,
4195 1.065934312832810744e-1,
4196 1.043148736220704706e-1,
4197 1.021340744242768354e-1,
4198 1.000447137201476355e-1,
4199 9.804101948507806734e-2,
4200 9.611770781195023073e-2,
4201 9.426993099823683440e-2,
4202 9.249323231075475996e-2,
4203 9.078350641561113352e-2,
4204 8.913696463869524546e-2,
4205 8.755010436413927499e-2,
4206 8.601968199264808016e-2,
4207 8.454268897454385223e-2,
4208 8.311633050835148859e-2,
4209 8.173800655824702378e-2,
4210 8.040529489538834118e-2,
4211 7.911593591113373223e-2,
4212 7.786781898606987138e-2,
4213 7.665897022891428948e-2,
4214 7.548754142476270211e-2,
4215 7.435180005364808165e-2,
4216 7.325012025863538754e-2,
4217 7.218097465823629202e-2,
4218 7.114292691123472774e-2,
4219 7.013462495342931107e-2,
4220 6.915479483562112754e-2,
4221 6.820223510065167384e-2,
4222 6.727581164463061598e-2,
4223 6.637445301385693290e-2,
4224 6.549714609447248675e-2,
4225 6.464293215671364666e-2,
4226 6.381090321984490301e-2,
4227 6.300019870755338791e-2,
4228 6.221000236682679049e-2,
4229 6.143953942619040819e-2,
4230 6.068807397169402555e-2,
4231 5.995490652126037542e-2,
4232 5.923937177997213955e-2,
4233 5.854083656061641403e-2,
4234 5.785869785535237086e-2,
4235 5.719238104574369009e-2,
4236 5.654133823962313062e-2,
4237 5.590504672435046070e-2,
4238 5.528300752700259690e-2,
4239 5.467474407290986634e-2,
4240 5.407980093473671650e-2,
4241 5.349774266500934015e-2,
4242 5.292815270562564644e-2,
4243 5.237063236845275277e-2,
4244 5.182479988163068060e-2,
4245 5.129028949666435102e-2,
4246 5.076675065180469937e-2,
4247 5.025384718759852810e-2
4282 int ind =
min(
max(
int(x10),0),N_DAWSON-1);
4283 double p = x10 - double(ind);
4284 return tbl_dawson[ind] + p*(tbl_dawson[ind+1]-tbl_dawson[ind]);
4286 else if( order == 3 )
4288 int ind =
min(
max(
int(x10-1.),0),N_DAWSON-3);
4289 double p = x10 - double(ind+1);
4294 return p*pm1*(pp1*tbl_dawson[ind+3]-pm2*tbl_dawson[ind])/6. +
4295 pm2*pp1*(pm1*tbl_dawson[ind+1]-p*tbl_dawson[ind+2])/2.;
4356 return a*vm2/
realnum(SQRTPI)*(((105.f/8.f*vm2 + 15.f/4.f)*vm2 + 3.f/2.f)*vm2 + 1.f);
4366 int order = ( a > 0.003f || v > 1.5f ) ? 3 : 1;
4380 return emv2*(1.f-
pow2(a)*(2.f*v2-1.f)) +
4398 size_t ilo = 0, ihi = n;
4399 for(
size_t i=0; i < n; ++i )
4403 else if( v[i] > 9.f )
4410 for(
size_t i=0; i < ilo; ++i )
4413 y[i] = a*vm2/
realnum(SQRTPI)*(((105.f/8.f*vm2 + 15.f/4.f)*vm2 + 3.f/2.f)*vm2 + 1.f);
4417 for(
size_t i=ilo; i < ihi; ++i )
4418 arg[i] = -
pow2(v[i]);
4419 vexp( arg.ptr0(), expval.
ptr0(), ilo, ihi );
4420 for(
size_t i=ilo; i < ihi; ++i )
4423 int order = ( a > 0.003f || vv > 1.5f ) ? 3 : 1;
4424 y[i] = expval[i]*(1.f-
pow2(a)*(2.f*
pow2(vv)-1.f)) +
4428 for(
size_t i=ihi; i < n; ++i )
4431 y[i] = a*vm2/
realnum(SQRTPI)*(((105.f/8.f*vm2 + 15.f/4.f)*vm2 + 3.f/2.f)*vm2 + 1.f);
4460 static const double c[6] = { 1.0117281, -.75197147, .012557727, .010022008, -2.4206814e-4, 5.0084806e-7 };
4461 static const double s[6] = { 1.393237, .23115241, -.15535147, .0062183662, 9.1908299e-5, -6.2752596e-7 };
4462 static const double t[6] = { .31424038, .94778839, 1.5976826, 2.2795071, 3.020637, 3.8897249 };
4464 static const double R0 = 146.7, R1 = 14.67;
4469 double a0, d0, e0, d2,
e2, h0, e4,
h2, h4, h6, p0,
4470 p2, p4, p6, p8, z0, z2, z4, z6, z8, mf[6], pf[6],
4471 mq[6], yf, pq[6], xm[6], ym[6], xp[6], xq, yq, yp[6];
4473 double abx, ypy0, xlim0, xlim1, xlim2, xlim3, xlim4, ypy0q, yrrtpi;
4475 rg1 = rg2 = rg3 =
true;
4477 z0 = z2 = z4 = z6 = z8 = 0.;
4478 p0 = p2 = p4 = p6 = p8 = 0.;
4479 h0 = h2 = h4 = h6 = 0.;
4480 a0 = d0 = d2 = e0 = e2 = e4 = 0.;
4483 yrrtpi = y * .56418958;
4487 xlim3 = y * 3.097 - .45;
4489 xlim4 = y * 18.1 + 1.65;
4496 for (i = 0; i < n; ++i)
4502 k[i] =
realnum(yrrtpi / (xq + yq));
4504 else if (abx > xlim1)
4514 d = .56418958 / (d0 + xq * (d2 + xq));
4515 k[i] =
realnum(d * y * (a0 + xq));
4517 else if (abx > xlim2)
4522 h0 = yq * (yq * (yq * (yq + 6.) + 10.5) + 4.5) + .5625;
4523 h2 = yq * (yq * (yq * 4. + 6.) + 9.) - 4.5;
4524 h4 = 10.5 - yq * (6. - yq * 6.);
4526 e0 = yq * (yq * (yq + 5.5) + 8.25) + 1.875;
4527 e2 = yq * (yq * 3. + 1.) + 5.25;
4530 d = .56418958 / (h0 + xq * (h2 + xq * (h4 + xq * (h6 + xq))));
4531 k[i] =
realnum(d * y * (e0 + xq * (e2 + xq * (e4 + xq))));
4533 else if (abx < xlim3)
4539 z0 = y * (y * (y * (y * (y * (y * (y * (y * (y * (y + 13.3988) +
4540 88.26741) + 369.1989) + 1074.409) + 2256.981) + 3447.629) +
4541 3764.966) + 2802.87) + 1280.829) + 272.1014;
4542 z2 = y * (y * (y * (y * (y * (y * (y * (y * 5. + 53.59518) +
4543 266.2987) + 793.4273) + 1549.675) + 2037.31) + 1758.336) +
4544 902.3066) + 211.678;
4545 z4 = y * (y * (y * (y * (y * (y * 10. + 80.39278) + 269.2916) +
4546 479.2576) + 497.3014) + 308.1852) + 78.86585;
4547 z6 = y * (y * (y * (y * 10. + 53.59518) + 92.75679) + 55.02933) +
4549 z8 = y * (y * 5. + 13.3988) + 1.49646;
4550 p0 = y * (y * (y * (y * (y * (y * (y * (y * (y * .3183291 +
4551 4.264678) + 27.93941) + 115.3772) + 328.2151) + 662.8097) +
4552 946.897) + 919.4955) + 549.3954) + 153.5168;
4553 p2 = y * (y * (y * (y * (y * (y * (y * 1.2733163 + 12.79458) +
4554 56.81652) + 139.4665) + 189.773) + 124.5975) - 1.322256) -
4556 p4 = y * (y * (y * (y * (y * 1.9099744 + 12.79568) + 29.81482) +
4557 24.01655) + 10.46332) + 2.584042;
4558 p6 = y * (y * (y * 1.273316 + 4.266322) + .9377051) - .07272979;
4559 p8 = y * .3183291 + 5.480304e-4;
4561 d = 1.7724538 / (z0 + xq * (z2 + xq * (z4 + xq * (z6 + xq * (z8 + xq)))));
4562 k[i] =
realnum(d * (p0 + xq * (p2 + xq * (p4 + xq * (p6 + xq * p8)))));
4567 ypy0q = ypy0 * ypy0;
4569 for (j = 0; j <= 5; ++j)
4573 mf[j] = 1. / (mq[j] + ypy0q);
4575 ym[j] = mf[j] * ypy0;
4578 pf[j] = 1. / (pq[j] + ypy0q);
4580 yp[j] = pf[j] * ypy0;
4584 for (j = 0; j <= 5; ++j)
4586 ki = ki + c[j] * (ym[j] + yp[j]) - s[j] * (xm[j] - xp[j]);
4592 for (j = 0; j <= 5; ++j)
4594 ki = ki + (c[j] * (mq[j] * mf[j] - ym[j] * 1.5) + s[j] * yf * xm[j]) / (mq[j] + 2.25) +
4595 (c[j] * (pq[j] * pf[j] - yp[j] * 1.5) - s[j] * yf * xp[j]) / (pq[j] + 2.25);
4597 ki = y * ki + exp(-xq);
4624 while( ioFile.get(c) )
4649 ioFile.seekg( 0, ios::end );
4650 streampos fsize = ioFile.tellg();
4651 ioFile.seekg( 0, ios::beg );
4654 string line, content;
4656 content.reserve(fsize);
4658 while( getline( ioFile, line ) )
4659 if( line[0] !=
'#' )
4673 state[0] = 0x67452301L;
4674 state[1] = 0xefcdab89L;
4675 state[2] = 0x98badcfeL;
4676 state[3] = 0x10325476L;
4681 uint32 bytes = str.length()%64;
4682 uint32 padlen = ( bytes >= 56 ) ? 64 + 56 - bytes : 56 - bytes;
4684 for( uint32 i=1; i < padlen; ++i )
4687 ASSERT( lstr.length()%64 == 56 );
4692 unsigned char chr[64];
4695 for( i=0; i < lstr.length()/64; ++i )
4697 for( uint32 j=0; j < 64; ++j )
4700 u.chr[j] = lstr[i*64+j];
4705 u.chr[j4+3-jr] = lstr[i*64+j];
4710 for( uint32 j=0; j < 56; ++j )
4713 u.chr[j] = lstr[i*64+j];
4718 u.chr[j4+3-jr] = lstr[i*64+j];
4722 u.in[14] = (str.length()<<3)&0xffffffff;
4723 u.in[15] = (str.length()>>29)&0xffffffff;
4728 for( uint32 i=0; i < 4; ++i )
4729 hash << hex << setfill(
'0') << setw(8) <<
MD5swap(state[i]);
4740 unsigned char byte[4];
4744 uo.byte[0] = ui.byte[3];
4745 uo.byte[1] = ui.byte[2];
4746 uo.byte[2] = ui.byte[1];
4747 uo.byte[3] = ui.byte[0];
4827 return uint32((x<<y) | (x>>(32-y)));
4834 #define F1(x, y, z) (z ^ (x & (y ^ z)))
4835 #define F2(x, y, z) F1(z, x, y)
4836 #define F3(x, y, z) (x ^ y ^ z)
4837 #define F4(x, y, z) (y ^ (x | ~z))
4839 #define MD5STEP(f, w, x, y, z, data, s) \
4840 w = rotlFixed(w + f(x, y, z) + data, s) + x
4849 MD5STEP(
F1, a, b, c, d, in[0] + 0xd76aa478, 7);
4850 MD5STEP(
F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
4851 MD5STEP(
F1, c, d, a, b, in[2] + 0x242070db, 17);
4852 MD5STEP(
F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
4853 MD5STEP(
F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
4854 MD5STEP(
F1, d, a, b, c, in[5] + 0x4787c62a, 12);
4855 MD5STEP(
F1, c, d, a, b, in[6] + 0xa8304613, 17);
4856 MD5STEP(
F1, b, c, d, a, in[7] + 0xfd469501, 22);
4857 MD5STEP(
F1, a, b, c, d, in[8] + 0x698098d8, 7);
4858 MD5STEP(
F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
4859 MD5STEP(
F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
4860 MD5STEP(
F1, b, c, d, a, in[11] + 0x895cd7be, 22);
4861 MD5STEP(
F1, a, b, c, d, in[12] + 0x6b901122, 7);
4862 MD5STEP(
F1, d, a, b, c, in[13] + 0xfd987193, 12);
4863 MD5STEP(
F1, c, d, a, b, in[14] + 0xa679438e, 17);
4864 MD5STEP(
F1, b, c, d, a, in[15] + 0x49b40821, 22);
4866 MD5STEP(
F2, a, b, c, d, in[1] + 0xf61e2562, 5);
4867 MD5STEP(
F2, d, a, b, c, in[6] + 0xc040b340, 9);
4868 MD5STEP(
F2, c, d, a, b, in[11] + 0x265e5a51, 14);
4869 MD5STEP(
F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
4870 MD5STEP(
F2, a, b, c, d, in[5] + 0xd62f105d, 5);
4871 MD5STEP(
F2, d, a, b, c, in[10] + 0x02441453, 9);
4872 MD5STEP(
F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
4873 MD5STEP(
F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
4874 MD5STEP(
F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
4875 MD5STEP(
F2, d, a, b, c, in[14] + 0xc33707d6, 9);
4876 MD5STEP(
F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
4877 MD5STEP(
F2, b, c, d, a, in[8] + 0x455a14ed, 20);
4878 MD5STEP(
F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
4879 MD5STEP(
F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
4880 MD5STEP(
F2, c, d, a, b, in[7] + 0x676f02d9, 14);
4881 MD5STEP(
F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
4883 MD5STEP(
F3, a, b, c, d, in[5] + 0xfffa3942, 4);
4884 MD5STEP(
F3, d, a, b, c, in[8] + 0x8771f681, 11);
4885 MD5STEP(
F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
4886 MD5STEP(
F3, b, c, d, a, in[14] + 0xfde5380c, 23);
4887 MD5STEP(
F3, a, b, c, d, in[1] + 0xa4beea44, 4);
4888 MD5STEP(
F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
4889 MD5STEP(
F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
4890 MD5STEP(
F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
4891 MD5STEP(
F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
4892 MD5STEP(
F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
4893 MD5STEP(
F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
4894 MD5STEP(
F3, b, c, d, a, in[6] + 0x04881d05, 23);
4895 MD5STEP(
F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
4896 MD5STEP(
F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
4897 MD5STEP(
F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
4898 MD5STEP(
F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
4900 MD5STEP(
F4, a, b, c, d, in[0] + 0xf4292244, 6);
4901 MD5STEP(
F4, d, a, b, c, in[7] + 0x432aff97, 10);
4902 MD5STEP(
F4, c, d, a, b, in[14] + 0xab9423a7, 15);
4903 MD5STEP(
F4, b, c, d, a, in[5] + 0xfc93a039, 21);
4904 MD5STEP(
F4, a, b, c, d, in[12] + 0x655b59c3, 6);
4905 MD5STEP(
F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
4906 MD5STEP(
F4, c, d, a, b, in[10] + 0xffeff47d, 15);
4907 MD5STEP(
F4, b, c, d, a, in[1] + 0x85845dd1, 21);
4908 MD5STEP(
F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
4909 MD5STEP(
F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
4910 MD5STEP(
F4, c, d, a, b, in[6] + 0xa3014314, 15);
4911 MD5STEP(
F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
4912 MD5STEP(
F4, a, b, c, d, in[4] + 0xf7537e82, 6);
4913 MD5STEP(
F4, d, a, b, c, in[11] + 0xbd3af235, 10);
4914 MD5STEP(
F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
4915 MD5STEP(
F4, b, c, d, a, in[9] + 0xeb86d391, 21);
4929 void svd(
const int nm,
const int m,
const int n,
double *a,
4930 double *w,
bool matu,
double *u,
bool matv,
4931 double *v,
int *ierr,
double *rv1)
4937 double scale, anorm;
5004 const int v_dim1 = nm;
5005 const int v_offset = 1 + v_dim1;
5007 const int u_dim1 = nm;
5008 const int u_offset = 1 + u_dim1;
5011 const int a_dim1 = nm;
5012 const int a_offset = 1 + a_dim1;
5017 for (i = 1; i <= m; ++i)
5019 for (j = 1; j <= n; ++j)
5021 u[i + j * u_dim1] = a[i + j * a_dim1];
5029 for (i = 1; i <= n; ++i)
5037 for (k = i; k <= m; ++k)
5039 scale += fabs(u[k + i * u_dim1]);
5044 for (k = i; k <= m; ++k)
5046 u[k + i * u_dim1] /= scale;
5047 double d__1 = u[k + i * u_dim1];
5051 f = u[i + i * u_dim1];
5052 g = -copysign(sqrt(s), f);
5054 u[i + i * u_dim1] = f - g;
5057 for (j = l; j <= n; ++j)
5060 for (k = i; k <= m; ++k)
5062 s += u[k + i * u_dim1] * u[k + j * u_dim1];
5066 for (k = i; k <= m; ++k)
5068 u[k + j * u_dim1] += f * u[k + i * u_dim1];
5072 for (k = i; k <= m; ++k)
5074 u[k + i * u_dim1] = scale * u[k + i * u_dim1];
5082 if (i <= m && i != n)
5084 for (k = l; k <= n; ++k)
5086 scale += fabs(u[i + k * u_dim1]);
5091 for (k = l; k <= n; ++k)
5093 u[i + k * u_dim1] /= scale;
5094 double d__1 = u[i + k * u_dim1];
5098 f = u[i + l * u_dim1];
5099 g = -copysign(sqrt(s), f);
5101 u[i + l * u_dim1] = f - g;
5103 for (k = l; k <= n; ++k)
5105 rv1[k] = u[i + k * u_dim1] / h;
5110 for (j = l; j <= m; ++j)
5113 for (k = l; k <= n; ++k)
5115 s += u[j + k * u_dim1] * u[i + k * u_dim1];
5117 for (k = l; k <= n; ++k)
5119 u[j + k * u_dim1] += s * rv1[k];
5123 for (k = l; k <= n; ++k)
5125 u[i + k * u_dim1] = scale * u[i + k * u_dim1];
5129 anorm = fmax(anorm,fabs(w[i]) + fabs(rv1[i]));
5136 for (
int ii = 1; ii <= n; ++ii)
5144 for (j = l; j <= n; ++j)
5147 v[j + i * v_dim1] = u[i + j * u_dim1] / u[i + l * u_dim1] / g;
5150 for (j = l; j <= n; ++j)
5153 for (k = l; k <= n; ++k)
5155 s += u[i + k * u_dim1] * v[k + j * v_dim1];
5158 for (k = l; k <= n; ++k)
5160 v[k + j * v_dim1] += s * v[k + i * v_dim1];
5164 for (j = l; j <= n; ++j) {
5165 v[i + j * v_dim1] = 0.;
5166 v[j + i * v_dim1] = 0.;
5169 v[i + i * v_dim1] = 1.;
5185 for (
int ii = 1; ii <= mn; ++ii)
5192 for (j = l; j <= n; ++j)
5194 u[i + j * u_dim1] = 0.;
5202 for (j = l; j <= n; ++j)
5205 for (k = l; k <= m; ++k)
5207 s += u[k + i * u_dim1] * u[k + j * u_dim1];
5210 f = s / u[i + i * u_dim1] / g;
5212 for (k = i; k <= m; ++k)
5214 u[k + j * u_dim1] += f * u[k + i * u_dim1];
5219 for (j = i; j <= m; ++j)
5221 u[j + i * u_dim1] /= g;
5226 for (j = i; j <= m; ++j)
5228 u[j + i * u_dim1] = 0.;
5231 u[i + i * u_dim1] += 1.;
5236 for (
int kk = 1; kk <= n; ++kk)
5245 for (
int ll = 1; ll <= k; ++ll)
5251 if (fabs(rv1[l]) + anorm == anorm)
5255 if (fabs(w[l1]) + anorm == anorm)
5261 for (i = l; i <= k; ++i)
5264 rv1[i] = c * rv1[i];
5265 if (fabs(f) + anorm == anorm)
5270 h = sqrt(f * f + g * g);
5276 for (j = 1; j <= m; ++j)
5278 y = u[j + l1 * u_dim1];
5279 z = u[j + i * u_dim1];
5280 u[j + l1 * u_dim1] = y * c + z * s;
5281 u[j + i * u_dim1] = -y * s + z * c;
5309 f = ((y - z) * (y + z) + (g - h) * (g + h)) / (h * 2. * y);
5310 g = sqrt(f * f + 1.);
5311 f = ((x - z) * (x + z) + h * (y / (f + copysign(g, f)) - h)) / x;
5316 for (i1 = l; i1 <= k1; ++i1)
5323 z = sqrt(f * f + h * h);
5333 for (j = 1; j <= n; ++j)
5335 x = v[j + i1 * v_dim1];
5336 z = v[j + i * v_dim1];
5337 v[j + i1 * v_dim1] = x * c + z * s;
5338 v[j + i * v_dim1] = -x * s + z * c;
5342 z = sqrt(f * f + h * h);
5354 for (j = 1; j <= m; ++j)
5356 y = u[j + i1 * u_dim1];
5357 z = u[j + i * u_dim1];
5358 u[j + i1 * u_dim1] = y * c + z * s;
5359 u[j + i * u_dim1] = -y * s + z * c;
5375 for (j = 1; j <= n; ++j)
5377 v[j + k * v_dim1] = -v[j + k * v_dim1];
void bessel_i0_i1(double x, double *i0val, double *i1val)
double bessel_k0_scaled(double x)
static const double b1_QQ[7]
static const double BESSEL_K1_Q1[]
string MD5datastream(fstream &ioFile)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
double bessel_i1_scaled(double x)
double ratevl_7_8(double x, const double a[7], const double b[8])
static unsigned long * nexxt
NORETURN void TotalInsanity(void)
void chbfit(double a, double b, vector< double > &c, double(*func)(double))
static const double b0_YP[8]
double ratevl_15_6(double x, const double a[15], const double b[6])
static const double SQ2OPI
void svd(const int nm, const int m, const int n, double *a, double *w, bool matu, double *u, bool matv, double *v, int *ierr, double *rv1)
double lfactorial(long n)
double bessel_i1(double x)
double SixJFull(long j1, long j2, long j3, long j4, long j5, long j6)
realnum FastVoigtH(realnum a, realnum v)
static const double BESSEL_K1_P3[]
double p1evl(double x, const double coef[], int N)
bool Triangle2(long J1, long J2, long J3)
static const double BESSEL_K1_Q3[]
static const double b0_PP[7]
static const double BESSEL_I1_Q2[]
static const double igam_big
static const double BESSEL_I0_Q1[]
uint32 rotlFixed(uint32 x, unsigned int y)
static const double TWOOPI
static const double b0_QP[8]
static const double elk_Q[]
double Delta(long j1, long j2, long j3)
unsigned long genrand_int32()
static const double b1_PQ[7]
STATIC void order(long, realnum[], long *, long *, long *)
string MD5datafile(const char *fnam, access_scheme scheme)
double sjs(long j1, long j2, long j3, long l1, long l2, long l3)
static const double BESSEL_I0_Q2[]
void bessel_i0_i1_scaled(double x, double *i0val, double *i1val)
double expn(int n, double x)
static const double BESSEL_K1_P1[]
complex< double > cdgamma(complex< double > x)
static const double BESSEL_K0_P3[]
bool little_endian() const
double ratevl_6_3(double x, const double a[6], const double b[3])
void bessel_k0_k1(double x, double *k0val, double *k1val)
void vexp(const double x[], double y[], long nlo, long nhi)
static const int NPRE_FACTORIAL
double dawson(double x, int order)
double ratevl_11_10(double x, const double a[11], const double b[10])
void init_by_array(unsigned long init_key[], int key_length)
double bessel_k1(double x)
static const unsigned long MATRIX_A
static const double tbl_dawson[N_DAWSON+1]
const ios_base::openmode mode_r
double bessel_i0_scaled(double x)
static const double b0_QQ[7]
double bessel_i0(double x)
double bessel_jn(int n, double x)
void bessel_k0_k1_scaled(double x, double *k0val, double *k1val)
static const double b0_PQ[7]
static const double BESSEL_K0_P1[]
static const double THPIO4
double bessel_y0(double x)
STATIC void MD5_Transform(uint32 *digest, const uint32 *in)
double ratevl_5_4(double x, const double a[5], const double b[4])
string MD5file(const char *fnam, access_scheme scheme)
const int INPUT_LINE_LENGTH
static const double BESSEL_K0_Q1[]
double expn2_scaled(double x)
double bessel_j0(double x)
double powi(double, long int)
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
static const double b1_PP[7]
double bessel_j1(double x)
static const double pre_factorial[NPRE_FACTORIAL]
static const double BESSEL_I1_P1[]
double igamc(double a, double x)
double ratevl_8_7(double x, const double a[8], const double b[7])
static const double BESSEL_K0_P2[]
static const double b1_RP[4]
bool linfit(long n, const double xorg[], const double yorg[], double &a, double &siga, double &b, double &sigb)
static const unsigned long UMASK
static const double BESSEL_K1_P2[]
double igam(double a, double x)
static const double b1_QP[8]
double ratevl_10_11(double x, const double a[10], const double b[11])
STATIC double igamc_fraction(double a, double x)
double bessel_yn(int n, double x)
static const double BESSEL_I1_P2[]
double bessel_k1_scaled(double x)
double chbevl(double, const double[], int)
unsigned long TWIST(unsigned long u, unsigned long v)
#define DEBUG_ENTRY(funcname)
static const double b1_YQ[8]
unsigned long MIXBITS(unsigned long u, unsigned long v)
void humlik(int n, const realnum x[], realnum y, realnum k[])
double bessel_y1(double x)
#define MD5STEP(f, w, x, y, z, data, s)
double e1_scaled(double x)
static const unsigned long LMASK
void rec6j(double *sixcof, double l2, double l3, double l4, double l5, double l6, double *l1min, double *l1max, double *lmatch, long ndim, long *ier)
double ratevl_6_4(double x, const double a[6], const double b[4])
int fprintf(const Output &stream, const char *format,...)
static const double BESSEL_K1_Q2[]
static const double BESSEL_K0_Q3[]
double igamc_scaled(double a, double x)
double polevl(double x, const double coef[], int N)
static const double b0_YQ[7]
double get_lfact(unsigned long n)
void init_genrand(unsigned long s)
static const double BESSEL_I0_P2[]
static const double BESSEL_K0_Q2[]
double gegenbauer(long n, double al, double x)
static const double elk_P[]
static const double BESSEL_I0_P1[]
STATIC uint32 MD5swap(uint32 word)
static const double b1_YP[6]
double bessel_k0(double x)
string MD5string(const string &str)
static const double MAXLOG
static const double b1_RQ[8]
static const double igam_biginv
static const double dsf[MXDSF]
static const double BESSEL_I1_Q1[]