【SICP练习】134 练习3.65

来源:互联网 发布:男生知乎 编辑:程序博客网 时间:2024/06/05 20:10

练习3-65

原文

Exercise 3.65. Use the series
ln2 = 1- 1/2 + 1/3 - 1/4 + ……
to compute three sequences of approximations to the natural logarithm of 2, in the same way we did above for . How rapidly do these sequences converge?

代码

(define (ln2-summands n)        (cons-stream (/ 1.0 n)                      (stream-map - (ln2-summands (+ n 1)))))(define ln2-stream        (partial-sums (ln2-summands 1)))



感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。


为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp


5 0
原创粉丝点击