这道题需要一些数学知识,题目中已经提示:
[quote]Show that if we apply such a transformation Tpq twice, the effect is the same as using a single transformation Tp'q' of the same form, and compute p' and q' in terms of p and q[/quote]
应用两次Tpq相当于一次Tp'q',所以可以通过这样的方式进行推导:
Tpq = bq+aq+ap, bp+aq
将a<-bq+aq+ap,b<-bp+aq代入上面对式子中,得
Tp'q'=(bp+aq)q+(bq+aq+ap)q+(bq+aq+ap)p, (bp+aq)p+(bq+aq+ap)q
展开后提出a和b,可得
q'= 2pq+qq
p'= qq+pp
代入后试验结果确实如此。
[quote]Show that if we apply such a transformation Tpq twice, the effect is the same as using a single transformation Tp'q' of the same form, and compute p' and q' in terms of p and q[/quote]
应用两次Tpq相当于一次Tp'q',所以可以通过这样的方式进行推导:
Tpq = bq+aq+ap, bp+aq
将a<-bq+aq+ap,b<-bp+aq代入上面对式子中,得
Tp'q'=(bp+aq)q+(bq+aq+ap)q+(bq+aq+ap)p, (bp+aq)p+(bq+aq+ap)q
展开后提出a和b,可得
q'= 2pq+qq
p'= qq+pp
代入后试验结果确实如此。
(define (fib n)
(fib-iter 1 0 0 1 n))
(define (fib-iter a b p q count)
(cond ((= count 0) b)
((even? count)
(fib-iter a
b
(+ (* p p) (* q q))
(+ (* 2 (* p q)) (* q q))
(/ count 2)))
(else (fib-iter (+ (* b q) (* a q) (* a p))
(+ (* b p) (* a q))
p
q
(- count 1)))))
本文通过数学推导展示了如何通过两次应用Tpq变换等效于一次Tp'q'变换,并给出了p'和q'关于p和q的具体计算公式。同时,提供了一段伪代码示例,用于解释这一数学原理在迭代过程中的应用。
4634

被折叠的 条评论
为什么被折叠?



