Here is how I would generate the terms of the finite continued fraction
1 + 2
--
3 + 4
--
5 + 6
--
7
cf =: {.@] , {.@] + [: ([: %`+/ 0 ,~ ,/)\ (,. }.)
2 4 6 cf 1 3 5 7x
1 5r3 29r19 233r151
The underlying idea
For the generalized continued fraction
1 + 2
--
3 + 4
--
5
the desired terms are
1
1 + 2
--
3
1 + 2
--
3 + 4
--
5
that is,
0 2 4 cf 1 3 5x
1 5r3 29r19
we can get this with
I forgot that there is a J Wiki essay on this topic:
http://www.jsoftware.com/jwiki/Essays/Continued_Fractions
On Sun, Feb 23, 2014 at 4:03 PM, Roger Hui wrote:
> Sometimes %`+/ and %`+/\ are the expressions, depending on circumstances.
> For example:
>
>x=: ?. 0
>x
> 0.038363
>%`+/
Sometimes %`+/ and %`+/\ are the expressions, depending on circumstances.
For example:
x=: ?. 0
x
0.038363
%`+/ x,,(1+2*i.20),.*:x
0.0383442
7 o. x
0.0383442
Gauss, 1812, according to C.D. Olds, Continued Fractions, MAA, 1963.
On Sun, Feb 23, 2014 at 3:55 PM, Roger Hui wrote:
>
a1n =. i.5
b1n =. >: i.5
b0 =. 1
1 + +/(i.5) % (>: i.5)
3.71667
- Original Message -
From: km
To: "programm...@jsoftware.com"
Cc:
Sent: Sunday, February 23, 2014 5:17:36 PM
Subject: [Jprogramming] Generalized continued fractions
The generalized continued f
+`%/ and +`%/\ are the expressions you seek. For example:
+`%/3,20$4 6
3.60555
%: 13
3.60555
On Sun, Feb 23, 2014 at 2:17 PM, km wrote:
> The generalized continued fraction
>
> b0 + a1
> -
> b1 + a2
> -
> b2 + a3
>
I think the spec calls for different lists of a and b?
- Original Message -
From: Lizanets Danylo
To: programm...@jsoftware.com
Cc: "programm...@jsoftware.com"
Sent: Sunday, February 23, 2014 5:55:29 PM
Subject: Re: [Jprogramming] Generalized continued fractions
Use (+%)/
Use (+%)/
(+%)/\9$1
1 2 1.5 1.7 1.6 1.625 1.61538 1.61905 1.61765
--- Original message ---
From: "km" < k...@math.uh.edu >
Date: 24 February 2014, 00:17:52
The generalized continued fraction
b0 + a1
-
b1 + a2
-
b2
The generalized continued fraction
b0 + a1
-
b1 + a2
-
b2 + a3
b3 + ...
is the infinite sequence
b0 , b0 + a1%b1 , b0 + a1%b1 + a2%b2 , b0 + a1%b1 + a2%b2 + a3%b3 ,