Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the generating function automatically in mathematica

In the appendix of the book http://www.math.upenn.edu/~wilf/DownldGF.html, page 194, the author mentioned that in Mma 2.0 (very old. :P), there is the function which can get the generating functions directly from recurrence relationship, like the example given therein:

GeneratingFunction[{f[n+2]==f[n+1]+f[n], f[0]==0, f[1]==1},f[n],n,x]

But the same function does not seem to do the kind of job anymore in mma 7.0/8.0. Does anyone know how to get the equivalent function? many thanks.

like image 538
Qiang Li Avatar asked May 09 '26 19:05

Qiang Li


1 Answers

The GeneratingFunction scope has changed. Here you may find the obsolete legacy documentation (by the middle of the document).

Now you can do the same, but in two steps. First solve the recurrence relation with RSolve and the find the Generating Function. Like this:

GeneratingFunction[
 RSolve[{f[n + 2] == f[n + 1] + f[n], f[0] == 0, f[1] == 1}, f[n], n], 
n, x]  

Out

{{GeneratingFunction[f[n], n, x] -> -(x/(-1 + x + x^2))}}
like image 78
Dr. belisarius Avatar answered May 11 '26 15:05

Dr. belisarius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!