# RSolve works slow and does not give an analytical solution for solving high order linear difference equations

RSolve@@{{a[n]-a[n-10]==101}~Join~Table[a[i+1]==101+10i,{i,0,9}],a[n],n}


I want to get the exact form of general formulas, but RSolve only gives a DifferenceRoot object. I tried FunctionExpand but it does not work.

-
You can get the generic solution easily with the substitution a[n]->101 Log[b[n]]. The difficult bit seems to be matching your initial condition, though a numerical solution is found quickly. – b.gatessucks May 19 '14 at 8:52

RSolve[a[n] - a[n - 10] == 101, a[n], n] // AbsoluteTiming


also given a DifferenceRoot object, consider a[n-1]-a[n-11]==101, so a[n]-a[n-10]==a[n-1]-a[n-11]

RSolve[a[n] - a[n - 10] == a[n - 1] - a[n - 11], a[n], n]


worked fast. So we can using method of undetermined coefficients

Clear["*"];
expr = Collect[RSolve[a[n] - a[n - 10] == a[n - 1] - a[n - 11], a[n], n][[1, 1, 2]],
_C, ExpToTrig@FullSimplify@ComplexExpand@# &];
list = Table[101 + 10 i, {i, 0, 9}]~Join~{202};
eq = list == Table[expr, {n, 11}];
{res} = expr /. RootReduce@Solve[eq, Array[C, 11], Method -> Rational] // Simplify
(*Table[res,{n,90}]//RootReduce*)


Output: $\left\{\frac{1}{100} \left(1010 n+10 \sqrt{5+2 \sqrt{5}} \sin \left(\frac{\pi n}{5}\right)+2 \sqrt{5 \left(5+2 \sqrt{5}\right)} \sin \left(\frac{2 \pi n}{5}\right)+10 \sqrt{5-2 \sqrt{5}} \sin \left(\frac{3 \pi n}{5}\right)+2 \sqrt{5 \left(5-2 \sqrt{5}\right)} \sin \left(\frac{4 \pi n}{5}\right)-5 i \sin (\pi n)-10 \cos \left(\frac{\pi n}{5}\right)-10 \cos \left(\frac{2 \pi n}{5}\right)-10 \cos \left(\frac{3 \pi n}{5}\right)-10 \cos \left(\frac{4 \pi n}{5}\right)-5 \cos (\pi n)+9045\right)\right\}$

${101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, \ 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, \ 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, \ 515, 525, 535, 545, 555, 565, 575, 585, 595, 606, 616, 626, 636, 646, \ 656, 666, 676, 686, 696, 707, 717, 727, 737, 747, 757, 767, 777, 787, \ 797, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 909, 919, 929, \ 939, 949, 959, 969, 979, 989, 999}$

By the way, I found Maple solve this equation very quickly.

rsolve({a(n)-a(n-10)=101, seq(a(i+1)=101+10*i, i=0..9)}, a)`

-