练习1.35-练习1-38

1.练习1.35

(fixed-point (lambda (x) (+ 1 (/ 1 x))) 1.0)

2.练习1.36

不用平均阻尼方式:

(fixed-point-display (lambda (x) (/ (log 1000) (log x))) 2.0)

结果为:

2.
9.965784284662087
3.004472209841214
6.279195757507157
3.759850702401539
5.215843784925895
4.182207192401397
4.8277650983445906
4.387593384662677
4.671250085763899
4.481403616895052
4.6053657460929
4.5230849678718865
4.577114682047341
4.541382480151454
4.564903245230833
4.549372679303342
4.559606491913287
4.552853875788271
4.557305529748263
4.554369064436181
4.556305311532999
4.555028263573554
4.555870396702851
4.555315001192079
4.5556812635433275
4.555439715736846
4.555599009998291
4.555493957531389
4.555563237292884
4.555517548417651
4.555547679306398
4.555527808516254
4.555540912917957
;Value: 4.555532270803653

平均阻尼的方法:

(fixed-point-display (lambda (x) (/ (+ (/ (log 1000) (log x)) x) 2.0)) 2.0)

结果是:

2.
5.9828921423310435
4.922168721308343
4.628224318195455
4.568346513136242
4.5577305909237005
4.555909809045131
4.555599411610624
4.5555465521473675
;Value: 4.555537551999825

3.练习1.37

a)

(define (cont-frac n d k)
  (define (cont-prac-recur n d a k)
    (if (= a k)
	(/ (n k) (d k))
	(/ (n a) (+ (d a) (cont-prac-recur n d (+ a 1) k)))))
  (cont-prac-recur n d 1 k))

k为11时得到的近似值具有十进制的4位精度

b)

迭代计算过程:

(define (cont-frac n d k)
  (define (cont-prac-iter a result)
    (cond ((= a k) (cont-prac-iter (- a 1) (/ (n k) (d k))))
	  ((= a 0) result)
	  (else (cont-prac-iter (- a 1) (/ (n a) (+ result (d a)))))))
  (cont-prac-iter k 0))

4.练习1.38

(define (dfc-k k)
  (+ (cont-frac (lambda (i) 1.0)
		(lambda (i) (if (= (remainder i 3) 2)
				(* (+ (floor (/ i 3)) 1) 2)
				1))
		k
		) 2))
5.练习1.39

(define (tan-cf x k)
  (cont-frac (lambda (i) (if (= i 1)
			     x
			     (- 0 (square x))))
	     (lambda (i) (+ (* (- i 1) 2) 1))
	     k
	     ))



发布了179 篇原创文章 · 获赞 1 · 访问量 13万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览