That was untested - hence errors.

If r and b are two choices, and you start with a bag containing r,b and after 
each turn where you take one item from the bag you add another r. The goal is 
to find the probability of choosing more b's than r's. As I probably haven't 
explained well, here's an example:

b,r - take b, return it and add another r
b,r,r - take r, return it and add another r
b,r,r,r - take b, return it.

In this case there were 3 turns, and 2 b's were chosen vs 1 r, so that is a 
success. The probability of taking more b's than r's is the probability of 
taking 3 b's = %24 plus the probability of taking 2 b's and 1 r = 24%~1+2+3 
which gives 7r24. Though I'm not actually sure my idea for the general case is 
totally correct.

On 19 Oct 2011, at 15:48, Marshall Lochbaum wrote:

> The correct way is to compute all the terms in the expression and then
> multiply them together. Something like
>   n* > *&.>/ >:@i.&.> n->:i.k
> However, the expressions you gave will return length errors, since (>:i.n-2)
> is patently not the same length as (>:i.n-1). What exactly are you trying to
> compute?
> 
> Marshall
> 
> On Wed, Oct 19, 2011 at 10:39 AM, David Vaughan <
> [email protected]> wrote:
> 
>> I couldn't really think of an appropriate title for this. My issue is that
>> I want to compute an expression that has a different number of terms
>> depending on y.
>> 
>>  +/(>:i.n-1)*n NB. for all n, y >: n > 1
>>  +/(>:i.n-2)*(>:i.n-1)*n NB. for all n, y >: n > 2
>> 
>> and so on, so that:
>> 
>>  lim =. <:<.y%2
>> 
>> and we carry on the style of expression above until we are doing it for all
>> n, y >: n > lim.
>> 
>> So in the case for y=.5, lim=.1 and we only do the first of the lines
>> above. For y=.7, we would do the second one as well. For y=.9 we would do
>> the same as the second but with a (>:i.n-3) multiplied with it all as well.
>> I guess/hope there is some way of achieving this with power?
>> ----------------------------------------------------------------------
>> 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