# PDF on TransformedDistribution of two BinomialDistribution too slow

I'd been doing my own convolutions of distributions for some calculations, decided to use built-ins.

With

p5 = TransformedDistribution[py + pz,
{Distributed[py, BinomialDistribution[7, .2]],
Distributed[pz, BinomialDistribution[7, .3]]}]

PDF[p5, 5]


getting the PDF takes an inordinate amount of time (as in 30+ seconds on the laptop I'm on at the moment, faster on my real machines of course, but still slow.)

I'm guessing it is using DiscreteConvolve under the covers, which is itself inordinately slow IMO, but I'm pondering if I'm missing something obvious in the use of TransformedDistribution.

Any ideas (or explanations) for the slowness appreciated.

-
On my 64-bit Windows 7 machine this takes about .7 seconds for version 8.0.4 and 9.0.1. What system are you using? –  Andy Ross Mar 16 at 22:42
PDF[p5, 5] takes 2.4 seconds on my rather elderly iMac. –  m_goldberg Mar 16 at 22:46
@Andy & m_goldberg: There was a typo in original example, argument to PDF I used was 5, rather than 2. I am on 9.0.1, but as I said timing was on a crippled laptop, it is a few seconds on my normal machines, but that still seems awfully low. I'm getting the feeling though that this is just a slow operation, and for real work I'm better off doing explicit optimized convolutions of the individual PDFs. Btw, thanks for cleaning up post if one of you did it... –  HeyCarNut Mar 16 at 22:50
My timings didn't change by using 5 instead of 2. That said, I'm on a machine with 32GB memory with a fairly fast (4.3GHz) cpu. –  Andy Ross Mar 16 at 22:56
Read my comment again. I tested with PDF[p5, 5]. –  m_goldberg Mar 16 at 23:06
show 1 more comment