A generating function describes an infinite sequence of numbers (An) by treating them as the coefficients of a series expansion.For example, the generating function of sequence {0,1,2,3,4,5…n} is g(x)=0+x+2x^2+3x^3+4x^4+…+nx^n.
Applications
Condition:There are four weights weigh 1g, 2g, 3g, 4g.
Question:How many weight can you weigh?How many methods to combine each weight?
We use 1+x represents one 1g weights.The same applies to 2g, 3g, 4g weights.And we use
Expanding the formula, we can get a polynomial:
The power of each monomial represents the weight we can weigh and the coefficient represents the number of methods to each weight.In this case, we can weigh from 0g to 10g, as the power range from 0 to 10, and there are 2 methods to weigh 5g, as the coefficient of x^5 is 2.
Implements
|
|
Properties
Assume two sequences {Ak}, {Bk}, the corresponding generating function are A(x), B(x)
Property One:
A(x)=B(x) if and only if Ai=Bi, i=0,1,2,…
Note A(x)=ΣAix^i as sequence {Ak}’s generating function
Note B(x)=ΣBix^i as sequence {Bk}’s generating function
Property Two:
if A(x)+B(x) = C(X)
then Ci=Ai+Bi, i=0,1,2,…
Property Three:
if Bk=0 when k
then B(x) = x^lA(X)
Property Four:
if Bk = Ak+1
then B(x)=[A(x)-ΣAkX^k]/x^l, Σ:k=0~l-1
Property Five:
if Bk=ΣAi, Σ:i=0~k
then B(x)=A(x)/(1-x)
Property Six:
if ΣAk is convergent,Σ:k=0~∞
then B(x)=(A(1)-xA(x))/(1-x)
Property Seven:
if Bk=kAk
then B(x)=xA(x)
Property Eight:
if Bk=Ak/(1+k)
then B(x)=1/x (∫A(x)dx), ∫:0~x
Property Nine:
if Ck=ΣAiB(k-i), Σ:i=0~k
then C(x)=A(x)B(x)