User:Infornographer/Misc Maths

At least q successes
To calculate the probability for getting at least q successes with a dice pool of n, use the following formula:

Let n denote the number of dice, let q denote the target number of successes. Let Ps denote the probability of getting a success.


 * $$\sum_{k=q}^n\binom{n}{k} P_{s}^k\left(1-P_s\right)^{n-k} =

\sum_{k=q}^n\frac{n!} {k!\left(n-k\right)!}P_{s}^k\left(1-P_s\right)^{n-k}$$

Unfortunately, this can get quite messy in computation, but an approximation will follow...

Stirling's approximation gives us the result
 * $$n! \approx \sqrt{2\pi n}\, \frac{n^n}{e^n}$$

So our above equation becomes


 * $$\sum_{k=q}^n\frac{\sqrt{2\pi n}\, \frac{n^n}{e^n}}

{\sqrt{2\pi k}\, \frac{k^k}{e^k}\sqrt{2\pi \left(n-k\right)}\, \frac{\left(n-k\right)^\left(n-k\right)}{e^\left(n-k\right)}}P_{s}^k\left(1-P_s\right)^{n-k}$$

This equals


 * $$\sum_{k=q}^n\frac{n^{(n + \frac{1}{2})}\, e^{-(k^2 - kn + n)}}{\sqrt{2\pi}\, k^{(k + \frac{1}{2})}\, (n-k)^{(n-k+\frac{1}{2})}}P_{s}^k\left(1-P_s\right)^{n-k}

= \frac{1}{\sqrt{2\pi}} \sum_{k=q}^n\frac{n^{(n + \frac{1}{2})}\, e^{-(k^2 - kn + n)}}{k^{(k + \frac{1}{2})}\, (n-k)^{(n-k+\frac{1}{2})}}P_{s}^k\left(1-P_s\right)^{n-k} $$

Further simplification will follow...