Jose, If you look up the derivation of the fibonnaci series was developed you 
will find  1 1 2 3 5 . . .

I think it should be left out of an example of the Y form. Or, maybe it can be 
modified to come out correctly.

I do have a way to generate the correcg formula and feel mathematicians will be 
more comfortable with that.


Linda

 

-----Original Message-----
From: Programming <[email protected]> On Behalf Of Jose 
Mario Quintana
Sent: Monday, December 3, 2018 6:18 PM
To: [email protected]
Subject: Re: [Jprogramming] Revisisting the Y combinator

Linda,

The choice to start the Fibonacci sequence at 0 is to conform with some of the 
other answers at the Rosetta Code page,

   Y combinator
   
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Frosettacode.org%2Fwiki%2FY_combinator&amp;data=02%7C01%7C%7Cd5f47a327c0443363f9908d65975a77c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636794759195093996&amp;sdata=%2Fe4zXDMvVTrntKNbwZGp8rgnvkS2CZF%2FbTEq5tauOwc%3D&amp;reserved=0

Most people start numbering items at 1 and when producing a function (Fib) for 
the Fibonacci sequence the correspondence is,

   1 2 3 4 5 6  7  8  9 10 ...
   1 1 2 3 5 8 13 21 34 55 ...

Some of us, and J, start numbering items at 0.  So we can use the 
correspondence,

 0 1 2 3 4 5 6  7  8  9 10 ...
 0 1 1 2 3 5 8 13 21 34 55 ...

So, either way, Fib(10) is 55 and we all agree even if we disagree.

(Apparently, the Fibonacci function can be extended to the complex plane and 
beyond using, the so-called, Binet's formula.)

I hope it helps


On Thu, Nov 29, 2018 at 10:40 PM Linda Alvord <[email protected]>
wrote:

> Jose,  Somehow this surprised me.
>
> Y=: ($:`)(`:6)
>    N=: 1 :'(u@:<:@:<: + u@:<:)^:(1 < ])'
>     P=: (5!:1)<'N'
>     P Y("0) i.11
> 0 1 1 2 3 5 8 13 21 34 55
>
>    Y
> ($:`)(`:6)
>    N
> 1 : '(u@:<:@:<: + u@:<:)^:(1 < ])'
>    P
> ┌────────────────────────────────────────────┐
> │┌─┬────────────────────────────────────────┐│
> ││:│┌─────┬────────────────────────────────┐││
> ││ ││┌─┬─┐│┌─┬────────────────────────────┐│││
> ││ │││0│1│││0│(u@:<:@:<: + u@:<:)^:(1 < ])││││ ││ 
> ││└─┴─┘│└─┴────────────────────────────┘│││
> ││ │└─────┴────────────────────────────────┘││
> │└─┴────────────────────────────────────────┘│
> └────────────────────────────────────────────┘
>
>
> Linda
>
>
>
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Cd5f47a327c0443363f9908d65975a77c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636794759195093996&amp;sdata=lCxvmrsNHIVIwirWR2FFzynosiAI4mdoYkANIdHSg0Q%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to