Created
August 28, 2011 01:49
-
-
Save bitfoo/1176136 to your computer and use it in GitHub Desktop.
SMPPS buffer size probability calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% SMPPS buffer size probability calculator | |
% - bitfoo - 2011-08-27 | |
prob = 0.0000000000000001289400139122594962648449268272088374942; | |
log_prob = log(prob); | |
log_1_minus_prob = log1p(-prob); | |
num_hashes = 500 * 1024^3 * 60 * 60 * 24 * 30; % 30 days @ 500GH/s | |
num_blocks = num_hashes * prob; % a proxy for PPS | |
ks = 0:2*num_blocks; | |
ps = zeros(size(ks)); | |
for k=ks | |
log_p = 0.0; | |
% n choose k: | |
for i=1:k | |
log_p = log_p + log((num_hashes - (k-i))/i); | |
end | |
% p^k * (1-p)^(n-k) | |
log_p = log_p + k*log_prob + (num_hashes-k)*log_1_minus_prob; | |
ps(k+1) = exp(log_p); | |
end | |
figure(2); | |
plot(50*(ks - num_blocks),cumsum(ps), 'linewidth', 2); | |
axis([-1500 1500 0 1]); | |
xlabel('SMPPS buffer size after 30 days at 500GH/s [BTC]'); | |
ylabel('Probability of buffer <= x'); | |
grid on; | |
print -dpdf smpps.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment