Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, C. E., Oleksandr R., MarcoB, m_goldberg Sep 30 '15 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" – Dr. belisarius 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 '15 at 20:33