On Fri, Aug 8, 2008 at 9:30 AM, Raul Miller <[EMAIL PROTECTED]> wrote:
> This seems to give me a poisson distribution:
>
> prd=: _0.5 >[EMAIL PROTECTED] ] {. [ }. [ +//.@([EMAIL PROTECTED]@[EMAIL
> PROTECTED] 0:)@, 1 + ] + 2*[
>
> For example,
>
> require 'plot'
> plot poissonrand 100 1e5
> plot /:~ 100 prd 1e5
> ts=:6!:2,7!:[EMAIL PROTECTED]
> ts '100 prd 2e6'
> 2.48258 2.24815e9
I pasted the wrong function definition in, there. Those timings were based on:
prd=: 4 :0
n=. >:&.(p:inv) 1+y+2*x
r=. n [EMAIL PROTECTED]@[EMAIL PROTECTED] 0
>. _0.5+y{.x}. +//. (x,_1+n)$r
)
Sorry about that,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm