[SciPy-User] random points within an ellipse

josef.pktd@gmai... josef.pktd@gmai...
Tue Aug 10 13:25:43 CDT 2010


On Tue, Aug 10, 2010 at 2:17 PM,  <josef.pktd@gmail.com> wrote:
> 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.

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%.

Josef


>
> 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