内容 1.1 The Elements of Programming · 18
练习 自检推理
Exercise 1.8: Newton’s method for cube roots is
based on the fact that if y is an approximation to the cube root of x,
then a better approximation is given by the value
x
/
y
2
+
2
y
3
.
Use this formula to implement a cube-root procedure analogous to the
square-root procedure. (In 1.3.4 we will see how to implement
Newton’s method in general as an abstraction of these square-root and cube-root
procedures.)
练习 1.8:牛顿法求立方根基于如下事实:若 y 是 x 的立方根的近似值,则更好的近似值由
(x/y² + 2y) / 3
给出。利用这个公式,实现一个类似于平方根过程的立方根过程。(在 1.3.4 节中,我们将看到如何将牛顿法作为这些平方根和立方根过程的抽象,以通用的方式实现。)
我的笔记 自动保存