This might work... LogFact=. ^.@:!`((((2 %~ ^.@:o.@:(2"_)) + ((] - 0.5"_) * ^.) + -@:] + %@:(12 * ])) + %@:(360 * ] ^ 3"_) + %@:(1260 * ] ^ 5"_))@:>:)@.(170 < ])"0 NB. Using Stirling's formula after 170
Wrap=. -@:[ ]\ 5!:5@<@:] 44 Wrap 'LogFact' ^.@:!`((((2 %~ ^.@:o.@:(2"_)) + ((] - 0.5"_) * ^.) + -@:] + %@:(12 * ])) + %@:(360 * ] ^ 3"_) + %@:(1260 * ] ^ 5"_))@:>:)@.(170 < ]) "0 LogFact 1111.1 6685.58741 (LogFact - (^. o !)) 1 10 20 100 150 161 165 170 171 200 0 0 0 0 0 0 0 0 __ __ On Wed, Jun 10, 2015 at 9:36 AM, Raul Miller <[email protected]> wrote: > Yes. > > Motivation is this rosettacode task: > http://rosettacode.org/wiki/Calculate_P-Value > > Thanks, > > -- > Raul > > On Wed, Jun 10, 2015 at 9:25 AM, Roger Hui <[email protected]> > wrote: > > Can the argument be other than positive integers? > > > > On Wed, Jun 10, 2015 at 6:22 AM, Raul Miller <[email protected]> > wrote: > > > >> Does anyone have an implementation of ^.@! which will work for > >> moderately large values (like 1000)? > >> > >> Thanks, > >> > >> -- > >> Raul > >> ---------------------------------------------------------------------- > >> 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
