The challenge is at the end.  First a table for a finite continued fraction
that approximates e =: ^ 1 .
 --Kip Murray


The table below summarizes a finite continued fraction which begins

         1
 1 + -------------
             1r12
     1r2 + --------
                1r60
           1 + ------

               1 + .
                     .
                       .

    table
 _1   1 1r12   1r60     1r140       1r252          1r396
  1 1r2    1      1         1           1              1
  1   3 19r7 193r71 2721r1001 49171r18089 1084483r398959


You must ignore the _1 in the upper left corner. You see how the first row
identifies numerators and the second row numbers on the "diagonal" of the
continued fraction.


The third row gives the "convergents", results of terminating the continued
fraction at a diagonal number.  The first four convergents are

 1 , (1 + 1 % 1r2) , (1 + 1 % 1r2 + 1r12 % 1) , (1 + 1 % 1r2 + 1r12 % 1 +
1r60 % 1)


The convergents of this continued fraction approximate the number  e =: ^ 1
.

    2 * 0.5 * {: table
 1 3 2.714285714 2.718309859 2.718281718 2.718281829 2.718281828


Now, how would you write verb cv which provides the third row of the table
given the first two?

    2 {. table
 _1   1 1r12 1r60 1r140 1r252 1r396
  1 1r2    1    1     1     1     1

    cv 2 {. table
 1 3 19r7 193r71 2721r1001 49171r18089 1084483r398959


--Kip Murray



-- 
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to