Boost logo

Boost :

From: Topher Cooper (topher_at_[hidden])
Date: 2007-12-26 09:50:56


Anyone attempting to generate non-uniform random numbers should
consult "Non-Uniform Random Variate Generation" by Luc Devroye, which
is available in full, for free use at:

http://cg.scs.carleton.ca/~luc/rnbookindex.html

Poisson generation is covered, specifically, in chapter 10:

http://cg.scs.carleton.ca/~luc/chapter_ten.pdf

starting on page 501.

How far off is the Poisson distribution from the normal at a mean of
750? How large a sample would you need to have, say, a one in a
thousand chance of detecting the difference? (I don't know the
answer, but if there is a problem at that extreme, its a question
that should be answered before getting too fancy with "precise" solutions).

Topher

At 07:08 AM 12/24/2007, you wrote:
> >-----Original Message-----
> >Sent: 22 December 2007 23:02
> >To: boost_at_[hidden]
> >Subject: [boost] [random] poisson_distribution problem and fix
> >
> >The poisson_distribution code will fail for any mean larger than 750
> >or so (on my x86_64 machine). The problem is a comparison with
> >exp(-_mean) which evaluates as zero right around there.
> >
> >A far better fix would be to use an algorithm other than Knuth's for
> >this. Knuth's algorithm is simple, but O(n). Here is some code I
> >wrote, converting some old Fortran code that a friend had got from
> >Numerical Recipes once upon a time. It works, but would need actual
> >testing before use in production code:
> >
> >#ifndef F_POISSON_HEADER
> >#define F_POISSON_HEADER
>
><snipped>
>
> >#endif
>
>This looks too obviously lifted from NR in C (or FORTRAN) to fit the
>Boost license.
>

. . .

>Paul
>
>---
>Paul A Bristow
>Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
>+44 1539561830 & SMS, Mobile +44 7714 330204 & SMS
>pbristow_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk