In Mathematica, is it possible to form the continued fraction of the following formula? $$ f = a_1+\cfrac{b_1}{a_1+a_2+\cfrac{b_2}{a_2+a_3+\cfrac{b_3}{a_3+a_4+\cfrac{b_4}{a_4+...}}}} $$
Asked
Active
Viewed 164 times
1
1 Answers
5
Well, it is really simple with Fold
Fold[a[#2] + b[#2]/(a[#2] + #1) &, 0, Reverse[Range[6]]]
halirutan
- 112,764
- 7
- 263
- 474
-
For the updated question, I think you only have to modify this as
Fold[a[#2] + b[#2]/(a[#2] + #1) &, (Range[10]~Join~{0}) // Reverse], I put the 0 in there so it doesn't have a constant in the terminal fraction. – Jason B. Jan 06 '16 at 08:20 -

Fold? – xzczd Jan 06 '16 at 07:43