This question was inspired by Vladimir Reshetnikov's question (How to find a recurrence relation for a sequence?):
Given a finite sequence of numbers, how can we find in MMA a recurrence relation obeyed by this sequence? To be more specific, assume that the numbers are rationals and the recurrence relation is of a simple type, say linear.
This problem is similar to FindFit for the function "behind" the sequence but now we are interested in a recurrence relation of a given form containing some Parameters.
Also there is a similarity to DifferenceRootReduce where MMA tries to find the recurrence relation for a given formula for the elements of a sequence. Now the formula is replaced by the numerical sequence. As an Option we would specify a class of recurrence relation, e.g. linear.
Let's consider the example of Vladimir, and take this sequnce
seq = Table[{n, -2^-n (2^(1 + n) LerchPhi[2, 2, 1 + n] - PolyLog[2, 2])}, {n, 1, 20}] // Simplify
$\left\{\{1,1\},\left\{2,\frac{3}{4}\right\},\left\{3,\frac{35}{72}\right\},\left\{4,\frac{11}{36}\right\},\left\{5,\frac{347}{1800}\right\},\left\{6,\frac{149}{1200}\right\},\left\{7,\frac{9701}{117600}\right\},\left\{8,\frac{209}{3675}\right\},\left\{9,\frac{8093}{198450}\right\},\left\{10,\frac{6031}{198450}\right\},\left\{11,\frac{1126651}{48024900}\right\},\left\{12,\frac{3587327}{192099600}\right\},\left\{13,\frac{990457463}{64929664800}\right\},\left\{14,\frac{1653005063}{129859329600}\right\},\left\{15,\frac{561462043}{51943731840}\right\},\left\{16,\frac{3778408}{405810405}\right\},\left\{17,\frac{951790361}{117279207045}\right\},\left\{18,\frac{1117157389}{156372276060}\right\},\left\{19,\frac{716038369549}{112900783315320}\right\},\left\{20,\frac{1600677857657}{282251958288300}\right\}\right\}$
Now let make an "educated guess" and assume a recurrence relation of the form
$f(n) = a f(n-1) + \frac{b}{n^2}$
How do we determine the two parameters $a$ and $b$? (In this example the solution is well known: $a = \frac{1}{2}$, $b=1$)
I tried to first RSolve the recurrence relation and then use FindFit to determine the parameters. It didn't work, too many error message and no result. Can you do better?
Solve[{3/4 == a 1 + b/(2^2), 35/72 == a 3/4 + b/3^2 }, {a, b}] => {{a -> 1/2, b -> 1}}
$\endgroup$