From 8c43570c9a9c672b122306cb8e8e5e4b8d2f3b6c Mon Sep 17 00:00:00 2001 From: Pi-Hsun Shih Date: Wed, 15 Apr 2020 22:14:22 +0800 Subject: [PATCH] Fix a wrong comment. --- js/predictions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/predictions.js b/js/predictions.js index c5da355..257334a 100644 --- a/js/predictions.js +++ b/js/predictions.js @@ -381,13 +381,13 @@ function generate_peak_price( // // => X->U(A,B), Y->U(C,X), Y-C->U(0,X-A), Y-C->U(0,1)*(X-A), Y-C->U(0,1)*U(C-A,B-A), // let Z=Y-C, Z1=C-A, Z2=B-A, Z->U(0,1)*U(Z1,Z2) - // Prob(Z>=t) = integral_{x=0}^{1} [min(t/x,Z2)-min(t/x,Z1)]/ (Z2-Z1) + // Prob(Z<=t) = integral_{x=0}^{1} [min(t/x,Z2)-min(t/x,Z1)]/ (Z2-Z1) // let F(t, ZZ) = integral_{x=0}^{1} min(t/x, ZZ) // 1. if ZZ < t, then min(t/x, ZZ) = ZZ -> F(t, ZZ) = ZZ // 2. if ZZ >= t, then F(t, ZZ) = integral_{x=0}^{t/ZZ} ZZ + integral_{x=t/ZZ}^{1} t/x // = t - t/ZZ log(t/ZZ) - // Prob(Z>=t) = (F(t, Z2) - F(t, Z1)) / (Z2 - Z1) - // Prob(Y>=t) = Prob(Z>=t-C) + // Prob(Z<=t) = (F(t, Z2) - F(t, Z1)) / (Z2 - Z1) + // Prob(Y<=t) = Prob(Z>=t-C) for (const price of [left_price, right_price]) { if (isNaN(price)) { continue;