I was playing with some recurrence relations, and I ended up with this a long nested function. How can I generalize the following relationship:
$$ f_n = a + \frac{b}{f_{n-1}} $$
$$ f_1 = a + \frac{b}{f_0} $$
$$ f_2 = a + \frac{b}{f_1} = a + \cfrac{b}{a + \cfrac{b}{f_0}} $$
$$ f_3 = a + \frac{b}{f_2} = a + \cfrac{b}{a + \cfrac{b}{a + \cfrac{b}{f_0}}} $$
$$ f_4 = a + \frac{b}{f_3} = a + \cfrac{b}{a + \cfrac{b}{a + \cfrac{b}{a + \cfrac{b}{f_0}}}} $$
For each iteration, another function gets nested in the denominator. Is there any way to generalize this behavior for an $n^\text{th}$ iteration?
Best Answer
These are called continued fractions and you can find a formula for nicely "collapsing" them here: Euler's Continued Fraction Formula
A pretty result that fits into your constraints is that for $a=b=1$ the fractions converge to the golden ratio.