6
$\begingroup$

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]

but the answer was

(* 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.

$\endgroup$
1
  • $\begingroup$ Yes, but the function ExponentialGeneratingFunction does not compute the exponential generating function from a set of initial terms. $\endgroup$ May 20, 2015 at 11:35

1 Answer 1

10
$\begingroup$

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

findExponentialGeneratingFunction = 
    FindGeneratingFunction[#1/(Factorial /@ Range[0, Length@#1 - 1]), #2] &

findExponentialGeneratingFunction[{1,1,1,1,1,1,1,1},x] (* Exp[x] *)
$\endgroup$
7
  • $\begingroup$ 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. $\endgroup$
    – Mr.Wizard
    May 20, 2015 at 10:56
  • 1
    $\begingroup$ Indeed, FindGeneratingFunction needs a sequence of nine 1s to return 1/(1-x). It's just as much as Mathematica can do. $\endgroup$
    – LLlAMnYP
    May 20, 2015 at 10:59
  • 2
    $\begingroup$ By the way Factorial is listable: Range[0, Length@foo - 1] ! -- or Array[Factorial, Length@foo, 0] $\endgroup$
    – Mr.Wizard
    May 20, 2015 at 11:01
  • $\begingroup$ @Mr.Wizard findExponentialGeneratingFunction[{1, 2, 5, 16, 65, 326},x] returns the correct result. Sometimes you want less terms, it seems. $\endgroup$
    – LLlAMnYP
    May 20, 2015 at 11:11
  • $\begingroup$ Thanks a lot to you all for your answers and comments. In fact, I had tried FindGeneratingFunction with the terms divided by the corresponding factorials, but it did not work. Apparently, it needed more terms. That was the reason for my second question. As for the function "findExponentialGeneratingFunction", where is it? I can't find it. Please excuse my ignorance :-) $\endgroup$ May 20, 2015 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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