Henry,
I do not have code but can point you to formulas in the Handbook of Mathematical Functions by
Abramowitz and Stegun, Chapter 3 Elementary Mathematical Methods, Section 3.10 Theorems on
Continued Fractions (page 19 in my edition). Be sure to read both columns of formulas.
There is no unique continued fraction product for two continued fractions, but you could try the
following to find _a_ product. First given two infinite continued fractions f and g use the
recursive matrix multiplication given in formula (3) of Section 3.10 to find the numerators and
denominators of the n^th convergents
f_n = A_n/B_n
n = 1,2,3,...
g_n = C_n/D_n
(conventional notation, _n means subscript n). The convergents converge to the value of the
continued fraction.
Let
E_n = A_n * C_n
n = 1,2,3...
F_n = B_n * D_n
Then, to find a continued fraction h (this is your product) with convergents
h_n = E_n/F_n n = 1,2,3...
solve the matrix recursion (3) for for the entries e_n and f_n in
h = f_0 + e_1
---------
f_1 + e_2
--------
f_2 + ...
(I hope that comes out right on your screen.)
The recursion (3) written for the continued fraction h is
(E_n , F_n) = ((E_(n-1) , F_(n-1)) ,. (E_(n-2) , F_(n-2)) o (f_n , e_n)
using a mix of standard notation and J, where o is +/ . *
Starting values are E_(-1) = 1, E_0 = f_0, F_(-1) = 0, F_0 = 1. You can use
f_0 = 0.
Please get the correct formulas from Abramowitz and Stegun -- in case I mistyped something. And
of course you have %. for solving for (f_n , e_n).
Kip Murray
Henry Rich wrote:
Does anyone have J code for multiplying two numbers expressed as simple
continued fractions, producing a continued-fraction result?
Henry Rich
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm