1

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+...}}}} $$

Tony Dong
  • 869
  • 9
  • 16

1 Answers1

5

Well, it is really simple with Fold

Fold[a[#2] + b[#2]/(a[#2] + #1) &, 0, Reverse[Range[6]]]

Mathematica graphics

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
  • @JasonB That's what I want. Thanks :) – Tony Dong Jan 06 '16 at 08:25