Here is what I ended with

    recur =: 2 : '(, u)^:n'
 
    fib =: [: +/ _2 {. ]  NB. Raul's idea
 
    arith =: + {:

    e =: * {: % #   
 
    1&e recur 5 [ 1  NB. Note argument 1 not ''
 1 1 0.5 0.166667 0.0416667 0.00833333
 
    +/ 1&e recur 10 [ 1
 2.71828
 
    +/ _1&e recur 10 [ 1
 0.367879
 
    ^ 1 _1
 2.71828 0.367879

Raul's solution for e used t. and thus did not require knowledge of the Taylor 
series for monadic ^

Kip Murray

Sent from my iPad


On Dec 23, 2012, at 9:00 PM, km <k...@math.uh.edu> wrote:

> Write a conjunction recur and verbs fib, arith, and e that do the following
> 
>    fib recur 5 [ 1 1  NB. five additional terms of Fibonacci sequence
> 1 1 2 3 5 8 13
>    0.5&arith recur 5 [ 3
> 3 3.5 4 4.5 5 5.5
>    1&e recur 5 [ ''
> 1 1 0.5 0.166667 0.0416667
>    +/ 1&e recur 10 [ ''
> 2.71828
>    +/ _1&e recur 10 [ ''
> 0.367879
>    ^ 1 _1
> 2.71828 0.367879
> 
> Conjunction recur helps create "recursive" lists.
> 
> Kip Murray
> 
> Sent from my iPad
> ----------------------------------------------------------------------
> 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