# Find exponential generating function from the first few terms

The function FindGeneratingFunction computes the ordinary generating function of a sequence, given a sufficient number of initial terms. I have two questions in that respect:

1. Is there a way to compute the exponential generating function of the sequence, given a sufficient number of initial terms?

2. How many terms do we need? (This second question might be more about mathematics than about Mathematica, sorry. In the case of ordinary generating functions I know the answer, but not for exponential generating functions).

Regarding my second question, I will now post my reasoning, and I will ask you to check it. I argue that the number of initial terms that we need to get the exponential generating functions should be the same as the number of terms that are necessary for the ordinary generating function. The point is that, after you have the ordinary generating function, you can get as many terms of the sequence as you want. Therefore, all the information that is needed for the exponential generating function is already there.

To compute the exponential generating function, I divided the terms by the factorials, and tried to compute the ordinary generating function of the new sequence, but it did not work. First I typed

FindGeneratingFunction[{6, 0, 10, 0, 30, 0, 106, 0, 390, 0, 1450, 0, 5406}, z]


which resulted in

(* -((2 (3 + 5 z^2 (-2 + z^2)))/(-1 + 5 z^2 - 5 z^4 + z^6)) *)


I checked that result, and it was correct. Obviously, the number of terms was sufficient to compute the ordinary generating function, and indeed it was, since the number of terms that are needed is equal to the degree of the denominator plus the degree of the numerator plus one. Then I tried

FindGeneratingFunction[{6, 0, 5, 0, 30/24, 0, 106/720, 0, 390/40320,
0, 1450/3628800, 0, 5406/479001600}, z]


(* FindGeneratingFunction[{6, 0, 5, 0, 5/4, 0, 53/360, 0, 13/1344, 0, 29/
72576, 0, 901/79833600}, z] *)


i.e. Mathematica could not obtain the exponential generating function. Could you please find where the problem is?

Thank you very much, once again.

• Yes, but the function ExponentialGeneratingFunction does not compute the exponential generating function from a set of initial terms. May 20 '15 at 11:35

It seems, that findExponentialGeneratingFunction would be equivalent to FindGeneratingFunction of the sequence {a1/0!,a2/1!,a3/2!,...}. Therefore
findExponentialGeneratingFunction =

• I confirm this works in a number of cases. One that is less than ideal is {1,2,5,16,65,326,1957,13700,109601} which should be E^x/(1 - x) but gives something far more complex. That's not your doing of course but perhaps it could be improved nevertheless. May 20 '15 at 10:56
• Indeed, FindGeneratingFunction needs a sequence of nine 1s to return 1/(1-x). It's just as much as Mathematica can do. May 20 '15 at 10:59
• By the way Factorial is listable: Range[0, Length@foo - 1] ! -- or Array[Factorial, Length@foo, 0] May 20 '15 at 11:01
• @Mr.Wizard findExponentialGeneratingFunction[{1, 2, 5, 16, 65, 326},x] returns the correct result. Sometimes you want less terms, it seems. May 20 '15 at 11:11