[SciPy-User] random points within an ellipse

josef.pktd@gmai... josef.pktd@gmai...
Tue Aug 10 13:17:29 CDT 2010


On Tue, Aug 10, 2010 at 2:08 PM, nicky van foreest <vanforeest@gmail.com> wrote:
> Hi,
>
> Thanks for the nice feedback.
>
> This is a bit too short for me:
>
>> I would oversample if the rejection rate is around 20%
>>
>> Josef
>
> 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.

Josef


>
> bye
>
> Nicky
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list