Looks very concise....
We were out for Liz's birthday, so I hadn't thought about it!
Mike
On 12/03/2016 23:44, Rob Hodgkinson wrote:
Agree, very nice solution Raul.
On 13 Mar 2016, at 10:02 AM, Kip Murray <[email protected]> wrote:
Very nice, Raul! Much shorter than my Rube Goldberg approach. --Kip
On Saturday, March 12, 2016, Raul Miller <[email protected]> wrote:
cv=: ([: (+`%/) 1 }.,)\@|:
I hope this helps...
--
Raul
On Sat, Mar 12, 2016 at 1:21 PM, Kip Murray <[email protected]
<javascript:;>> wrote:
Here you go:
nume =: 1 , 1 % 4x * _1 + 4 * [: *:@>:@i. <:
dene =: 1 1r2 , 1 $~ _2 + ]
I think I got those from Abramowitz and Stegun.
(_1 , nume 6),: dene 7
_1 1 1r12 1r60 1r140 1r252 1r396
1 1r2 1 1 1 1 1
--Kip
On Saturday, March 12, 2016, Raul Miller <[email protected]
<javascript:;>> wrote:
How do you compute the first two rows?
Thanks,
--
Raul
On Saturday, March 12, 2016, Kip Murray <[email protected]
<javascript:;>
<javascript:;>> wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm