# Software for recognizing algebraic or D-finite formal power series

I have a formal power series in one variable that I think might be algebraic (or perhaps just D-finite). Is there software that could help me explore this?

By way of comparison, there’s a very simple way to see if a formal power series appears to be rational: for small values of $$n$$, compute the determinant of the $$(n+1)$$-by-$$(n+1)$$ Hankel matrix whose entries are the first $$2n+1$$ coefficients of the formal power series. If the determinant is 0, then nontrivial elements of the nullspace correspond to possible $$n$$th order recurrence relations.

(I’m including the combinatorics tag since this sort of pattern-finding is sometimes an important early step in a combinatorial research project.)

• I have written a Maple library that takes a sequence and tries to conjecture an algebraic, D-finite, or D-algebraic expression for it. It's not quite polished enough for a public release yet, but I would be happy to run it on your series for you. May 19 at 21:20
• Thanks for the offer, Jay! The sequences I’m curious about are 18, 142, 1266, 12030, 118650, 1198230, 12296202, 127633590, 1336133730, 14079114270, 149124688482, 1586159072814, 16929780310218, 181227223899942, 1944808008842490, 20915277691567206, ... and 84, 724, 6516, 60900, 586404, 5777916, 57952212, 589381020, 6060195316, 62863155972, 656765033268, 6902094928308, 72892778268996, 773013952508268, 8226672021670804,... May 19 at 23:58
• I wasn't able to make any guesses, but that is not uncommon with this few terms. Any chance you have more? May 20 at 1:17
• The listtorec function in the gfun package in Maple tries to find a P-recursion for a sequence and listtodiffeq tries to find a differential equation. They do not succeed in your examples. See de.maplesoft.com/support/help/Maple/view.aspx?path=gfun. May 20 at 2:26
• Could you include the algorithm that generated the sequences? It might be relevant May 22 at 17:17

## 1 Answer

Fricas is good at that. It can be accessed via sage, once installed.

sage: L=[catalan_number(i) for i in range(20)]
sage: fricas.guessHolo(L)
[
n           2      ,
[[x ]f(x): (4 x  - x)f (x) + (2 x - 1)f(x) + 1 = 0,

2      3      4
f(x) = 1 + x + 2 x  + 5 x  + O(x )]
]
sage:


and also

sage: fricas.guessAlg(L)
n             2                                   2      3      4
[[[x ]f(x): x f(x)  - f(x) + 1 = 0, f(x) = 1 + x + 2 x  + 5 x  + O(x )]]

• If I'm doing it right, doesn't know that. May 22 at 14:33
• (The previous comment was very terse because the links were very long. 😁) May 22 at 14:36
• Sagecell does not have fricas. You need to do "sage -i fricas" in your own installation of sagemath. May 22 at 16:59
• There is a sandbox for fricas, but it seems it cannot handle these sequences. May 22 at 17:15
• Once you have sage installed, sage -i fricas installs fricas. May 23 at 14:21