【具体数学--读书笔记】1.1 The Power of Hanoi
這一節(jié)借助漢諾塔問題引入了"Reccurent Problems"。
(Reccurence, 在這里解釋為“the solution to each problem depends on the solutions to smaller instances of the same problem”. 即由相同的規(guī)模更小的問題的到原問題的解)
Hanoi問題描述:
"given a tower of eight disks, initially stacked in decreasing size on peg A.
Our task: transfer the entire tower to tower C, moving only one disk at a time and never mobing a larger one onto a smaller.
Question: How many moves are necessary and sufficient to perform the task?"
?
作者按照如下步驟分析求出n層漢諾塔的最少移動次數(shù)的通項公式:
1. generalize:最初是法國數(shù)學家Edouard Lucas提出的8層漢諾塔玩具,后來Lucas又創(chuàng)造了一個64層漢諾塔的故事。這里我們把漢諾塔的層數(shù)泛化為n
2. introduce appropriate notation, name and conquer:引入記號Tn表示n層的漢諾塔問題的最少移動次數(shù)
3. look at small cases:易知T1=1, T2=3, T3 = 7
4. find and prove a reccurence relation:找到并證明遞推關(guān)系
(1) find a sufficient solution: 找到一個充分(可行)的解;
具體地,將求解small cases的方法推廣,把除最底層以外的前n-1層看成一個整體,得到一個可行的方案Tn-1 + 1 + Tn-1,由此可得Tn <= 2*Tn-1 + 1
(2) prove it necessary: 證明它的必要性;
具體地,分析移動過程,移動最底層盤子之前,至少已花費Tn-1步將前n-1層移至輔助樁;最底層盤子就位后,同樣至少要花費Tn-1將前n-1層從輔助樁移到目標樁,由此可得Tn >= 2*Tn-1 + 1
(3) yeild recurrence relation:v由(1)(2)得到等式,加上對平凡(trivial)情況的約定,構(gòu)成如下遞推關(guān)系
T0 = 0
Tn = 2*Tn-1 + 1
注:遞推關(guān)系給出的是"indirect, local information",已知局部的一個值可以方便地求出鄰近的值,好比鏈表
5. find and prove a closed form expression: 找到并證明通項式
(1) 方法一:列出small cases觀察 -> 猜一個式子 -> 用數(shù)學歸納法(mathematical induction)驗證
(2) 方法二:直接從遞推式推導:
1) add 1 to both sides of the equations:把右側(cè)化成和左側(cè)類似的形式
T0 + 1= 1
Tn + 1= 2*Tn-1 + 2 = 2*(Tn-1 + 1)
2) let Un = Tn + 1, we have 引入另一個記號,換元
U0 = 1
Un = 2*Un
由此構(gòu)造出等比數(shù)列Un, 首項為1,公比為2,所以通項Un = U0*2^n = 2^n
3) 帶回T, 得到通項公式Tn = Un - 1 = 2^n - 1
?
作者說這本書主要關(guān)注討論的就是類似第5步方法二的方法,通過推導,而不是“猜測+驗證”的方式來由遞推式得到通項式
"to explain how a person can solve recurrences without being clairvoyant."
總結(jié)
以上是生活随笔為你收集整理的【具体数学--读书笔记】1.1 The Power of Hanoi的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ps 和 kill 结合使用
- 下一篇: jQuery的$(document).r