3
$\begingroup$

I am trying to automatically find a generating function from the coefficients of a simple rational function using Mathematica's FindGeneratingFunction:

f[x_] := (x + 2 x^2 + x^3 + 2 x^4 + x^5)/(1 - 2 x + 2 x^3 - x^4)
coefs = Table[SeriesCoefficient[f[x], {x, 0, n}], {n, 0, 4}]
FindGeneratingFunction[coefs, x, FunctionSpace -> "Rational", TimeConstraint -> 999999]

However, even after specifying the right FunctionSpace and increasing the TimeConstraint, Mathematica immediately gives up on finding a solution. Does anyone know how I can make Mathematica search harder for a solution?

Also, if I restrict the list to the first 4 elements, it does find a generating function, but only if I remove both the FunctionSpace and TimeConstraint parameters. Why?

$\endgroup$

closed as off-topic by Bob Hanlon, MarcoB, Coolwater, Alex Trounev, Öskå Feb 10 at 21:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, Coolwater, Alex Trounev, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ You need at least 12 series coefficient, a[0] to a[11], in order to uniquely determine the rational generating function. $\endgroup$ – Somos Feb 4 at 3:05
5
$\begingroup$
f[x_] := (x + 2 x^2 + x^3 + 2 x^4 + x^5)/(1 - 2 x + 2 x^3 - x^4)

coefs = Table[SeriesCoefficient[f[x], {x, 0, n}], {n, 0, 11}];

The option FunctionSpace should be specified as "RationalFunction" rather than "Rational". And as pointed out in the comment by Samos, you need more coefficients.

g[x_] = FindGeneratingFunction[coefs, x, 
   FunctionSpace -> "RationalFunction"] // Simplify

(* -((x (1 + 2 x + x^2 + 2 x^3 + x^4))/((-1 + x)^3 (1 + x))) *)

Verifying equivalence,

f[x] == g[x] // Simplify

(* True *)

Or use the default for FunctionSpace

FindGeneratingFunction[coefs, x] == f[x] // Simplify

(* True *)
$\endgroup$

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