# Guessing recursion in rational functions I want to know if there is a package in Mathematica that can give back some recursion given a list of polynomial in $f_{n}(h)$. For example I know there exists package RISC guess that where I give some list of rational numbers it can give me the recursion it satisfies. My list is as follows [1,0,-2,$-h^2+3$,$5h^2+1$,$-5h^2-11$,$-35h^2+15$,$-21h^4+140h^2+13$,$189h^4-84h^2-77$] I want a recursion of the from $$\sum_{k=0}^{N}a_{k}(h)[n]f(n+k) =0$$

where $a_{k}(h)[n]$ is a polynomial in $n$ over the rational field $Q(h)$.

An example done in Guess package is as follows [{1,1},{2,0},{3,-2}, {4,-h^2+3},{5,5*h^2+1},{5,5*h^2+1},{6,-5*h^2-11},{7,-35*h^2+15},{8,-21*h^4+140*h^2+13},{9,189*h^4-84*h^2-77},{10,-462*h^4-840*h^2+86},{11,-1848*h^4+2640*h^2+144},{12,-1485*h^6+15015*h^4-495*h^2-595},{13,19305*h^6-27027*h^4-16445*h^2+495},{14,-78507*h^6-102102*h^4+41041*h^2+1520},{15,-173745*h^6+636636*h^4+11375*h^2-4810},{16,-225225*h^8+2922920*h^6-816816*h^4-282100*h^2+2485},{17,3828825*h^8-9432280*h^6-4084080*h^4+559300*h^2+15675},{18,-22141548*h^8-15801500*h^6+19399380*h^4+474300*h^2-39560},{19,-15796638*h^8+218196836*h^6-15872220*h^4-4399260*h^2+6290},{20,-59520825*h^10+897498459*h^8-554268000*h^6-128741340*h^4+6807225*h^2+159105},{21,1249937325*h^10-4414328919*h^8-1127011600*h^6+476030940*h^4+11062275*h^2-324805},{22,-9445293585*h^10-903687785*h^8+10988363100*h^6-171609900*h^4-63677075*h^2-87075},{23,6418990305*h^10+101767530865*h^8-21565644100*h^6-3397876020*h^4+73363675*h^2+1592843}]

• It would be useful to have an example that can be cut and pasted. – Daniel Lichtblau Apr 17 '18 at 14:44
• I copy paste an example if it helps. It from RISC GUESS pacakge where they can do it for rational numbers but for me it's polynomials. – GGT Apr 17 '18 at 23:27
• I cannot cut and paste an image... – Daniel Lichtblau Apr 18 '18 at 13:47
• I see so which format is good for you ? I can send you a pdf file ? – GGT Apr 18 '18 at 23:39
• Just put plain ascii text, in Mathematica input form, into the actual question. So one "row" could be the Mathematica list {10,-462*h^4-840*h^2+86} for example. – Daniel Lichtblau Apr 19 '18 at 14:15

pollist = {{1, 1}, {2, 0}, {3, -2}, {4, -h^2 + 3}, {5, 5*h^2 + 1}, {5,
5*h^2 + 1}, {6, -5*h^2 - 11}, {7, -35*h^2 + 15}, {8, -21*h^4 +
140*h^2 + 13}, {9,
189*h^4 - 84*h^2 - 77}, {10, -462*h^4 - 840*h^2 +
86}, {11, -1848*h^4 + 2640*h^2 + 144}, {12, -1485*h^6 +
15015*h^4 - 495*h^2 - 595}, {13,
19305*h^6 - 27027*h^4 - 16445*h^2 + 495}, {14, -78507*h^6 -
102102*h^4 + 41041*h^2 + 1520}, {15, -173745*h^6 + 636636*h^4 +
11375*h^2 - 4810}, {16, -225225*h^8 + 2922920*h^6 - 816816*h^4 -
282100*h^2 + 2485}, {17,
3828825*h^8 - 9432280*h^6 - 4084080*h^4 + 559300*h^2 +
15675}, {18, -22141548*h^8 - 15801500*h^6 + 19399380*h^4 +
474300*h^2 - 39560}, {19, -15796638*h^8 + 218196836*h^6 -
15872220*h^4 - 4399260*h^2 + 6290}, {20, -59520825*h^10 +
897498459*h^8 - 554268000*h^6 - 128741340*h^4 + 6807225*h^2 +
159105}, {21,
1249937325*h^10 - 4414328919*h^8 - 1127011600*h^6 +
476030940*h^4 + 11062275*h^2 - 324805}, {22, -9445293585*h^10 -
903687785*h^8 + 10988363100*h^6 - 171609900*h^4 - 63677075*h^2 -
87075}, {23,
6418990305*h^10 + 101767530865*h^8 - 21565644100*h^6 -
3397876020*h^4 + 73363675*h^2 + 1592843}}[[All, 2]];


