diff --git a/crates/ekore/src/harmonics/cache.rs b/crates/ekore/src/harmonics/cache.rs index 1342f5175..9c9e3ae9b 100644 --- a/crates/ekore/src/harmonics/cache.rs +++ b/crates/ekore/src/harmonics/cache.rs @@ -30,6 +30,10 @@ pub enum K { S3mh, /// $g_3(N)$ G3, + /// $S_{-2}(N)$ even moments + Sm2e, + /// $S_{-2}(N)$ odd moments + Sm2o, } /// Hold all cached values. @@ -69,6 +73,8 @@ impl Cache { K::S2mh => w2::S2((self.n - 1.) / 2.), K::S3mh => w3::S3((self.n - 1.) / 2.), K::G3 => g_functions::g3(self.n, self.get(K::S1)), + K::Sm2e => w2::Sm2e(self.get(K::S2), self.get(K::S2h)), + K::Sm2o => w2::Sm2o(self.get(K::S2), self.get(K::S2mh)), }; // insert self.m.insert(k, val); diff --git a/crates/ekore/src/harmonics/w2.rs b/crates/ekore/src/harmonics/w2.rs index d55a32679..a6d7cc89f 100644 --- a/crates/ekore/src/harmonics/w2.rs +++ b/crates/ekore/src/harmonics/w2.rs @@ -11,3 +11,13 @@ use crate::harmonics::polygamma::cern_polygamma; pub fn S2(N: Complex) -> Complex { -cern_polygamma(N + 1.0, 1) + ZETA2 } + +/// Analytic continuation of harmonic sum $S_{-2}(N)$ for even moments. +pub fn Sm2e(hS2: Complex, hS2h: Complex) -> Complex { + 1. / 2. * hS2h - hS2 +} + +/// Analytic continuation of harmonic sum $S_{-2}(N)$ for odd moments. +pub fn Sm2o(hS2: Complex, hS2mh: Complex) -> Complex { + 1. / 2. * hS2mh - hS2 +}