時間序列︰生成函數《一》

莊子‧天下

惠施以此為大觀於天下而曉辯者,天下之辯者相與樂之。卵有毛,雞三足,郢有天下,犬可以為羊,馬有卵,丁子有尾,火不熱,山出口,輪不蹍地,目不見,指不至,至不絕,龜長於蛇,矩不方,規不可以為圓,鑿不圍枘,飛鳥之景未嘗動也,鏃矢之疾而有不行不止之時,狗非犬,黃馬、驪牛三,白狗黑,孤駒未嘗有母,一尺之捶,日取其半,萬世不竭。辯者以此與惠施相應,終身無窮。

一尺之捶,日取其半,萬世不竭說何事?果真

\frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \cdots \ = \ 1 耶??

 

 

此事由來太古早︰

Geometric series

In mathematics, a geometric series is a series with a constant ratio between successive terms. For example, the series

{\frac {1}{2}}\,+\,{\frac {1}{4}}\,+\,{\frac {1}{8}}\,+\,{\frac {1}{16}}\,+\,\cdots

is geometric, because each successive term can be obtained by multiplying the previous term by 1/2.

Geometric series are among the simplest examples of infinite series with finite sums, although not all of them have this property. Historically, geometric series played an important role in the early development of calculus, and they continue to be central in the study of convergence of series. Geometric series are used throughout mathematics, and they have important applications in physics, engineering, biology, economics, computer science, queueing theory, and finance.

 
Each of the purple squares has 1/4 of the area of the next larger square (1/2×1/2 = 1/4, 1/4×1/4 = 1/16, etc.). The sum of the areas of the purple squares is one third of the area of the large square.

 

故而難知其乃生成函數之重要關鍵︰

Ordinary generating functions

Polynomials are a special case of ordinary generating functions, corresponding to finite sequences, or equivalently sequences that vanish after a certain point. These are important in that many finite sequences can usefully be interpreted as generating functions, such as the Poincaré polynomial and others.

A key generating function is that of the constant sequence 1, 1, 1, 1, 1, 1, 1, 1, 1, …, whose ordinary generating function is

  \sum_{n=0}^{\infty}x^n = \frac{1}{1-x}.

The left-hand side is the Maclaurin series expansion of the right-hand side. Alternatively, the right-hand side expression can be justified by multiplying the power series on the left by 1 − x, and checking that the result is the constant power series 1, in other words that all coefficients except the one of x0 vanish. Moreover, there can be no other power series with this property. The left-hand side therefore designates the multiplicative inverse of 1 − x in the ring of power series.

Expressions for the ordinary generating function of other sequences are easily derived from this one. For instance, the substitution x → ax gives the generating function for the geometric sequence 1, a, a2, a3, … for any constant a:

  \sum_{n=0}^{\infty}(ax)^n= \frac{1}{1-ax}.

(The equality also follows directly from the fact that the left-hand side is the Maclaurin series expansion of the right-hand side.) In particular,

  \sum_{n=0}^{\infty}(-1)^nx^n= \frac{1}{1+x}.

One can also introduce regular “gaps” in the sequence by replacing x by some power of x, so for instance for the sequence 1, 0, 1, 0, 1, 0, 1, 0, …. one gets the generating function

  \sum_{n=0}^{\infty}x^{2n}=\frac{1}{1-x^2}.

By squaring the initial generating function, or by finding the derivative of both sides with respect to x and making a change of running variable n → n-1, one sees that the coefficients form the sequence 1, 2, 3, 4, 5, …, so one has

\sum_{n=0}^{\infty}(n+1)x^n= \frac{1}{(1-x)^2},

and the third power has as coefficients the triangular numbers 1, 3, 6, 10, 15, 21, … whose term n is the binomial coefficient  \tbinom{n+2}2, so that

\sum_{n=0}^{\infty}\binom{n+2}2 x^n= \frac{1}{(1-x)^3}.

More generally, for any non-negative integer k and non-zero real value a, it is true that

  \sum _{{n=0}}^{{\infty }}a^{n}{\binom {n+k}k}x^{n}={\frac {1}{(1-ax)^{{k+1}}}}\,.

Note that, since

  2\binom{n+2}2 - 3\binom{n+1}1 + \binom{n}0= 2\frac{(n+1)(n+2)}2 -3(n+1) + 1 = n^2,

one can find the ordinary generating function for the sequence 0, 1, 4, 9, 16, … of square numbers by linear combination of binomial-coefficient generating sequences;  G(n^2;x)=\sum_{n=0}^{\infty}n^2x^n=\frac{2}{(1-x)^3}-\frac{3}{(1-x)^2}+\frac{1}{1-x}=\frac{x(x+1)}{(1-x)^3}.

 

茲舉一例開宗明義,假使

    \[A = \sum_{n=0}^{\infty} a_n x^n\]

    \[S = \sum_{n=0}^{\infty} \left( \sum_{k=0}^{n} a_k \right) x^n\]

那麼

    \[S = A \cdot \frac{1}{1-x}\]

。所以欲求有限等比級數 1 + a + a^2 + \cdots + a^n 之和,可用 \frac{1}{1 - a x}  \cdot \frac{1}{1-x} 法為之。由於

\frac{1}{1 - a x}  \cdot \frac{1}{1-x} = \frac{1}{a-1} \left( \frac{a}{1 - a x} - \frac{1}{1-x} \right)

,故得 1 + a + a^2 + \cdots + a^n = \frac{1}{a - 1} \left( a \cdot a^n - 1 \right)  = \frac{a^n -1}{a -1}