1
$\begingroup$

Consider the following system of simultaneous recursions:

    r[n] == s[n-1]
    s[n-2] == r[n-3]

I am tring to solve this system (I have given a vastly simplified version of what I am actually working on which however has the same issues). Intuitively we expect the solution

     r[n] == r[n-2]

So if initial values are say r[0]=a, r[1]=b, then the above system generates the well defined solution sequence

    a,b,a,b,a,b,a,b

One can think of r,s as either functions or series. For a variety of reasons the system fed to the code cannot be simplified (but come with different indices as shown).

Several different approaches in mathematica yielded different problems. For example the code

    RecurrenceTable[{r[n] == s[n - 1], s[n - 2] == r[n - 3], 
    r[0] == a,r[1]=b}, r, {n, 0, 10}]

gives the following error message: RecurrenceTable::overdet: There are fewer dependent variables than equations, so the system is overdetermined.

Similarly using RSolve with the following code

     RSolve[{r[m] - s[m - 1] == 0, s[m - 2] - r[m - 3] == 0, r[0] == a, 
     r[1] == b}, r[n], n]

gives an error: Supplied equations are not difference equations of the given functions.

I also experimented with function substituions but received errors of exceeding the recursion capacity.

I am indifferent to initial conditions (and hence I used r[0]==a and r[1]==b to avoid "lack of initial values")

Any work arounds would be appreciated.

$\endgroup$

1 Answer 1

5
$\begingroup$
  • We set two functions {r, s} and change the initial condition to be r[0] == a, s[0] == b}
Clear[list]; 
list = 
 RecurrenceTable[{r[n] == s[n - 1], s[n - 2] == r[n - 3], r[0] == a, 
   s[0] == b}, {r, s}, {n, 0, 10}]
list[[;; , 1]]

{a, b, a, b, a, b, a, b, a, b, a}

  • RSolve.
RSolve[{r[n] == s[n - 1], s[n - 2] == r[n - 3], r[0] == a, 
  s[0] == b}, {r[n], s[n]}, {n}]
r[n] /. sol[[1]]

1/2 (a + (-1)^n a + b - (-1)^n b).

$\endgroup$
1
  • $\begingroup$ Thanx. One solution gives me the LIST; the 2nd solution gives me the CLOSED formula. I also need a solution that will give me the RECURSION (in this case r[n]=r[n-2]. Is that possible $\endgroup$ Sep 4, 2023 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.