I have been reluctant to include the interesting fd created by Henry Rich
and Ric Sherlock because I was unable to write the explicit version that
produces their tacit version. I finally got it , so we now have another fd.
fdrs=:[: /:~ ({. , #)/.~
fdrs
[: /:~ ({. , #)/.~
a=:3 2 3 3 1 3 4 1 1 2
fd=: 13 :'/:~(~.y),.#/.~y'
fd
[: /:~ ~. ,. #/.~
fd a
1 3
2 2
3 4
4 1
From: Linda Alvord [mailto:[email protected]]
Sent: Monday, January 09, 2012 10:45 AM
To: 'Linda Alvord'
Subject: Challenge 4 Bountiful Birthdays
Chalenge 4 Bountiful Birthdays PLEASE DO NOT RESPOND UNTIL 1/16/2012
12 am EST
For this challenge, as usual, do not use @ but you may use whatever style
and strategy you like to accomplish the task.
The problem is to simulate the classic birthday problem.
A single trial works this way. People enter a room one by one and declare
their birth date. Suppose the 29th person is the first person to match a
birthday of someone in the room. The result of the first trial is 29.
Repeat for 500 trials.
If you use Kip's frequency distribution of the results you have lots of
information.
fd=:[: /:~ ~. ,. [: +/"1 ~. =/ ]
But the mean gives a more concise summary of the data. So, the final part
of the problem is to obtain a list of 10 means of 500 trials and the
mean of the means.
'til next week.
Linda
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm