Loading...
Searching...
No Matches
gpr::quantum::beadcorrection Namespace Reference

Classes

struct  Correction

Functions

Correction harmonic (double u, int beads)

Function Documentation

◆ harmonic()

Correction gpr::quantum::beadcorrection::harmonic ( double u,
int beads )
inline

Definition at line 30 of file HarmonicBeadCorrection.h.

31{
32 if (!(u > 0) || !std::isfinite(u) || beads < 1)
33 throw std::invalid_argument(
34 "Positive finite u and at least one bead required");
35 const double N = beads;
36 Correction c;
37 const double phase = N * std::asinh(u / (2 * N));
38 c.phaseDeficit = u / 2 - phase;
39 // ln sinh(a) = a + log1p(-exp(-2a)) - ln 2, stable for large a.
40 const auto logSinh = [](double a) {
41 return a + std::log1p(-std::exp(-2 * a)) - std::log(2.);
42 };
43 c.logPartitionCorrection = logSinh(phase) - logSinh(u / 2);
44 c.certifiedRegime = u / N <= .5;
45 if (c.certifiedRegime) {
46 c.deficitUpper = u * u * u / (48 * N * N);
47 c.deficitLower =
48 c.deficitUpper - 3 * std::pow(u, 5) / (1280 * std::pow(N, 4));
49 }
50 return c;
51}