The recursive relation is $f(n+1) = 2 + \frac{1}{f(n)} $, I would like to find $$\lim_{n\to\infty} f(n)$$ given $f(1)=3$.
I tried to use RSolve but it does not give me a definite value.
RSolve[{f[n + 1] - 1/f[n] == 2}, f[1] == 3, n]
The recursive relation is $f(n+1) = 2 + \frac{1}{f(n)} $, I would like to find $$\lim_{n\to\infty} f(n)$$ given $f(1)=3$.
I tried to use RSolve but it does not give me a definite value.
RSolve[{f[n + 1] - 1/f[n] == 2}, f[1] == 3, n]
In Version 11.2, you can use RSolveValue to obtain the answer as shown below
(unfortunately, earlier versions return Indeterminate for this input).
=================
RSolveValue[{f[n + 1] - 1/f[n] == 2, f[1] == 3},
f[Infinity], n]
(* 1 + Sqrt[2] *)
N[%]
(* 2.41421 *)
FixedPoint[2 + 1/# &, 3.]
(* 2.41421 *)
=====================
Hope this helps.
Devendra Kapadia, Wolfram Research, Inc.
It should be RSolve rather than Rsolve and the boundary condition must be inside the list of equations.
Clear[f];
eqns = {f[n + 1] - 1/f[n] == 2, f[1] == 3};
soln = RSolve[eqns, f, n][[1]];
Verifying that the solution satisfies the equations
eqns /. soln // Simplify
(* {True, True} *)
f[n] /. soln // FullSimplify
(* 1 + Sqrt[2] - (2 Sqrt[2] (1 - Sqrt[2])^n)/((1 - Sqrt[2])^n + (1 + Sqrt[2])^n) *)
Limit[f[n] /. soln, n -> Infinity]
(* 1 + Sqrt[2] *)
Limit[f[n] /. soln, n -> -Infinity]
(* 1 - Sqrt[2] *)
Just for fun:
cp = {x, x} /. Solve[x == 2 + 1/x, x];
fp = cp[[2, 1]]
f[x0_, n_] :=
Sequence @@ {{##}, {{##}[[2]], {##}[[2]]}} & @@@
Partition[NestList[2 + 1/# &, x0, n], 2, 1]
Plot[{2 + 1/x, x}, {x, -5, 5},
Epilog -> {Red, PointSize[0.02], Point@cp}]
ListAnimate@
Table[Plot[{2 + 1/x, x}, {x, 2.3, 3},
Epilog -> {Red, PointSize[0.02], Point[cp], Line[f[3, j]]},
PlotRange -> {2.3, 2.45}], {j, 1, 5}]
FixedPoint[2 + 1/# &, 3.]. It applies the function repeatedly until the output doesn't change. $\endgroup$FixedPoint[2 + 1/# &, 3.] // RootApproximant$\endgroup$RSolve. $\endgroup$