Module kambe

Module kambe 

Source
Expand description

Kambe integrals I_n(z, eta) = integral_eta^infinity t^n exp(-z^2 t^2/2 + 1/(2t^2)) dt with first-order bounds on their rounding errors.

kambe() runs the Kambe (1968) recurrence up from a base pair: closed forms for even orders, the series for odd ones. Below the pair it takes the series over scaled incomplete gamma functions or the downward recurrence, whichever bounds the error more tightly. EvenKambe carries the even orders of one reciprocal point of a lattice sum. SmallSplitKambe gives the integrals of the real-space terms of a lattice sum at splits below every automatic one.

Upstream: intkambe of treams/special/_integrals.pyx. The rounding bounds, the choice below the base pair and the small-split series are treams-rs extensions.

StructsΒ§

EvenKambe πŸ”’
Even Kambe orders I_2, I_0, I_-2, I_-4, ... of one argument from the closed-form pair I_-2, I_0 and the Kambe recurrence, one step per order, as treams evaluates them: the orders of one reciprocal point of a 2D spherical or 1D cylindrical lattice sum, whose correlated errors those sums cancel (see lattice::Reduced).
SmallSplitKambe πŸ”’
Kambe integrals I_n(z, eta) of the real-space terms of an Ewald sum at a split below every automatic one (Self::get), with the coefficients c^j / j! of their series at c = 1 / (2 eta^2), which every integral at that split shares. There the closed-form pair and its recurrence (kambe_with_bound) cancel by up to e^Re(c) (each error function loses about |a|^2 ulps to exp(-a^2) at its argument a = (z eta -+ i / eta) / sqrt 2), while the series sums terms of one phase for real z and eta; its coefficients are rounded from double-double arithmetic, since recurred in double they carry the rounding of c into every integral alike.

ConstantsΒ§

CLOSED_ULPS πŸ”’
Bound of the closed forms of SmallSplitKambe, relative to their value in ulps, up to which they are taken without the series.
SERIES_PEAK_LIMIT πŸ”’
Largest |c| that sets the length of the Kambe series. Its terms c^j / j! peak at about e^|c| / sqrt(2 pi |c|), which overflows beyond |c| = 715: no larger |c| gives a finite sum.
SERIES_ULPS πŸ”’
Relative rounding error, in ulps, of the terms of the Kambe series of SmallSplitKambe beyond that of the exponential of their gamma functions: up to 22 against 40-digit quadrature (orders up to 28).

FunctionsΒ§

base_pair πŸ”’
The base pair I_-3, I_-1 (odd, by the series) or I_-2, I_0 (even, in closed form), with error bounds in units of epsilon.
even_pair πŸ”’
I_-2 and I_0 in closed form by two complementary error functions, with the magnitude of their two terms as error bounds in units of epsilon.
even_scale πŸ”’
The factor sqrt(pi / 8) of the closed form of the even base pair.
even_terms πŸ”’
The two terms of the closed form of the even base pair, and the argument with Re z >= 0 they take (even orders are even in z).
even_values πŸ”’
I_-2 and I_0 from the terms of even_terms.
kambe πŸ”’
The Kambe integral I_n(z, eta) without input checks.
kambe_argument πŸ”’
The argument a = (z eta)^2 / 2 of the incomplete gamma functions of the Kambe series, as the series evaluates it. Odd orders take the principal branch of ln a, which the 1D spherical lattice sums continue to another sheet where they need it.
kambe_below_base πŸ”’
Orders below the base pair from the series, which cancels by about e^(|c| - Re c) for complex eta, or the downward recurrence from the base pair (as in treams), accurate while |1/eta^2| exceeds about |n| and |z|: the smaller error bound wins. A series whose predicted loss stays within RECURRENCE_GROWTH is kept outright; otherwise odd orders sum their base pair in the same pass, and even orders keep a recurrence that grows by at most RECURRENCE_GROWTH and try the series only where its predicted loss is below RECURRENCE_GROWTH times the recurrence’s growth.
kambe_downward πŸ”’
The Kambe (1968) recurrence I_n = (n+3) I_(n+2) - z^2 I_(n+4) + eta^(n+3) e^(...) run downward from the base pair, with the first-order absolute error bound in units of epsilon propagated from the pair and each endpoint term.
kambe_series πŸ”’
Kambe integrals by expanding exp(1/(2t^2)): with a = (z eta)^2 / 2, c = 1 / (2 eta^2) and R(d) = Gamma(d, a) / a^d (-1/d as a -> 0), I_n = eta^(n+1)/2 sum_j c^j/j! R((n+1)/2 - j), whose terms cancel by up to e^(|c| - Re c) for complex eta. Orders of one parity share one ladder of R, each with the magnitude of its terms as its error bound. Even orders take the branch sqrt(a) = z eta / sqrt 2 with Re z >= 0.
kambe_series_with πŸ”’
kambe_series with the coefficients c^j/j! from table, or recurred term by term.
kambe_upward πŸ”’
The Kambe recurrence run upward from the base pair to order n, with error bounds in units of epsilon where BOUND asks for them (the endpoint terms count endpoint_ulps).
kambe_with_bound πŸ”’
kambe with a first-order bound on the absolute rounding error of its value in units of epsilon: from the series for I_-3 and I_-1, below the base pair from the series or the downward recurrence that kambe takes, and above the base pair propagated through the upward recurrence. Requires nonzero eta, and nonzero z from order -1 up.
more_accurate πŸ”’
The value with the smaller error bound, unless the series overflowed.
series_terms πŸ”’
The number of terms of the Kambe series at c = 1 / (2 eta^2) after which each order stops: its terms peak near j = |c| and soon fall below the rounding of the sum.