I want to decide the capacity $C$ of a table so that it has residual odds less than $2^{-p}$ to overflow for given $p\in[40\dots 120]$, assuming the number of entries follows a Poisson law with a given expectancy $E\in[10^3\dots 10^{12}]$.
Ideally, I want the lowest integer C
such that 1-CDF[PoissonDistribution[E],C] < 2^-p
for given p
and E
; but I'm content with some C
slightly higher than that. Mathematica is fine for manual computation, but I would like to compute C
from p
and E
at compile time, which limits me to 64-bit integer arithmetic.
Update: In Mathematica (version 7) e = 1000; p = 40; c = Quantile[PoissonDistribution[e], 1 - 2^-p]
is 1231
and seems about right (thanks @Procrastinator); however the result for both p = 50
and p = 60
is 1250
, which is wrong on the unsafe side (and matters: my experiment repeats like $2^{25}$ times or more, and I want demonstrably less than $2^{-30}$ overall odds of failure). I want some crude but safe approximation using 64-bit integer arithmetic only, as available in C(++) at compile time.
C = Quantile[PoissonDistribution[E],1-2^p]
? $\endgroup$ – user10525 Sep 4 '12 at 9:50p
, and precision issues, and namesE
andC
that are reserved). BUT I need a simple approximation of that, possibly crude (but on the safe side) using 64-bit integer arityhmetic only! $\endgroup$ – fgrieu Sep 4 '12 at 10:37