32 double kSqrt2 = 1.4142135623730950488016887242097;
33 double kPi = 3.14159265358979323846;
34 double kEulerGamma = 0.577215664901532860606512090082402431042;
77 double sum, factorial = 1,
n = 1;
78 double term = 1, x_factor = x * x * x * x * 0.0625;
83 factorial = 4 *
n *
n * (2 *
n - 1) * (2 *
n - 1);
84 term *= (-1) / factorial * x_factor;
92 double alpha = x / kSqrt2 - kPi / 8;
93 double value =
F1(x) *
cos(alpha) +
G1(x) *
sin(alpha);
94 value *=
exp(x / kSqrt2) /
sqrt(2 * kPi * x);
136 double sum, factorial = 1,
n = 1;
137 double term = x * x * 0.25, x_factor = term * term;
142 factorial = 4 *
n *
n * (2 *
n + 1) * (2 *
n + 1);
143 term *= (-1) / factorial * x_factor;
151 double alpha = x / kSqrt2 - kPi / 8;
152 double value =
F1(x) *
sin(alpha) +
G1(x) *
cos(alpha);
153 value *=
exp(x / kSqrt2) /
sqrt(2 * kPi * x);
200 double term = 1, x_factor = x * x * x * x * 0.0625;
201 double factorial = 1, harmonic = 0,
n = 1,
sum;
203 if(x < 0) delta =
kPi;
208 factorial = 4 *
n *
n * (2 *
n - 1) * (2 *
n - 1);
209 term *= (-1) / factorial * x_factor;
210 harmonic += 1 / (2 * n - 1 ) + 1 / (2 * n);
211 sum += term * harmonic;
218 double beta = x / kSqrt2 + kPi / 8;
219 double value =
F2(x) *
cos(beta) -
G2(x) *
sin(beta);
220 value *=
sqrt(kPi / (2 * x)) *
exp(- x / kSqrt2);
267 double term = x * x * 0.25, x_factor = term * term;
268 double factorial = 1, harmonic = 1,
n = 1,
sum;
270 if(x < 0) delta =
kPi;
275 factorial = 4 *
n *
n * (2 *
n + 1) * (2 *
n + 1);
276 term *= (-1) / factorial * x_factor;
277 harmonic += 1 / (2 *
n) + 1 / (2 * n + 1);
278 sum += term * harmonic;
285 double beta = x / kSqrt2 + kPi / 8;
286 double value = -
F2(x) *
sin(beta) -
G2(x) *
cos(beta);
287 value *=
sqrt(kPi / (2 * x)) *
exp(- x / kSqrt2);
319 double sum, factorial = 1,
n = 1;
320 double term = - x * x * x * 0.0625, x_factor = - term *
x;
325 factorial = 4 *
n * (
n + 1) * (2 *
n + 1) * (2 *
n + 1);
326 term *= (-1) / factorial * x_factor;
334 else return (
M(x) *
sin(
Theta(x) - kPi / 4));
364 double sum, factorial = 1,
n = 1;
365 double term = x * 0.5, x_factor = x * x * x * x * 0.0625;
370 factorial = 4 *
n *
n * (2 *
n - 1) * (2 *
n + 1);
371 term *= (-1) * x_factor / factorial;
379 else return (
M(x) *
cos(
Theta(x) - kPi / 4));
409 double term = - x * x * x * 0.0625, x_factor = - term *
x;
410 double factorial = 1, harmonic = 1.5,
n = 1,
sum;
412 if(x < 0) delta =
kPi;
417 factorial = 4 *
n * (
n + 1) * (2 *
n + 1) * (2 *
n + 1);
418 term *= (-1) / factorial * x_factor;
419 harmonic += 1 / (2 *
n + 1 ) + 1 / (2 *
n + 2);
420 sum += term * harmonic;
427 else return N(x) *
sin(
Phi(x) - kPi / 4);
457 double term = 0.5 *
x, x_factor = x * x * x * x * 0.0625;
458 double factorial = 1, harmonic = 1,
n = 1,
sum;
460 if(x < 0) delta =
kPi;
465 factorial = 4 *
n *
n * (2 *
n - 1) * (2 *
n + 1);
466 term *= (-1) / factorial * x_factor;
467 harmonic += 1 / (2 *
n) + 1 / (2 * n + 1);
468 sum += term * harmonic;
475 else return N(x) *
cos(
Phi(x) - kPi / 4);
490 double prod = 1, x_factor = 8 *
x, factorial = 1,
n = 2;
492 sum = kSqrt2 / (16 *
x);
496 prod *= (2 *
n - 1) * (2 *
n - 1);
498 term = prod / (factorial * x_factor) *
cos(0.25 *
n * kPi);
519 double prod = 1, x_factor = 8 *
x, factorial = 1,
n = 2;
521 sum = kSqrt2 / (16 *
x);
525 prod *= (2 *
n - 1) * (2 *
n - 1);
527 term = (prod / (factorial * x_factor)) *
cos(0.25 *
n * kPi);
550 double prod = 1, x_factor = 8 *
x, factorial = 1,
n = 2;
552 sum = kSqrt2 / (16 *
x);
556 prod *= (2 *
n - 1) * (2 *
n - 1);
558 term = prod / (factorial * x_factor) *
sin(0.25 *
n * kPi);
577 double prod = 1, x_factor = 8 *
x, factorial = 1,
n = 2;
579 sum = kSqrt2 / (16 *
x);
583 prod *= (2 *
n - 1) * (2 *
n - 1);
585 term = prod / (factorial * x_factor) *
sin(0.25 *
n * kPi);
605 double value = 1 + 1 / (8 * kSqrt2 *
x) + 1 / (256 * x * x) - 399 / (6144 * kSqrt2 * x * x *
x);
606 value *=
exp(x / kSqrt2) /
sqrt(2 * kPi * x);
621 double value = x / kSqrt2 - kPi / 8;
622 value -= 1 / (8 * kSqrt2 *
x) + 1 / (16 * x * x) + 25 / (384 * kSqrt2 * x * x *
x);
637 double value = 1 - 1 / (8 * kSqrt2 *
x) + 1 / (256 * x * x) + 399 / (6144 * kSqrt2 * x * x *
x);
638 value *=
exp(- x / kSqrt2) *
sqrt(kPi / (2 * x));
653 double value = - x / kSqrt2 - kPi / 8;
654 value += 1 / (8 * kSqrt2 *
x) - 1 / (16 * x * x) + 25 / (384 * kSqrt2 * x * x *
x);
static long int sum(long int i)
static double Ber(double x)
where x is real, and is the zeroth-order Bessel function of the first kind.
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
static double DBei(double x)
Calculates the first derivative of Bei(x).
static const double kSqrt2
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
double beta(double x, double y)
Calculates the beta function.
static double F1(double x)
Utility function appearing in the calculations of the Kelvin functions Bei(x) and Ber(x) (and their d...
static double G1(double x)
Utility function appearing in the calculations of the Kelvin functions Bei(x) and Ber(x) (and their d...
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
static double Kei(double x)
where x is real, and is the zeroth-order modified Bessel function of the second kind...
static double DKer(double x)
Calculates the first derivative of Ker(x).
static double M(double x)
Utility function appearing in the asymptotic expansions of DBer(x) and DBei(x).
static double Bei(double x)
where x is real, and is the zeroth-order Bessel function of the first kind.
static double Theta(double x)
Utility function appearing in the asymptotic expansions of DBer(x) and DBei(x).
Namespace for new Math classes and functions.
static double G2(double x)
Utility function appearing in the calculations of the Kelvin functions Kei(x) and Ker(x) (and their d...
static double DBer(double x)
Calculates the first derivative of Ber(x).
static double Phi(double x)
Utility function appearing in the asymptotic expansions of DKer(x) and DKei(x).
static double Ker(double x)
where x is real, and is the zeroth-order modified Bessel function of the second kind...
static double DKei(double x)
Calculates the first derivative of Kei(x).
static double F2(double x)
Utility function appearing in the calculations of the Kelvin functions Kei(x) and Ker(x) (and their d...
static double N(double x)
Utility function appearing in the asymptotic expansions of DKer(x) and DKei(x).