On Fri, Dec 9, 2011 at 12:14 PM, Linda Alvord <[email protected]> wrote:
> Create a frequency distribution fd of your data. How many of each possible
> toss occurred. The possibilities are from 5 and 100 inclusive.
This cannot be right. Either we are throwing one of each of the
polyhedral dice and the possibilities are from 5 through 50, or we are
throwing two of each of the polyhedral dice and the possibilities are
from 10 through 100. Currently I am leaning towards the "two of each"
interpretation.
That leaves me with:
oneCup=: ,:2# 4 6 8 12 20 NB. noun
tosses=: +/"1@(1 + ?@#&oneCup) NB. verb
fd=: (~.,. #/.~) tosses 5e5 NB. noun
(And, yes, my earlier suggestion had a bug - a six sided dice would
have numbers ranging from 0 through 5.)
> Then make purr . This is also a frequency distribution but the results
> should be percent of the total tosses each possible result. The total of
> these 96 percents should have a sum of 100% . This can be affirmed with
> assert. It checks the frequency distribution to be sure that your percentages
> are correct.
This would be:
purr=: fd %("1) 1 _<.+/fd*0.01
Except here I see that you are suggesting that I have a bucket for
each possible option, which typically will not happen. 10 will occur
approximately one time in 2 trillion rolls:
*/&.:%,oneCup
2.12337e9
So let's revisit fd:
fd=: (~.,. #/.~ - 1:) (10}.i.1++/,oneCup),tosses 5e5
purr=: fd %("1) 1 _<.+/fd*0.01
> Are your actual sums in a noun, d, of length 1e5 ? This list needs to be
> tallied in a frequency distribution.Then also do a frequency distribution of
> percentages. Write the verb purr
>
> fdrm=:
> fdrm
> Tally of totals
What are the arguments of fdrm?
Possibilities include;
''
5e5
(,oneCup); 5e5
oneCup; 5e5
5e5$ oneCup
1 + ? 5e5$ oneCup
> Purrrm=:
> purrrm d
> Tallies converted to percentages
What are the arguments of Purrrm? This could be the same arguments
that fdrm takes or it could be the result of fdrm.
> Purr has the sound of PERcent. Sorry if the playful name bothered you.
I have no problem with the name. Some time I should tell you about
the parser I wrote where all of the names came from the Flintstones,
because I could not think of anything better.
Hopefully my above comments, interleaved with text you wrote, make my
problems clearer.
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm