# [SciPy-User] random points within an ellipse

nicky van foreest vanforeest@gmail....
Tue Aug 10 14:29:04 CDT 2010

>> If instead 20% more random variables are drawn in each iteration, then
>> in expected terms only one iteration would be needed. Of course
>> actually there will still be too few or already too many. Getting an
>> extra random draw from numpy is cheap, I guess.

I get it now. I assume that making random deviates is very cheap, as
many very bright people spent lots of time on this issue.

>
> That's a nice dynamic optimization, dynamic programming problem:
> What's the optimal (expected cost minimizing) oversampling rate if
> there are still n random variables to draw and the success probability
> for each draw is 79%.

>From a practical point of view: the expected number of needed random
deviates is N =  n/p, where p is the success probability. I am
inclined then to take somewhat more than N deviates, for instance
three times the sigma which in this case is \sqrt{Np(1-p)}, and just
throw away the surplus.

The actual minimization problem is indeed interesting.

Nicky