Ohh, that is really nice.

Or, converted to tacit:

lngamma=: ^.@!@(1 | ]) + +/@:^.@(1 + 1&| + i.@<.)

Thanks!

-- 
Raul


On Wed, Jun 10, 2015 at 10:15 AM, Roger Hui <[email protected]> wrote:
> For non-negative real x, !x can be computed as (!1|x)**/(1+1|x)+i.<.x,
> therefore ^.x is ^. of the long expression, which is
> (^.!1|x)++/^.(1+1|x)+i.<.x .  For example:
>
>    x=: 4.75
>    !x
> 78.7845
>    (!1|x)**/(1+1|x)+i.<.x
> 78.7845
>
>    ^.!x
> 4.36672
>    (^.!1|x)++/^.(1+1|x)+i.<.x
> 4.36672
>
>    x=: 140.23
>    ^.!x
> 556.358
>    (^.!1|x)++/^.(1+1|x)+i.<.x
> 556.358
>
> Works for non-negative integers:
>
>    x=: 10
>    ^.!x
> 15.1044
>    (^.!1|x)++/^.(1+1|x)+i.<.x
> 15.1044
>
>    x=: 0
>    ^.!x
> 0
>    (^.!1|x)++/^.(1+1|x)+i.<.x
> 0
>
>
>
> On Wed, Jun 10, 2015 at 6: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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to