From 77566754d549f6c186dec9f286fef6351d4c66a8 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Sun, 8 Dec 2024 15:25:21 -0700 Subject: [PATCH] fix formula --- core/oscillations.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/oscillations.c b/core/oscillations.c index 93fbf5b..240907d 100644 --- a/core/oscillations.c +++ b/core/oscillations.c @@ -127,9 +127,11 @@ void compute_local_gnu(grid_local_angles_type f, grid_Gnu_type local_Ns, wmean /= (Ns + SMALL); const double wb2N = Ns * wmean * wmean; - // should have units of w/sqrt(N). + // should have units of sum(w)/sqrt(N) ~ sqrt(N) wmean + // middle term scales b/c + // sqrt(sum w^2) ~ sqrt(N wmean^2) ~ sqrt(N) wmean const double stddev = - sqrt(wb2N + (w2 + Ns * wb2N) / (fabs(Ns - 1) + SMALL)); + sqrt(wb2N + Ns * (w2 - wb2N) / (fabs(Ns - 1) + SMALL)); // TODO(JMM): Generalize this for six species? const double ELN =