[SciPy-User] random points within an ellipse
Tue Aug 10 13:25:43 CDT 2010
On Tue, Aug 10, 2010 at 2:17 PM, <firstname.lastname@example.org> wrote:
> On Tue, Aug 10, 2010 at 2:08 PM, nicky van foreest <email@example.com> wrote:
>> Thanks for the nice feedback.
>> This is a bit too short for me:
>>> I would oversample if the rejection rate is around 20%
>> BTW: The rejection fraction of an ellipse is 1 - \pi/4 \approx 0.21.
>> What is wrong with using the rejection method?
> Everything is fine.
> I meant that in Erin's code the exact number of still missing random
> variables are drawn in each iteration.
> So it will take many iterations, with smaller and smaller sample sizes
> to get to the desired number.
> 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.
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%.
>> SciPy-User mailing list
More information about the SciPy-User