![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Implementation of specfunc.hpp. More...
#include "specfunc.hpp"
#include <utils/math/sqr.hpp>
#include <cmath>
#include <numbers>
#include <tuple>
#include <utility>
Go to the source code of this file.
Functions | |
double | hzeta (double s, double q) |
Hurwitz zeta function. | |
double | K0 (double x) |
Modified Bessel function of second kind, order 0. | |
double | K1 (double x) |
Modified Bessel function of second kind, order 1. | |
double | LPK0 (double x) |
Modified Bessel function of second kind, order 0, low precision. | |
double | LPK1 (double x) |
Modified Bessel function of second kind, order 1, low precision. | |
std::pair< double, double > | LPK01 (double x) |
Modified Bessel functions of second kind, order 0 and 1, low precision. | |
Variables | |
static double const | hzeta_c [15] |
Coefficients for Maclaurin summation in hzeta(). | |
static int | ak01_orders [] |
necessary orders for K0/1 from 2 up to 22 for 10^-14 precision. | |
Chebyshev expansions based on SLATEC bk0(), bk0e() | |
static double | bk0_cs [11] |
Series for bk0 . | |
static double | ak0_cs [17] |
Series for ak0 . | |
static double | ak02_cs [14] |
Series for ak02 . | |
Chebyshev expansions based on SLATEC besi0() | |
static double | bi0_cs [12] |
Series for bi0 . | |
Chebyshev expansions based on SLATEC besk1(), besk1e() | |
static double | bk1_cs [11] |
Series for bk1 . | |
static double | ak1_cs [17] |
Series for ak1 . | |
static double | ak12_cs [14] |
Series for ak12 . | |
Chebyshev expansions based on SLATEC besi1(), besi1e() | |
static double | bi1_cs [11] |
Series for bi1 . | |
Implementation of specfunc.hpp.
Definition in file specfunc.cpp.
Hurwitz zeta function.
This function was taken from the GSL code.
Euler-Maclaurin summation formula from [31] p. 400, with several typo corrections.
Definition at line 215 of file specfunc.cpp.
References hzeta_c, Utils::sqr(), and stream.
Referenced by preparePolygammaEven(), and preparePolygammaOdd().
Modified Bessel function of second kind, order 0.
This function was taken from the GSL code. Precise roughly up to machine precision. It is 16 times faster than std::cyl_bessel_k
. If MMM1D_MACHINE_PREC
is not defined, LPK0 is used instead.
Definition at line 250 of file specfunc.cpp.
References ak02_cs, ak0_cs, bi0_cs, bk0_cs, evaluateAsChebychevSeriesAt(), and stream.
Referenced by CoulombMMM1D::pair_energy(), and CoulombMMM1D::pair_force().
Modified Bessel function of second kind, order 1.
This function was taken from the GSL code. Precise roughly up to machine precision. If MMM1D_MACHINE_PREC
is not defined, LPK1 is used instead.
Definition at line 262 of file specfunc.cpp.
References ak12_cs, ak1_cs, bi1_cs, bk1_cs, evaluateAsChebychevSeriesAt(), and stream.
Referenced by far_error(), and CoulombMMM1D::pair_force().
Modified Bessel function of second kind, order 0, low precision.
The implementation has an absolute precision of around 10^(-14), which is comparable to the relative precision sqrt implementation of current hardware in the ranges \( ]0, 8[ \) and \( ]8, 23[ \). Above 23, the precision starts to degrade, and above 27 the result drifts and slowly converges to 96% of the real value. It is 25 times faster than std::cyl_bessel_k
and 1.5 times faster than K0.
Definition at line 288 of file specfunc.cpp.
References ak01_orders, ak02_cs, ak0_cs, bi0_cs, bk0_cs, and stream.
Modified Bessel functions of second kind, order 0 and 1, low precision.
The implementation has an absolute precision of around 10^(-14), which is comparable to the relative precision sqrt implementation of current hardware.
Definition at line 408 of file specfunc.cpp.
References ak01_orders, ak02_cs, ak0_cs, ak12_cs, ak1_cs, bi0_cs, bi1_cs, bk0_cs, bk1_cs, and stream.
Referenced by CoulombMMM1D::pair_force().
Modified Bessel function of second kind, order 1, low precision.
The implementation has an absolute precision of around 10^(-14), which is comparable to the relative precision sqrt implementation of current hardware in the ranges \( ]0, 8[ \) and \( ]8, 23[ \). Above 23, the precision starts to degrade, and above 27 the result drifts and slowly converges to 111% of the real value. It is 25 times faster than std::cyl_bessel_k
and 1.5 times faster than K1.
Definition at line 348 of file specfunc.cpp.
References ak01_orders, ak12_cs, ak1_cs, bi1_cs, bk1_cs, and stream.
|
static |
necessary orders for K0/1 from 2 up to 22 for 10^-14 precision.
Note that at 8 the expansion changes. From 23 to 26 order 2 is used, above order 1. For the latter cases, separate implementations are necessary.
Definition at line 282 of file specfunc.cpp.
|
static |
Series for ak02
.
On the interval 0. to 1.25000d-01
Label | Value |
---|---|
with weighted error | 2.34e-17 |
log weighted error | 16.63 |
significant figures required | 14.67 |
decimal places required | 17.20 |
Definition at line 107 of file specfunc.cpp.
|
static |
Series for ak0
.
On the interval 1.25000d-01 to 5.00000d-01
Label | Value |
---|---|
with weighted error | 5.34e-17 |
log weighted error | 16.27 |
significant figures required | 14.92 |
decimal places required | 16.89 |
Definition at line 90 of file specfunc.cpp.
|
static |
Series for ak12
.
On the interval 0. to 1.25000d-01
Label | Value |
---|---|
with weighted error | 2.58e-17 |
log weighted error | 16.59 |
significant figures required | 15.22 |
decimal places required | 17.16 |
Definition at line 176 of file specfunc.cpp.
|
static |
Series for ak1
.
On the interval 1.25000d-01 to 5.00000d-01
Label | Value |
---|---|
with weighted error | 6.06e-17 |
log weighted error | 16.22 |
significant figures required | 15.41 |
decimal places required | 16.83 |
Definition at line 159 of file specfunc.cpp.
|
static |
Series for bi0
.
On the interval 0. to 9.00000d+00
Label | Value |
---|---|
with weighted error | 2.46e-18 |
log weighted error | 17.61 |
significant figures required | 17.90 |
decimal places required | 18.15 |
Definition at line 126 of file specfunc.cpp.
|
static |
Series for bi1
.
On the interval 0. to 9.00000d+00
Label | Value |
---|---|
with weighted error | 2.40e-17 |
log weighted error | 16.62 |
significant figures required | 16.23 |
decimal places required | 17.14 |
Definition at line 195 of file specfunc.cpp.
|
static |
Series for bk0
.
On the interval 0. to 4.00000d+00
Label | Value |
---|---|
with weighted error | 3.57e-19 |
log weighted error | 18.45 |
significant figures required | 17.99 |
decimal places required | 18.97 |
Definition at line 73 of file specfunc.cpp.
|
static |
Series for bk1
.
On the interval 0. to 4.00000d+00
Label | Value |
---|---|
with weighted error | 7.02e-18 |
log weighted error | 17.15 |
significant figures required | 16.73 |
decimal places required | 17.67 |
Definition at line 144 of file specfunc.cpp.
Coefficients for Maclaurin summation in hzeta().
Evaluated as inverse numbers, i.e. \( \displaystyle\frac{B_{2j}}{(2j)!} \).
Definition at line 205 of file specfunc.cpp.
Referenced by hzeta().