67 cc =
SQR( cos( phi ) );
68 q = ( 1.0 - s * ak ) * ( 1.0 + s * ak );
83 double s, enss, cc, q;
86 cc =
SQR( cos( phi ) );
87 q = ( 1.0 - s * ak ) * ( 1.0 + s * ak );
106 #define RF_ERRTOL 0.0025 109 #define RF_TINY ( DBL_MIN * 5. ) 110 #define RF_BIG ( DBL_MAX / 5. ) 111 #define RF_THIRD ( 1.0/3.0 ) 112 #define RF_C1 ( 1.0/24.0 ) 114 #define RF_C3 ( 3.0/44.0 ) 115 #define RF_C4 ( 1.0/14.0 ) 119 double alamb, ave, delx, dely, delz, e2, e3, sqrtx, sqrty, sqrtz, xt, yt, zt;
121 if (
MIN(
MIN( x, y ), z ) < 0.0 ||
124 _errorr1(
"legendreIntegrals::rf: invalid argument(s)\n" );
135 alamb = sqrtx * ( sqrty + sqrtz ) + sqrty * sqrtz;
136 xt = 0.25 * ( xt + alamb );
137 yt = 0.25 * ( yt + alamb );
138 zt = 0.25 * ( zt + alamb );
140 delx = ( ave - xt )/ave;
141 dely = ( ave - yt )/ave;
142 delz = ( ave - zt )/ave;
145 e2 = delx * dely - delz * delz;
146 e3 = delx * dely * delz;
161 #define RD_ERRTOL 0.0015 164 #define RD_TINY ( 2. * pow( DBL_MAX, (-2./3.) ) ) 165 #define RD_BIG ( 0.1 * RD_ERRTOL * pow( DBL_MIN, (-2./3.) ) ) 166 #define RD_C1 ( 3.0/14.0 ) 167 #define RD_C2 ( 1.0/6.0 ) 168 #define RD_C3 ( 9.0/22.0 ) 169 #define RD_C4 ( 3.0/26.0 ) 170 #define RD_C5 ( 0.25 * RD_C3 ) 171 #define RD_C6 ( 1.5 * RD_C4 ) 175 double alamb, ave, delx, dely, delz, ea, eb, ec, ed, ee, fac, sqrtx, sqrty, sqrtz, sum, xt, yt, zt;
178 _errorr(
"legendreIntegrals::rd: invalid argument(s)\n" );
191 alamb = sqrtx * ( sqrty + sqrtz ) + sqrty * sqrtz;
192 sum += fac/( sqrtz *( zt + alamb ) );
194 xt = 0.25 * ( xt + alamb );
195 yt = 0.25 * ( yt + alamb );
196 zt = 0.25 * ( zt + alamb );
197 ave = 0.2 * ( xt + yt + 3.0 * zt );
198 delx = ( ave - xt )/ave;
199 dely = ( ave - yt )/ave;
200 delz = ( ave - zt )/ave;
209 return( 3.0 * sum + fac * ( 1.0 + ed * ( -
RD_C1 +
RD_C5 * ed -
RD_C6 * delz * ee )
210 + delz * (
RD_C2 * ee + delz * ( -
RD_C3 * ec + delz *
RD_C4 * ea ) ) )/( ave * sqrt( ave ) ) );
224 #define RJ_ERRTOL 0.0015 227 #define RJ_TINY ( 2. * pow( DBL_MIN, ( 1./3. ) ) ) 228 #define RJ_BIG ( pow( DBL_MAX, ( 1./3. ) ) / 5. ) 229 #define RJ_C1 ( 3.0/14.0 ) 230 #define RJ_C2 ( 1.0/3.0 ) 231 #define RJ_C3 ( 3.0/22.0 ) 232 #define RJ_C4 ( 3.0/26.0 ) 233 #define RJ_C5 ( 0.75 * RJ_C3 ) 234 #define RJ_C6 ( 1.5 * RJ_C4 ) 235 #define RJ_C7 ( 0.5 * RJ_C2 ) 236 #define RJ_C8 ( RJ_C3 + RJ_C3 ) 240 double a = 0.0, alamb = 0.0, alpha = 0.0, ans = 0.0, ave = 0.0;
241 double b = 0.0, beta = 0.0, delp = 0.0, delx = 0.0, dely = 0.0, delz = 0.0, ea = 0.0;
242 double eb = 0.0, ec = 0.0, ed = 0.0, ee = 0.0, fac = 0.0, pt = 0.0, rcx = 0.0;
243 double rho = 0.0, sqrtx = 0.0, sqrty = 0.0, sqrtz = 0.0, sum = 0.0, tau = 0.0;
244 double xt = 0.0, yt = 0.0, zt = 0.0;
253 if (
MIN(
MIN( x, y ), z ) < 0.0 ||
256 _errorr(
"legendreIntegrals::rj: invalid argument(s)\n" );
269 xt =
MIN(
MIN( x, y ), z );
270 zt =
MAX(
MAX( x, y ), z );
271 yt = x + y + z - xt - zt;
273 b = a * ( zt - yt ) * ( yt - xt );
277 rcx =
rc( rho, tau );
284 alamb = sqrtx * ( sqrty + sqrtz ) + sqrty * sqrtz;
285 alpha =
SQR( pt * ( sqrtx + sqrty + sqrtz ) + sqrtx * sqrty * sqrtz );
286 beta = pt *
SQR( pt + alamb );
287 sum += fac *
rc( alpha, beta );
289 xt = 0.25 * ( xt + alamb );
290 yt = 0.25 *( yt + alamb );
291 zt = 0.25 *( zt + alamb );
292 pt = 0.25 *( pt + alamb );
293 ave = 0.2 * ( xt + yt + zt + pt + pt );
294 delx = ( ave - xt )/ave;
295 dely = ( ave - yt )/ave;
296 delz = ( ave - zt )/ave;
297 delp = ( ave - pt )/ave;
305 ea = delx * ( dely + delz ) + dely * delz;
306 eb = delx * dely * delz;
309 ee = eb + 2.0 * delp * ( ea - ec );
313 ans = a * ( b * ans + 3.0 * ( rcx -
rf( xt, yt, zt ) ) );
328 #define RC_ERRTOL 0.0012 332 #define RC_TINY ( DBL_MIN * 5. ) 333 #define RC_SQRTNY ( sqrt( RC_TINY ) ) 334 #define RC_BIG ( DBL_MAX / 5. ) 335 #define RC_TNBG ( RC_TINY * RC_BIG ) 336 #define RC_COMP1 ( 2.236/RC_SQRTNY ) 337 #define RC_COMP2 ( RC_TNBG * RC_TNBG/25.0 ) 338 #define RC_THIRD ( 1.0/3.0) 340 #define RC_C2 ( 1.0/7.0 ) 342 #define RC_C4 ( 9.0/22.0 ) 346 double alamb, ave, s, w, xt, yt;
347 if ( x < 0.0 || y == 0.0 || ( x +
ABS( y ) ) <
RC_TINY ||
349 _errorr(
"legendreIntegrals::rc: invalid argument(s)\n" );
360 w = sqrt( x )/sqrt( xt );
364 alamb = 2.0 * sqrt( xt ) * sqrt( yt ) + yt;
365 xt = 0.25 * ( xt + alamb );
366 yt = 0.25 * ( yt + alamb );
368 s = ( yt - ave )/ave;
371 return( w * ( 1.0 + s * s * (
RC_C1 + s * (
RC_C2 + s * (
RC_C3 + s *
RC_C4 ) ) ) )/sqrt( ave ) );
static double rc(double x, double y)
Solution of Carlson's degenerate elliptic integral - numerical recepies.
static double rf(double x, double y, double z)
Solution of Carlson's integral of the first kind - numerical recepies.
static double ellf(double phi, double ak)
Function calculating the Legendre's integral of the first kind - numerical recepies.
static double ellpi(double phi, double en, double ak)
Function calculating the Legendre's integral of the third kind - numerical recepies.
The header file of usefull macros.
static double rj(double x, double y, double z, double p)
Solution of Carlson's integral of the third kind - numerical recepies.
static double rd(double x, double y, double z)
Solution of Carlson's integral of the seccond kind - numerical recepies.
static double elle(double phi, double ak)
Function calculating the Legendre's integral of the seccond kind - numerical recepies.