I have a non-linear recurrence relation:
$$\epsilon_i = \sqrt{\frac{2}{1+\epsilon_{i-1}}}\epsilon_{i-1}$$ Here, $\epsilon_0\in[0,1]$, but it's really some function $f(n,p)$ for some other parameters.
I've derived by hand a lower bound $\ell_i$, and upper bound $u_i$ for $\epsilon_i$. These are all functions of $i$ (and implicitly $\epsilon_0$), and I know that:
$$\ell_i \leq \epsilon_i\leq u_i,\quad \forall i$$
I want to use mathematica to "explore" how tight these bounds are somewhat. Ideally, I'd:
- Plot all three bounds (for say $i\in[1, 1000]$)
- Put this in a manipulate call, so manipulate $n, p$.
I've worked out how to do this without the recurrence relation (so for solely the bounds). My code for the recurrence relation seems to have issues though:
eps0[n_, p_] := Sqrt[(p * Log[2] + Log[p])/(2 n)]
eps[i_, n_, p_] := (Sqrt[2] * eps[i - 1, n, p])/Sqrt[1 + eps[i - 1, n, p]]
eps[0, n_, p_] := eps0[n, p]
This unfortunately causes a recursion depth error, even though it seems like I defined the base case $\epsilon[0, n, p] = \epsilon_0[n, p]$, like I was supposed to.