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 is that if tk is the linear fractional transformation ak % bk + ] then the nth term is b0 + t1 t2 ... tn 0 . ("term" is defined below) --Kip Murray Sent from my iPad > On Feb 23, 2014, at 4:17 PM, km <k...@math.uh.edu> wrote: > > 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 , ... > > where between the commas I am assuming J's right-to-left evaluation. The nth > term would be > > b0 + a1%b1 + a2%b2 + a3%b3 + ... + an%bn (still using right to left > evaluation). > > What is a good way to calculate this nth term in J? > > > For a half-page introduction to generalized continued fractions see > > http://people.math.sfu.ca/~cbm/aands/page_19.htm > > Continued fractions for ln(1+z) and ln((1+z)%(1-z)) are given here > > http://people.math.sfu.ca/~cbm/aands/page_68.htm > > > --Kip Murray > > Sent from my iPad > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm