On Fri, Nov 9, 2018 at 12:56 AM Linda Alvord <[email protected]>
wrote:
> Jose, I'm not sure I'll be able to follow your ideas.
>
> !i.11x
> 1 1 2 6 24 120 720 5040 40320 362880 3628800
>
>
> However, Fibohacci would be a nice primitive.
>
> Linda
>
>
J's ! monadic primitive can produce a lot more than just factorials. It is
a shifted Gamma function and its domain is any numeric datatype, from
integers to complex.
Consider the slightly different mapping,
M=. '1:`(* u@:<:)@.(0 -.@:= |)' (1 :)
M still can be used for recursive calculations for non-negative integers,
$:M ("0) i.11
1 1 2 6 24 120 720 5040 40320 362880 3628800
and ! is a fixed-point for the mapping M (ignoring the rank); for example,
! ("0) i.11
1 1 2 6 24 120 720 5040 40320 362880 3628800
!M ("0) i.11
1 1 2 6 24 120 720 5040 40320 362880 3628800
!M M ("0) i.11
1 1 2 6 24 120 720 5040 40320 362880 3628800
As far as I can see, it is also a fixed-point under M for the complex plane
a the domain; for example,
rnd=. 1 -~ 2 * 0 ?@:#~ ]
(! = !M)("0)@:(rnd + j.@: rnd) 33
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
It seems to me that one can use Binet's formula to expand Fibonacci's verb
domain to the complex plane. I am not sure if it is worth it as a primitive
in terms of its potential applications though; but, the forum
mathematicians could enlight me.
PHI=. 2 %~ 1 + %:5
PSI=. 1 - PHI
Fib=. ((PHI -PSI) %~ PHI&^ - PSI&^)f.
Fib i:5
5 _3 2 _1 1 0 1 1 2 3 5
Fib@:(rnd + j.@: rnd) 5
0.674810807j0.111443538 0.285740175j0.261592161 0.309366626j_0.567802601
0.453913178j_0.549339843 1.71435503j_0.764180294
One can explore Fib using Andrew Nikitin's awsome Phase Potraits (they
suggest Fib has numerable number of zeros in the complex plane, if I am not
mistaken).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm