It allows you to find the 100th term in a Fibonacci series.

    0}|.% 1 +. (+%)/\ 100 $ 1x
354224848179261915075

Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] 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 <
peter.b.kess...@oracle.com> 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

Reply via email to