Take the 2-minute tour ×
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
    
Please define "acquaintance" –  belisarius Mar 20 at 23:56
    
@belisarius: Only the names have been changed to protect the innocent... –  rasher Mar 20 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.