I got lost at d=:purr=:

Here's what I had up to that point:

   oneCup=: 1 10$ 4 6 8 12 20
or
   oneCup=: ,:2# 4 6 8 12 20

   tosses=: +/"1@:?@#&oneCup

   tosses 10
48 53 53 57 49 39 49 60 38 65

-- 
Raul


On Wed, Dec 7, 2011 at 11:16 PM, Linda Alvord <lindaalv...@verizon.net> wrote:
> Here's a more sensible second frequence distribution problem. Forget the
> bucket! Put two of each of the five platonic solids in a small cup.
>
> Toss these dice over and over until you have half a million tosses. Make a
> frequency distribution of the half-million sums.  See below for a hint that
> may or may not work for you.  Design a monadic modification of the function
> fd  and call it    d=:purr=:
>
> The result  d  will be the two column frequency distribution.
>
> Provide the percentages for each of the distinct sums that occurred in you
> tosses.
>
> The expression:   assert 100= assert 100=1{+/purr d
>
> Will affirm that your percentages are correct:
>
> Linda
>
> -----Original Message-----
> From: programming-boun...@jsoftware.com
> [mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
> Sent: Wednesday, December 07, 2011 4:54 AM
> To: 'Programming forum'
> Subject: Re: [Jprogramming] Many Turkey Rolls - No embargo
>
> That really was some frequency distribution!
>
> In my thinking the sum of any one toss would range from 5 to 50.
>
> Here's how the story started in my imagination:
>
>    7#"1 ,.4 6 8 12 20
>  4  4  4  4  4  4  4
>  6  6  6  6  6  6  6
>  8  8  8  8  8  8  8
> 12 12 12 12 12 12 12
> 20 20 20 20 20 20 20
>
> How about if you word an interesting problem to make lots of tosses of these
> 5 dice and make a sensible frequency distribution using simple J ?
>
> I've been wondering why no one solved it in a day or two.
>
> Too many things interested me this week.  Plot is now working nicely.  The
> Turkey Challenge has been an endless challenge. An excursion in the
> imaginary realm which I have ignored for more than 20 years didn't help.
>
> I'd like to ponder your frequency distribution and finalize a really concise
> summary for the turkeys.
>
> Thanks in advance.
>
> Linda
>
>
> -----Original Message-----
> From: programming-boun...@jsoftware.com
> [mailto:programming-boun...@jsoftware.com] On Behalf Of Ric Sherlock
> Sent: Wednesday, December 07, 2011 4:20 AM
> To: Programming forum
> Subject: Re: [Jprogramming] Many Turkey Rolls - No embargo
>
> On Wed, Dec 7, 2011 at 10:16 PM, Ric Sherlock <tikk...@gmail.com> wrote:
>> On Tue, Dec 6, 2011 at 11:32 AM, Linda Alvord <lindaalv...@verizon.net>
> wrote:
>>> For number  2  each time you toss the dice, you must get a total for all
> the
>>> 500 dice.  Next you toss the full bucket of dice 199 more times. Make a
>>> frequency distribution of the 200 results.
>>
>> If I implement this description of number 2 I get almost 200 different
>> sums of the 200 throws of 500 dice, i.e. almost all of the sums have a
>> frequency of 1 (the odd one has 2 or 3).
>>
>> platonic=: 4 6 8 12 20
>> sumtoss=: [: +/ ?@$
>> fd=: [: /:~ ({. , #)/.~
>> fd 500 200 sumtoss platonic
>
> Sorry sumtoss should be:
> sumtoss=: [: +/ 1 + ?@$
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to