Contesting for Idiot du Jour
Jerry Jensen
jerry at jhjensen.com
Thu Sep 3 00:50:55 EDT 2020
Whew !! <grin>
> On Sep 2, 2020, at 9:25 PM, Dev via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Me again Jerry
>
> Changed the setup so that the pellets landing outside the big circle were ignored and just kept going until I had 1000 within the circles in a completely random pattern without Trig. Now the ratio in the smaller circle is 25% or ¼ like the area comparison would suggest.
>
> You do understand math much better than I do obviously!
>
> Kelly
>
>> On 2Sep, 2020, at 10:10 PM, Dev <dev at porta.ca> wrote:
>>
>> Hi Jerry
>>
>> I just tried that because I’m no math wizard and need to see things. When shooting a random shotgun blast of 1000 pellets into the centre of a target square that contained the large circle and small circles, the ratio worked out to around 0.2 - not 0.25. It seems the corners outside the big circle receive about 20% of the shots, the inner circle gets another 20% and the outer circle gets 60%. So I don’t understand your thought about ¼.
>>
>> Kelly
>>
>>> On 2Sep, 2020, at 9:43 PM, Jerry Jensen via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>
>>> Additional thought:
>>> If you just used random x and y, then ignored points outside the larger circle, you would see that 1/4 of the points would be in the smaller circle.
>>>
>>> No trig or integrals involved.
>>> .Jerry
>>>
>>>> On Sep 2, 2020, at 8:27 PM, Jerry Jensen via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>
>>>> 1/2 is the right answer.
>>>>
>>>> Take your drawing of the circles. Cut a verrrryy thin radial slice from the center to the outside circle. So thin that it is just a line.
>>>>
>>>> Now think of how likely a random point on that line will be in the part of the line that was in the smaller circle. The part that was from the smaller circle is HALF as long as the entire line.
>>>>
>>>> Now add up all the possible positions of that line. Why would that change the answer?
>>>>
>>>> Congratulations, you understand integrals!
>>>> .Jerry
>>>>
>>>>> On Sep 2, 2020, at 7:38 PM, Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>>
>>>>> Your chance to be Genius du Jour:
>>>>>
>>>>> If I construct 2 concentric circles, one being half the radius of the larger, then simple math shows that the smaller circle has an area ¼ the area of the larger.
>>>>> Now if I generate a random point within the radius of the larger circle, I should expect that the probability of it landing in the smaller circle to be ¼.
>>>>> But, I must be doing something wrong because I get ½ !
>>>>>
>>>>> Here is my script:
>>>>>
>>>>> on mouseDown
>>>>>
>>>>> getStuff
>>>>>
>>>>> end mouseDown
>>>>>
>>>>>
>>>>> local tR, tTheta, tX0, tY0, tX1, tY1, tTotCount, tL, tLongCount
>>>>>
>>>>> on getStuff
>>>>>
>>>>> put item 1 of the loc of grc OuterCircle into tx0
>>>>>
>>>>> put item 2 of the loc of grc OuterCircle into tY0
>>>>>
>>>>> put "" into tTotCount
>>>>>
>>>>> put "" into tLongCount
>>>>>
>>>>> emptyFlds
>>>>>
>>>>> end getStuff
>>>>>
>>>>>
>>>>> on mouseUp
>>>>>
>>>>> lock screen
>>>>>
>>>>> repeat 1000
>>>>>
>>>>> put random(200) into tR -- 200 is half the width of the larger circle
>>>>>
>>>>> if tR > 1 then
>>>>>
>>>>> ## put random(2*pi) into tTheta1
>>>>>
>>>>> get random(360)
>>>>>
>>>>> put it*pi/180 into tTheta1
>>>>>
>>>>> put tR*cos(tTheta1) into tX1
>>>>> put tR*sin(tTheta1) into tY1
>>>>>
>>>>> set the loc of grc Ptgrc to tX0 + tX1, tY0 - tY1 --- grc Ptgrc is a 2 pixle oval
>>>>>
>>>>> if intersect(grc Ptgrc, grc InnerCircle, "opaque Pixels") then add 1 to tLongCount
>>>>>
>>>>> add 1 to tTotCount
>>>>>
>>>>> end if
>>>>>
>>>>> end repeat
>>>>> put tTotCount into fld "totcountFld"
>>>>>
>>>>> put tLongCount into fld “LongCountFld"
>>>>>
>>>>> put tLongCount/tTotCount into fld "RatioFld"
>>>>>
>>>>> unlock screen
>>>>>
>>>>> end mouseUp
>>>>>
>>>>>
>>>>> Apparently, this does not generate a random point within the larger circle! Can someone please tell me what’s wrong here?
>>>>>
>>>>> Thanks,
>>>>> Roger
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list