# Specifying Range of RSolve

When I input

RSolve[{0 == q[n + 1]^2 + 3 q[n + 1] + 2 q[n + 1] q[n] - 6 q[n] + q[n]^2, q[0] == 1}, q[n], n]


I get two complicated-looking complex solutions:

{{q[n] -> 1/4 I ((-2 + I) + 4 I^n - (2 + 5 I) I^(2 n) - (2 + 2 I) I^n Sqrt[5] + (2 + 2 I) I^(2 n) Sqrt[5])}, {q[n] -> -(1/4)I ((2 - I) - 4 I^n + (2 + 5 I) I^(2 n) - (2 + 2 I) I^n Sqrt[5] + (2 + 2 I) I^(2 n) Sqrt[5])}}


There should be just one solution for each $n$ that is between 0 and 1, and I'd like only to see those. How can I achieve that?

-

The RSolve result is bogus. You can simply plug into the recurrence relation to see that it's not satisfied. It's easy to roll your own, though. I guess the relationship between $q_1$ and $q_2$ can be expressed as

q2[q1_] = q2 /. Solve[q2^2 + 3 q2 + 2 q2*q1 - 6 q1 + q1^2 == 0, q2]
(* Out: {(-3 - 2 q1 - 3 Sqrt[1 + 4 q1])/2, (-3 - 2 q1 + 3 Sqrt[1 + 4 q1])/2} *)


We can examine the following plot to see that indeed, given a $q_1 \in [0,1]$, exactly one of these $q_2$s is also in $[0,1]$.

Plot[Evaluate[q2[q1]], {q1, 0, 1}]


In fact, if you're used to the color scheme, you can see that it's the second solution that is again in the unit interval. Thus, we can define q as

Clear[q];
q[0] = 1;
q[n_] := q[n] =  (-3 - 2 q[n - 1] + 3 Sqrt[1 + 4 q[n - 1]])/2;
Table[q[n], {n, 0, 2}]
N[Table[q[n], {n, 0, 8}]]


More generally, the recursive definition of q might involve a Select command, if you don't have such a simple way to chose which branch to follow.

-
Any idea what's wrong with RSolve? – Quinn Culver Aug 6 '14 at 16:59
@QuinnCulver Not definitively, but it hardly seems shocking, given the branch cuts that are bound to arise with a quadratic recurrence. – Mark McClure Aug 6 '14 at 17:04
What I want is an exact expression for $q(n)$. Any idea(s)? – Quinn Culver Aug 6 '14 at 17:10
@QuinnCulver I tried FindSequenceFunction without success but I really see no reason to think that such an expression exists. I can tell you that the sequence converges monotonically down to $3/4$ with approximate multiplier $1/2$ but not much more. – Mark McClure Aug 6 '14 at 17:17
@QuinnCulver Well, it oughtta get the whole damn thing correct, no? If you're going to use a black box, you'd better check your results and, in this case, they don't check out. – Mark McClure Aug 6 '14 at 17:20