The tables show what is happening quite nicely.
g=: 13 :'(+%)/\ y $ 1x'
(g"0) 1+i.7
1 0 0 0 0 0 0
1 2 0 0 0 0 0
1 2 3r2 0 0 0 0
1 2 3r2 5r3 0 0 0
1 2 3r2 5r3 8r5 0 0
1 2 3r2 5r3 8r5 13r8 0
1 2 3r2 5r3 8r5 13r8 21r13
h=: 13 :'(+%)/\ y $ 1'
(h"0) 1+i.7
1 0 0 0 0 0 0
1 2 0 0 0 0 0
1 2 1.5 0 0 0 0
1 2 1.5 1.66667 0 0 0
1 2 1.5 1.66667 1.6 0 0
1 2 1.5 1.66667 1.6 1.625 0
1 2 1.5 1.66667 1.6 1.625 1.61538
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Friday, February 21, 2014 1:01 AM
To: [email protected]
Subject: Re: [Jprogramming] What does this do?
WOW!
This is quite impressive!
{|.(+%)/\100$1x
573147844013817084101r354224848179261915075
0{|.(+%)/\200$1x
453973694165307953197296969697410619233826r280571172992510140037611932413038
677189525
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Thursday, February 20, 2014 10:07 PM
To: Programming forum
Subject: Re: [Jprogramming] What does this do?
If you want just the n-th term, you can do as follows, (+%)/ instead of
(+%)/\
% 1 +. (+%)/ 100$1x
354224848179261915075
On Thu, Feb 20, 2014 at 6:48 PM, Linda Alvord
<[email protected]>wrote:
> It allows you to find the 100th term in a Fibonacci series.
>
> 0}|.% 1 +. (+%)/\ 100 $ 1x
> 354224848179261915075
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Roger Hui
> Sent: Thursday, February 20, 2014 5:14 PM
> To: Programming forum
> Subject: Re: [Jprogramming] What does this do?
>
> See also http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence
>
> It is another way to the "Why J?" (or "Why APL?") question. Because it
> allows, encourages, assists, ... you to think of 10 different ways of
> generating the Fibonacci numbers and other similar questions. Several
> factors come into play in such thinking. See section 1 of Ken Iversons'
> Turing lecture <http://www.jsoftware.com/papers/tot.htm>. Do you get the
> same with another language?
>
> More direct answers to the questions you posed:
>
> - It's known both in conventional mathematics and in APL that the
> continued fraction (+%)/n$1 has the golden ratio phi as the limit.
> - Therefore, (+%)/\n$1 are convergents to phi.
> - It's known but perhaps less so that (+%)/\n$1x provides rational
> approximations to phi.
> - It is known (?) that these rational approximations to phi are of the
> form x%y where x and y are successive Fibonacci numbers. If you didn't
> know it and you stare at the result of (+%)/\n$1x, the answer comes
> pretty
> quickly.
> - It is known that 1+.r is the reciprocal of the denominator of the
> rational number (I learned it in my I.P. Sharp days circa 1980).
>
> Hope this helps. I am not sure exactly what is "that way" of thinking
that
> you refer to. (Array thinking? Mathematical thinking? Sideways
> thinking?)
>
>
>
>
> On Thu, Feb 20, 2014 at 1:27 PM, Peter B. Kessler <
> [email protected]> wrote:
>
> > A more interesting question is: Why did you think of doing it that way?
> > The really interesting question is: How can I learn to think that way?
> >
> > ... peter
> >
> >
> > On 02/20/14 12:42, Roger Hui wrote:
> >
> >> % 1 +. (+%)/\ 100 $ 1x
> >>
> > ----------------------------------------------------------------------
> > 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm