Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Assisting an acquaintance with a simulation where a very large number of binomial probability calculations are required, I pointed them to a slightly obscure function to dramatically speed up their algorithm. Specifically, for

Probability[x == b, x \[Distributed] BinomialDistribution[n, p]]

the same result can be had with

BernsteinBasis[n, b, p]

but the latter is 15-20X faster (and surprisingly generally more accurate with inexact p) than the former, and 1.5-2X faster than PDF calculation. Only explicit calculation using the formula for binomial probability is faster.

I'm curious what other "off-label" uses of built-in functions have been noted to have performance advantages.

share|improve this question

closed as too broad by Bob Hanlon, Pickett, Oleksandr R., MarcoB, m_goldberg Sep 30 at 12:59

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

Please define "acquaintance" – belisarius has settled Mar 20 '14 at 23:56
@belisarius: Only the names have been changed to protect the innocent... – ciao Mar 20 '14 at 23:59
Actually, for large n and d (e.g, 4000 and 3000, p=0.5) the PDF calculation is faster than the BernsteinBasis calculation. – Sjoerd C. de Vries Sep 25 at 20:33