coef0[n_] = FindSequenceFunction[Coefficient[#, h, 0] & /@ pollist, n]


gives

DifferenceRoot[{[FormalY],[FormalN]}[Function]{([FormalN]+4) (2936 [FormalN]^2-13255 [FormalN]+13103) [FormalY]([FormalN]+3)+(11818 [FormalN]^3-39180 [FormalN]^2+12312 [FormalN]+47530) [FormalY]([FormalN]+1)+(4441 [FormalN]^3-7769 [FormalN]^2-21002 [FormalN]+47530) [FormalY]([FormalN]+2)-5 ([FormalN]-5) [FormalN] (1431 [FormalN]-1199) [FormalY]([FormalN])==0,[FormalY](1)==1,[FormalY](2)==0,[FormalY](3)==-2}][n]

Check:

Table[coef0[k], {k, 1, 24}]


{1,0,-2,3,1,1,-11,15,13,-77,86,144,-595,495,1520,-4810,2485,15675,-39560,6290,159105,-324805,-87075,1592843}

For the coefficients at $h^2$

coef2[n_] = FindSequenceFunction[Coefficient[#, h, 2] & /@ pollist, n]


DifferenceRoot[{[FormalY],[FormalN]}[Function]{(550 [FormalN]^3-2640 [FormalN]^2+1220 [FormalN]+1110) [FormalY]([FormalN]+1)+(237 [FormalN]^3-1527 [FormalN]^2+2442 [FormalN]-672) [FormalY]([FormalN]+2)+25 ([FormalN]-5) [FormalN] (17 [FormalN]-5) [FormalY]([FormalN])+([FormalN]-2) ([FormalN]-1) (76 [FormalN]-297) [FormalY]([FormalN]+3)==0,[FormalY](1)==0,[FormalY](2)==0,[FormalY](3)==0,[FormalY](4)==-1,[FormalY](5)==5}][n]

etc.

BTW recurrences becomes simpler if to begin from the third line:

coef0[n_] = FindSequenceFunction[Coefficient[#, h, 0] & /@ pollist[[3 ;;]], n]


DifferenceRoot[{[FormalY],[FormalN]}[Function]{(5 [FormalN]+10) [FormalY]([FormalN])+(2 [FormalN]+7) [FormalY]([FormalN]+1)+([FormalN]+5) [FormalY]([FormalN]+2)==0,[FormalY](1)==-2,[FormalY](2)==3,[FormalY](3)==1,[FormalY](4)==1,[FormalY](5)==-11}][n]

• Thanks for that. As I understand you gave the recursion for the constant term of the polynomials. What is Formal[Y], Formal[N] denotes? Is it possible to give a recursion for a bivariate table? The entry of the table would be $(d,coeff[f_d,h,2g])$. $f_d$ denote the $d-th$ polynomial in the list. – GGT Apr 21 '18 at 0:01
• Yes, for the coefficients of $h^2$ too, changed the answer. As for Formal[Y] , Formal[N] it's mathematica's symbols introduced to not use y, n because those variables can be defined already. – Andrew Apr 21 '18 at 5:29
• you mean you have a different recursion for coefficients of $h^2$ ? – GGT Apr 21 '18 at 7:18
• To make sure the above recursion for the constant coefficient read as follows $(5n+10)*y(n)+(2n+7)*y(n+1)+(2n+5)*y(n+2)=0$. – GGT Apr 21 '18 at 7:34
• @GGT yes, for different coefficients recursions are different. – Andrew Apr 21 '18 at 7:44