灯下 登录
计算机科学 / SICP / 1.3.3 Procedures as General Methods

Exercise 1.36 · 习题

Exercise 1.36: Modify fixed-point so that
it prints the sequence of approximations it generates, using the newline
and display primitives shown in Exercise 1.22. Then find a
solution to x
x

=
1000 by finding a fixed point of x

log

(
1000
)

/

log

(

x

). (Use Scheme’s primitive log

procedure, which computes natural logarithms.) Compare the number of steps

this takes with and without average damping. (Note that you cannot start

fixed-point with a guess of 1, as this would cause division by

log

(

1

)

=

0.)

练习 1.36:修改 fixed-point,使其用练习 1.22 中给出的 newline 和 display 基本过程打印它所产生的近似值序列。然后,通过求 x ↦ log(1000)/log(x) 的不动点来找出 xˣ = 1000 的一个解。(使用 Scheme 的基本过程 log,它计算自然对数。)比较使用平均阻尼和不使用平均阻尼时所需步骤数的差异。(注意,不能以 1 作为 fixed-point 的初始猜测,因为这会导致除以 log(1) = 0。)