ls=style) >>> ax.legend() >>> ax.set_ylabel("$k$") >>> ax.set_xlabel("$CDF$") >>> ax.set_title("Negative binomial percentile function") >>> plt.show() The negative binomial distribution is also available as `scipy.stats.nbinom`. The percentile function method ``ppf`` returns the result of `nbdtrik` rounded up to integers: >>> from scipy.stats import nbinom >>> q, n, p = 0.6, 5, 0.5 >>> nbinom.ppf(q, n, p), nbdtrik(q, n, p) (5.0, 4.800428460273882) Ú