That's correct. Giving:

c=. >.(m%n)^. p%(m!n)
or
c=. m (% <.@^. p%!) n

if we are only interested in getting exactly n elements, then subtract the
probability for at most (m-1) values from the probability of having m
values:

p=. -/ (m-i.2) (!*c^~%) n

Marshall

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Brian Schott
Sent: Friday, May 27, 2011 9:35 AM
To: Programming forum
Subject: Re: [Jprogramming] roll and deal

Do you mean %~ instead of - /

   n=:4
   m=:2
   c=: 4 5
   (m!n)*(m^c)
96 192
   n^c
256 1024
   (m!n)* (n-m)^c
96 192
   (m!n)* (n%m)^c
96 192
   (m!n)* (n%~m)^c
0.375 0.1875
   (m!n)* (m%n)^c
0.375 0.1875


On Fri, May 27, 2011 at 8:05 AM, Marshall Lochbaum
<[email protected]> wrote:
> Provided you mean at least m distinct values, the number of ways to 
> have exactly m distinct values is
> (m!n)*(m^c)
> And the number of ways total is
> n^c
> Which gives us a probability of
> (m!n)* (n-m)^c
>
> Then the answer is
> c=. >.(n-m)^. p% m!n
>
> Marshall
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Roger Hui
> Sent: Friday, May 27, 2011 2:00 AM
> To: Programming forum
> Subject: Re: [Jprogramming] roll and deal
>
> But what about the problem I posed?
>
>> What is the least c such that the probability of ?c$n having m 
>> distinct values is at least p?
>
>
>
> ----- Original Message -----
> From: Fraser Jackson <[email protected]>
> Date: Thursday, May 26, 2011 22:47
> Subject: Re: [Jprogramming] roll and deal
> To: Programming forum <[email protected]>
>
>> Hi Roger,
>>
>> I am sorry I somehow sent the note to Jprogramming with your name 
>> with lower case.
>>
>> I was brought up on the first edition of Feller - and we had 
>> calculators with crank handles to do the sums.  If you want to 
>> incorporate any bit of it in your Essay don't hesitate.
>>
>> Thanks for all you are doing for J.  It is just an amazing tool.
>>
>> Kindest regards,
>>
>> Fraser
>>
>>
>> ----- Original Message -----
>> From: "Roger Hui" <[email protected]>
>> To: "Programming forum" <[email protected]>
>> Sent: Friday, May 27, 2011 1:24 PM
>> Subject: [Jprogramming] roll and deal
>>
>>
>> > What is the least c such that the probability of ?c$n having m 
>> > distinct values is at least p?
>> >
>> > ref: http://www.jsoftware.com/jwiki/Essays/Birthday%20Problem
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



--
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
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