Can I use Nest iteration variable as the variable of Limit?

Can anybody tell me what is wrong with this:

Limit[Nest[1/(1 + #) &, x0, n], n -> ∞]
• The 3rd argument of Nest must be numeric – Coolwater Nov 18 '18 at 14:02
• This FixedPoint[1/(1 + #) &, #] & /@ Range[0., 4, 1] might help. – Αλέξανδρος Ζεγγ Nov 18 '18 at 14:17
• Or for an exact value x /. Solve[{1/(1 + x) == x, x > 0}, x][[1]] – Bob Hanlon Nov 18 '18 at 14:35

Nest is a functional programming construct whereas Limit works primarily with mathematical expressions. It simply has no way to work with Nest[...].

This can instead be handled by converting the nested expression into a solved recurrence.

recval =
RSolveValue[{f[n] == 1/(1 + f[n - 1]), f[0] == x0}, f[n], n]

(* Out[591]= ((2/(1 + Sqrt[5]))^
n (-2^(1 - n) (1 - Sqrt[5])^n +
2^(1 - n) (1 + Sqrt[5])^n + (1/2 (1 - Sqrt[5]))^n x0 +
Sqrt[5] (1/2 (1 - Sqrt[5]))^n x0 - (1/2 (1 + Sqrt[5]))^n x0 +
Sqrt[5] (1/2 (1 + Sqrt[5]))^n x0))/(1 + Sqrt[
5] - ((1 - Sqrt[5])/(1 + Sqrt[5]))^n +
Sqrt[5] ((1 - Sqrt[5])/(1 + Sqrt[5]))^n + 2 x0 -
2 ((1 - Sqrt[5])/(1 + Sqrt[5]))^n x0) *)

Since we are only really interested in integer n I will use DiscreteLimit on this.

dlim = DiscreteLimit[recval, n -> Infinity]

(* Out[592]= (2 + (-1 + Sqrt[5]) x0)/(1 + Sqrt[5] + 2 x0) *)

This is actually independent of initial value:

FullSimplify[dlim]

(* Out[610]= 1/2 (-1 + Sqrt[5]) *)

Another well known way to deduce candidate values for the limit is to solve the fixed point equation.

Solve[x == 1/(1 + x), x]

(* Out[594]= {{x -> 1/2 (-1 - Sqrt[5])}, {x -> 1/2 (-1 + Sqrt[5])}} *)
• +1 You get the same result with Limit[recval, n -> Infinity] // FullSimplify. Also, it is useful to include FullSimplify in definition of recval – Bob Hanlon Nov 18 '18 at 16:16