# Recurrences of lists

Assume we have a multi-dimensional recurrence, e.g.

\qquad\begin{align*} a_1 &= (1,2) \\ a_n &= (1,2) + a_{n-1} \quad, n>1 \end{align*}

with the easy solution $a_n = (n,2n)$.

How can I solve such recurrences in Mathematica? The expression

RSolve[{a[1] == {1, 2}, a[n] == {1, 2} + a[n - 1]}, a[n], n]


evaluates to

{}


in Mathematica 9.0.0.0. Naturally,

RSolve[{
a1[1] == 1, a1[n] == 1 + a1[n - 1],
a2[1] == 2, a2[n] == 2 + a2[n - 1]
}, {a1[n], a2[n]}, n]


works, but this strikes me as inconvenient. Given that the translation is this immediate (provided all occurring lists have the same length) I suspect there might be a way to do it without boilerplate.

-
For this particular example: RSolve[{a[1] == #, a[n] == # + a[n - 1]}, a[n], n] & /@ {1, 2}. –  Pickett Jul 30 '13 at 13:15
@Anon Okay, replacing afterwards in the symbolic result, nice. What are the restrictions of this? –  Raphael Jul 30 '13 at 13:25
If the relations cannot be solved separately it won't work. This is equivalent to using RSolve two times, one for each index. –  Pickett Jul 30 '13 at 13:49
Because the dimensions may have some inter-dependence, I suspect something like With[{rule=a[n_]:>{a[1][n], a[2][n]}},RSolve[Thread/@({a[1] == {1, 2}, a[n] == {1, 2} + a[n - 1]}/.rule),a[n]/.rule, n]] could be used, but unfortunately I don't have Mathematica available right now so I can't test it. –  VF1 Jul 31 '13 at 4:17
@VF1 I don't understand your code but I tried it; the result is also {}. –  Raphael Jul 31 '13 at 12:58

SetAttributes[split, HoldAll];
split[var_, eqs_, dim_] :=

split should work for Solve-ing vector-valued functions, too.
@Raphael Yes. I had to inject into the Hold and then release it because the problem with the code I posted as a comment was that the Plus was distributing the a[n] term before the replacement, resulting in a matrix when I split it. –  VF1 Aug 2 '13 at 16:37