x [EMAIL PROTECTED] y is equivalent to ?x$y and is supported by special code. It is faster and leaner and less consumptive of the underlying sequence of random numbers. The differences between the two expressions are most striking when y is 2.
----- Original Message ----- From: Raul Miller <[EMAIL PROTECTED]> Date: Friday, August 8, 2008 13:40 Subject: Re: [Jprogramming] general Gamma distribution To: Programming forum <[email protected]> > On Fri, Aug 8, 2008 at 4:22 PM, Robert Cyr > <[EMAIL PROTECTED]> wrote: > > poissonran=: 4 : 0 > > n=. 5*x > > (+/\(^-x)**/\1,x%}.i.>:n)I.?y$0 > > ) > > Translated to tacit form, this becomes: > > pr=: [EMAIL PROTECTED]&[EMAIL PROTECTED] I.~ [EMAIL PROTECTED]@[ +/\@:* 1 > */\@, [ % 1 + 5 > [EMAIL PROTECTED] [ > > Translated back to explicit form, that becomes: > > prn=: 4 :0 > (?y$0) I.~ +/\ (^-x)* */\1, x% 1+ i.5* x > ) > > And, if we take Henry Rich's advice and factor out the threshold > list, that explicit form becomes: > > prth=: 3 :0 > +/\ (^-x)* */\1, x% 1+ i.5* x > ) > prl=: 4 :0 > x I. ?y$0 > ) > > Usage example: > (prth 100) prl 1e4 > > [But, of course, to take advantage of the speed up, you would > want to store the deterministic result (prth 100) in a variable.] ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
