/* j0.c
*
* Bessel function of order zero
*
*
*
* SYNOPSIS :
*
* double x , y , j0 ( ) ;
*
* y = j0 ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns Bessel function of order zero of the argument .
*
* The domain is divided into the intervals [ 0 , 5 ] and
* ( 5 , infinity ) . In the first interval the following rational
* approximation is used :
*
*
* 2 2
* ( w - r ) ( w - r ) P ( w ) / Q ( w )
* 1 2 3 8
*
* 2
* where w = x and the two r ' s are zeros of the function .
*
* In the second interval , the Hankel asymptotic expansion
* is employed with two rational functions of degree 6 / 6
* and 7 / 7 .
*
*
*
* ACCURACY :
*
* Absolute error :
* arithmetic domain # trials peak rms
* DEC 0 , 30 10000 4 . 4 e - 17 6 . 3 e - 18
* IEEE 0 , 30 60000 4 . 2 e - 16 1 . 1 e - 16
*
*/
/* y0.c
*
* Bessel function of the second kind , order zero
*
*
*
* SYNOPSIS :
*
* double x , y , y0 ( ) ;
*
* y = y0 ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns Bessel function of the second kind , of order
* zero , of the argument .
*
* The domain is divided into the intervals [ 0 , 5 ] and
* ( 5 , infinity ) . In the first interval a rational approximation
* R ( x ) is employed to compute
* y0 ( x ) = R ( x ) + 2 * log ( x ) * j0 ( x ) / PI .
* Thus a call to j0 ( ) is required .
*
* In the second interval , the Hankel asymptotic expansion
* is employed with two rational functions of degree 6 / 6
* and 7 / 7 .
*
*
*
* ACCURACY :
*
* Absolute error , when y0 ( x ) < 1 ; else relative error :
*
* arithmetic domain # trials peak rms
* DEC 0 , 30 9400 7 . 0 e - 17 7 . 9 e - 18
* IEEE 0 , 30 30000 1 . 3 e - 15 1 . 6 e - 16
*
*/
/*
Cephes Math Library Release 2 . 8 : June , 2000
Copyright 1984 , 1987 , 1989 , 2000 by Stephen L . Moshier
*/
/* Note: all coefficients satisfy the relative error criterion
* except YP, YQ which are designed for absolute error. */
#include "mconf.h"
#ifdef UNK
static double PP[7 ] = {
7 .96936729297347051624 E-4 , 8 .28352392107440799803 E-2 ,
1 .23953371646414299388 E0, 5 .44725003058768775090 E0,
8 .74716500199817011941 E0, 5 .30324038235394892183 E0,
9 .99999999999999997821 E-1 ,
};
static double PQ[7 ] = {
9 .24408810558863637013 E-4 , 8 .56288474354474431428 E-2 ,
1 .25352743901058953537 E0, 5 .47097740330417105182 E0,
8 .76190883237069594232 E0, 5 .30605288235394617618 E0,
1 .00000000000000000218 E0,
};
#endif
#ifdef DEC
static unsigned short PP[28 ] = {
0035520 , 0164604 , 0140733 , 0054470 , 0037251 , 0122605 , 0115356 ,
0107170 , 0040236 , 0124412 , 0071500 , 0056303 , 0040656 , 0047737 ,
0045720 , 0045263 , 0041013 , 0172143 , 0045004 , 0142103 , 0040651 ,
0132045 , 0026241 , 0026406 , 0040200 , 0000000 , 0000000 , 0000000 ,
};
static unsigned short PQ[28 ] = {
0035562 , 0052006 , 0070034 , 0134666 , 0037257 , 0057055 , 0055242 ,
0123424 , 0040240 , 0071626 , 0046630 , 0032371 , 0040657 , 0011077 ,
0032013 , 0012731 , 0041014 , 0030307 , 0050331 , 0006414 , 0040651 ,
0145457 , 0065021 , 0150304 , 0040200 , 0000000 , 0000000 , 0000000 ,
};
#endif
#ifdef IBMPC
static unsigned short PP[28 ] = {
0 x6b27, 0 x983b, 0 x1d30, 0 x3f4a, 0 xd1cf, 0 xb35d, 0 x34b0,
0 x3fb5, 0 x0b98, 0 x4e68, 0 xd521, 0 x3ff3, 0 x0956, 0 xe97a,
0 xc9fb, 0 x4015, 0 x9888, 0 x6940, 0 x7e8c, 0 x4021, 0 x25a1,
0 xa594, 0 x3684, 0 x4015, 0 x0000, 0 x0000, 0 x0000, 0 x3ff0,
};
static unsigned short PQ[28 ] = {
0 x9737, 0 xce03, 0 x4a80, 0 x3f4e, 0 x54e3, 0 xab54, 0 xebc5,
0 x3fb5, 0 x069f, 0 xc9b3, 0 x0e72, 0 x3ff4, 0 x62bb, 0 xe681,
0 xe247, 0 x4015, 0 x21a1, 0 xea1b, 0 x8618, 0 x4021, 0 x3a19,
0 xed42, 0 x3965, 0 x4015, 0 x0000, 0 x0000, 0 x0000, 0 x3ff0,
};
#endif
#ifdef MIEEE
static unsigned short PP[28 ] = {
0 x3f4a, 0 x1d30, 0 x983b, 0 x6b27, 0 x3fb5, 0 x34b0, 0 xb35d,
0 xd1cf, 0 x3ff3, 0 xd521, 0 x4e68, 0 x0b98, 0 x4015, 0 xc9fb,
0 xe97a, 0 x0956, 0 x4021, 0 x7e8c, 0 x6940, 0 x9888, 0 x4015,
0 x3684, 0 xa594, 0 x25a1, 0 x3ff0, 0 x0000, 0 x0000, 0 x0000,
};
static unsigned short PQ[28 ] = {
0 x3f4e, 0 x4a80, 0 xce03, 0 x9737, 0 x3fb5, 0 xebc5, 0 xab54,
0 x54e3, 0 x3ff4, 0 x0e72, 0 xc9b3, 0 x069f, 0 x4015, 0 xe247,
0 xe681, 0 x62bb, 0 x4021, 0 x8618, 0 xea1b, 0 x21a1, 0 x4015,
0 x3965, 0 xed42, 0 x3a19, 0 x3ff0, 0 x0000, 0 x0000, 0 x0000,
};
#endif
#ifdef UNK
static double QP[8 ] = {
-1 .13663838898469149931 E-2 , -1 .28252718670509318512 E0,
-1 .95539544257735972385 E1, -9 .32060152123768231369 E1,
-1 .77681167980488050595 E2, -1 .47077505154951170175 E2,
-5 .14105326766599330220 E1, -6 .05014350600728481186 E0,
};
static double QQ[7 ] = {
/* 1.00000000000000000000E0,*/
6 .43178256118178023184 E1, 8 .56430025976980587198 E2,
3 .88240183605401609683 E3, 7 .24046774195652478189 E3,
5 .93072701187316984827 E3, 2 .06209331660327847417 E3,
2 .42005740240291393179 E2,
};
#endif
#ifdef DEC
static unsigned short QP[32 ] = {
0136472 , 0035021 , 0142451 , 0141115 , 0140244 , 0024731 , 0150620 , 0105642 ,
0141234 , 0067177 , 0124161 , 0060141 , 0141672 , 0064572 , 0151557 , 0043036 ,
0142061 , 0127141 , 0003127 , 0043517 , 0142023 , 0011727 , 0060271 , 0144544 ,
0141515 , 0122142 , 0126620 , 0143150 , 0140701 , 0115306 , 0106715 , 0007344 ,
};
static unsigned short QQ[28 ] = {
/*0040200,0000000,0000000,0000000,*/
0041600 , 0121272 , 0004741 , 0026544 , 0042526 , 0015605 , 0105654 ,
0161771 , 0043162 , 0123155 , 0165644 , 0062645 , 0043342 , 0041675 ,
0167576 , 0130756 , 0043271 , 0052720 , 0165631 , 0154214 , 0043000 ,
0160576 , 0034614 , 0172024 , 0042162 , 0000570 , 0030500 , 0051235 ,
};
#endif
#ifdef IBMPC
static unsigned short QP[32 ] = {
0 x384a, 0 x38a5, 0 x4742, 0 xbf87, 0 x1174, 0 x3a32, 0 x853b, 0 xbff4,
0 x2c0c, 0 xf50e, 0 x8dcf, 0 xc033, 0 xe8c4, 0 x5a6d, 0 x4d2f, 0 xc057,
0 xe8ea, 0 x20ca, 0 x35cc, 0 xc066, 0 x392d, 0 xec17, 0 x627a, 0 xc062,
0 x18cd, 0 x55b2, 0 xb48c, 0 xc049, 0 xa1dd, 0 xd1b9, 0 x3358, 0 xc018,
};
static unsigned short QQ[28 ] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 x25ac, 0 x413c, 0 x1457, 0 x4050, 0 x9c7f, 0 xb175, 0 xc370,
0 x408a, 0 x8cb5, 0 xbd74, 0 x54cd, 0 x40ae, 0 xd63e, 0 xbdef,
0 x4877, 0 x40bc, 0 x3b11, 0 x1d73, 0 x2aba, 0 x40b7, 0 x9e82,
0 xc731, 0 x1c2f, 0 x40a0, 0 x0a54, 0 x0628, 0 x402f, 0 x406e,
};
#endif
#ifdef MIEEE
static unsigned short QP[32 ] = {
0 xbf87, 0 x4742, 0 x38a5, 0 x384a, 0 xbff4, 0 x853b, 0 x3a32, 0 x1174,
0 xc033, 0 x8dcf, 0 xf50e, 0 x2c0c, 0 xc057, 0 x4d2f, 0 x5a6d, 0 xe8c4,
0 xc066, 0 x35cc, 0 x20ca, 0 xe8ea, 0 xc062, 0 x627a, 0 xec17, 0 x392d,
0 xc049, 0 xb48c, 0 x55b2, 0 x18cd, 0 xc018, 0 x3358, 0 xd1b9, 0 xa1dd,
};
static unsigned short QQ[28 ] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 x4050, 0 x1457, 0 x413c, 0 x25ac, 0 x408a, 0 xc370, 0 xb175,
0 x9c7f, 0 x40ae, 0 x54cd, 0 xbd74, 0 x8cb5, 0 x40bc, 0 x4877,
0 xbdef, 0 xd63e, 0 x40b7, 0 x2aba, 0 x1d73, 0 x3b11, 0 x40a0,
0 x1c2f, 0 xc731, 0 x9e82, 0 x406e, 0 x402f, 0 x0628, 0 x0a54,
};
#endif
#ifdef UNK
static double YP[8 ] = {
1 .55924367855235737965 E4, -1 .46639295903971606143 E7,
5 .43526477051876500413 E9, -9 .82136065717911466409 E11,
8 .75906394395366999549 E13, -3 .46628303384729719441 E15,
4 .42733268572569800351 E16, -1 .84950800436986690637 E16,
};
static double YQ[7 ] = {
/* 1.00000000000000000000E0,*/
1 .04128353664259848412 E3, 6 .26107330137134956842 E5,
2 .68919633393814121987 E8, 8 .64002487103935000337 E10,
2 .02979612750105546709 E13, 3 .17157752842975028269 E15,
2 .50596256172653059228 E17,
};
#endif
#ifdef DEC
static unsigned short YP[32 ] = {
0043563 , 0120677 , 0042264 , 0046166 , 0146137 , 0140371 , 0113444 , 0042260 ,
0050241 , 0175707 , 0100502 , 0063344 , 0152144 , 0125737 , 0007265 , 0164526 ,
0053637 , 0051621 , 0163035 , 0060546 , 0155105 , 0004416 , 0107306 , 0060023 ,
0056035 , 0045133 , 0030132 , 0000024 , 0155603 , 0065132 , 0144061 , 0131732 ,
};
static unsigned short YQ[28 ] = {
/*0040200,0000000,0000000,0000000,*/
0042602 , 0024422 , 0135557 , 0162663 , 0045030 , 0155665 , 0044075 ,
0160135 , 0047200 , 0035432 , 0105446 , 0104005 , 0051240 , 0167331 ,
0056063 , 0022743 , 0053223 , 0127746 , 0025764 , 0012160 , 0055064 ,
0044206 , 0177532 , 0145545 , 0056536 , 0111375 , 0163715 , 0127201 ,
};
#endif
#ifdef IBMPC
static unsigned short YP[32 ] = {
0 x898f, 0 xe896, 0 x7437, 0 x40ce, 0 x8896, 0 x32e4, 0 xf81f, 0 xc16b,
0 x4cdd, 0 xf028, 0 x3f78, 0 x41f4, 0 xbd2b, 0 xe1d6, 0 x957b, 0 xc26c,
0 xac2d, 0 x3cc3, 0 xea72, 0 x42d3, 0 xcc02, 0 xd1d8, 0 xa121, 0 xc328,
0 x4003, 0 x660b, 0 xa94b, 0 x4363, 0 x367b, 0 x5906, 0 x6d4b, 0 xc350,
};
static unsigned short YQ[28 ] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 xfcb6, 0 x576d, 0 x4522, 0 x4090, 0 xbc0c, 0 xa907, 0 x1b76,
0 x4123, 0 xd101, 0 x5164, 0 x0763, 0 x41b0, 0 x64bc, 0 x2b86,
0 x1ddb, 0 x4234, 0 x828e, 0 xc57e, 0 x75fc, 0 x42b2, 0 x596d,
0 xdfeb, 0 x8910, 0 x4326, 0 xb5d0, 0 xbcf9, 0 xd25f, 0 x438b,
};
#endif
#ifdef MIEEE
static unsigned short YP[32 ] = {
0 x40ce, 0 x7437, 0 xe896, 0 x898f, 0 xc16b, 0 xf81f, 0 x32e4, 0 x8896,
0 x41f4, 0 x3f78, 0 xf028, 0 x4cdd, 0 xc26c, 0 x957b, 0 xe1d6, 0 xbd2b,
0 x42d3, 0 xea72, 0 x3cc3, 0 xac2d, 0 xc328, 0 xa121, 0 xd1d8, 0 xcc02,
0 x4363, 0 xa94b, 0 x660b, 0 x4003, 0 xc350, 0 x6d4b, 0 x5906, 0 x367b,
};
static unsigned short YQ[28 ] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 x4090, 0 x4522, 0 x576d, 0 xfcb6, 0 x4123, 0 x1b76, 0 xa907,
0 xbc0c, 0 x41b0, 0 x0763, 0 x5164, 0 xd101, 0 x4234, 0 x1ddb,
0 x2b86, 0 x64bc, 0 x42b2, 0 x75fc, 0 xc57e, 0 x828e, 0 x4326,
0 x8910, 0 xdfeb, 0 x596d, 0 x438b, 0 xd25f, 0 xbcf9, 0 xb5d0,
};
#endif
#ifdef UNK
/* 5.783185962946784521175995758455807035071 */
static double DR1 = 5 .78318596294678452118 E0;
/* 30.47126234366208639907816317502275584842 */
static double DR2 = 3 .04712623436620863991 E1;
#endif
#ifdef DEC
static unsigned short R1[] = {0040671 , 0007734 , 0001061 , 0056734 };
#define DR1 *(double *)R1
static unsigned short R2[] = {0041363 , 0142445 , 0030416 , 0165567 };
#define DR2 *(double *)R2
#endif
#ifdef IBMPC
static unsigned short R1[] = {0 x2bbb, 0 x8046, 0 x21fb, 0 x4017};
#define DR1 *(double *)R1
static unsigned short R2[] = {0 xdd6f, 0 xa621, 0 x78a4, 0 x403e};
#define DR2 *(double *)R2
#endif
#ifdef MIEEE
static unsigned short R1[] = {0 x4017, 0 x21fb, 0 x8046, 0 x2bbb};
#define DR1 *(double *)R1
static unsigned short R2[] = {0 x403e, 0 x78a4, 0 xa621, 0 xdd6f};
#define DR2 *(double *)R2
#endif
#ifdef UNK
static double RP[4 ] = {
-4 .79443220978201773821 E9,
1 .95617491946556577543 E12,
-2 .49248344360967716204 E14,
9 .70862251047306323952 E15,
};
static double RQ[8 ] = {
/* 1.00000000000000000000E0,*/
4 .99563147152651017219 E2, 1 .73785401676374683123 E5,
4 .84409658339962045305 E7, 1 .11855537045356834862 E10,
2 .11277520115489217587 E12, 3 .10518229857422583814 E14,
3 .18121955943204943306 E16, 1 .71086294081043136091 E18,
};
#endif
#ifdef DEC
static unsigned short RP[16 ] = {
0150216 , 0161235 , 0064344 , 0014450 , 0052343 , 0135216 , 0035624 , 0144153 ,
0154142 , 0130247 , 0003310 , 0003667 , 0055411 , 0173703 , 0047772 , 0176635 ,
};
static unsigned short RQ[32 ] = {
/*0040200,0000000,0000000,0000000,*/
0042371 , 0144025 , 0032265 , 0136137 , 0044451 , 0133131 , 0132420 , 0151466 ,
0046470 , 0144641 , 0072540 , 0030636 , 0050446 , 0126600 , 0045042 , 0044243 ,
0052365 , 0172633 , 0110301 , 0071063 , 0054215 , 0032424 , 0062272 , 0043513 ,
0055742 , 0005013 , 0171731 , 0072335 , 0057275 , 0170646 , 0036663 , 0013134 ,
};
#endif
#ifdef IBMPC
static unsigned short RP[16 ] = {
0 x8325, 0 xad1c, 0 xdc53, 0 xc1f1, 0 x990d, 0 xc772, 0 x7751, 0 x427c,
0 x00f7, 0 xe0d9, 0 x5614, 0 xc2ec, 0 x5fb4, 0 x69ff, 0 x3ef8, 0 x4341,
};
static unsigned short RQ[32 ] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 xb78c, 0 xa696, 0 x3902, 0 x407f, 0 x1a67, 0 x36a2, 0 x36cb, 0 x4105,
0 x0634, 0 x2eac, 0 x1934, 0 x4187, 0 x4914, 0 x0944, 0 xd5b0, 0 x4204,
0 x2e46, 0 x7218, 0 xbeb3, 0 x427e, 0 x48e9, 0 x8c97, 0 xa6a2, 0 x42f1,
0 x2e9c, 0 x7e7b, 0 x4141, 0 x435c, 0 x62cc, 0 xc7b6, 0 xbe34, 0 x43b7,
};
#endif
#ifdef MIEEE
static unsigned short RP[16 ] = {
0 xc1f1, 0 xdc53, 0 xad1c, 0 x8325, 0 x427c, 0 x7751, 0 xc772, 0 x990d,
0 xc2ec, 0 x5614, 0 xe0d9, 0 x00f7, 0 x4341, 0 x3ef8, 0 x69ff, 0 x5fb4,
};
static unsigned short RQ[32 ] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 x407f, 0 x3902, 0 xa696, 0 xb78c, 0 x4105, 0 x36cb, 0 x36a2, 0 x1a67,
0 x4187, 0 x1934, 0 x2eac, 0 x0634, 0 x4204, 0 xd5b0, 0 x0944, 0 x4914,
0 x427e, 0 xbeb3, 0 x7218, 0 x2e46, 0 x42f1, 0 xa6a2, 0 x8c97, 0 x48e9,
0 x435c, 0 x4141, 0 x7e7b, 0 x2e9c, 0 x43b7, 0 xbe34, 0 xc7b6, 0 x62cc,
};
#endif
#ifdef ANSIPROT
extern double polevl(double , void *, int );
extern double p1evl(double , void *, int );
extern double log(double );
extern double sin(double );
extern double cos(double );
extern double sqrt(double );
double j0(double );
#else
double polevl(), p1evl(), log(), sin(), cos(), sqrt();
double j0();
#endif
extern double TWOOPI, SQ2OPI, PIO4;
double j0(x) double x;
{
double w, z, p, q, xn;
if (x < 0 )
x = -x;
if (x <= 5 .0 ) {
z = x * x;
if (x < 1 .0 e-5 )
return (1 .0 - z / 4 .0 );
p = (z - DR1) * (z - DR2);
p = p * polevl(z, RP, 3 ) / p1evl(z, RQ, 8 );
return (p);
}
w = 5 .0 / x;
q = 25 .0 / (x * x);
p = polevl(q, PP, 6 ) / polevl(q, PQ, 6 );
q = polevl(q, QP, 7 ) / p1evl(q, QQ, 7 );
xn = x - PIO4;
p = p * cos(xn) - w * q * sin(xn);
return (p * SQ2OPI / sqrt(x));
}
/* y0() 2 */
/* Bessel function of second kind, order zero */
/* Rational approximation coefficients YP[], YQ[] are used here.
* The function computed is y0 ( x ) - 2 * log ( x ) * j0 ( x ) / PI ,
* whose value at x = 0 is 2 * ( log ( 0 . 5 ) + EUL ) / PI
* = 0 . 073804295108687225 .
*/
/*
# define PIO4 . 78539816339744830962
# define SQ2OPI . 79788456080286535588
*/
extern double MAXNUM;
double y0(x) double x;
{
double w, z, p, q, xn;
if (x <= 5 .0 ) {
if (x <= 0 .0 ) {
mtherr("y0" , DOMAIN);
return (-MAXNUM);
}
z = x * x;
w = polevl(z, YP, 7 ) / p1evl(z, YQ, 7 );
w += TWOOPI * log(x) * j0(x);
return (w);
}
w = 5 .0 / x;
z = 25 .0 / (x * x);
p = polevl(z, PP, 6 ) / polevl(z, PQ, 6 );
q = polevl(z, QP, 7 ) / p1evl(z, QQ, 7 );
xn = x - PIO4;
p = p * sin(xn) + w * q * cos(xn);
return (p * SQ2OPI / sqrt(x));
}
Messung V0.5 in Prozent C=96 H=94 G=94