Exercise 2.9
The width of an interval is half of the difference between its upper and lower bounds. The width is a measure of the uncertainty of the number specified by the interval. For some arithmetic operations the width of the result of combining two intervals is a function only of the widths of the argument intervals, whereas for others the width of the combination is not a function of the widths of the argument intervals. Show that the width of the sum (or difference) of two intervals is a function only of the widths of the intervals being added (or subtracted). Give examples to show that this is not true for multiplication or division.
这道题目没有任何难度,只要把原来的区间宽度和经过加减之后的区间宽度表示出来,它们的关系也就一目了然了。
; 计算区间的宽度
(define (get-width x)
(/ (- (upper-bound x) (lower-bound x)) 2))
(define r1 (make-interval 6.12 7.48))
(define r2 (make-interval 4.465 4.935))
(display (get-width r1))
(newline)
(display (get-width r2))
(newline)
(display (get-width (add-interval r1 r2)))
(newline)
(display (get-width (sub-interval r1 r2)))
(newline)
; 执行结果
0.6800000000000002
0.23499999999999988
0.9149999999999991
0.915
标签:newline,r2,get,每日,interval,sicp,width,2.9,intervals From: https://www.cnblogs.com/think2times/p/18413525根据执行结果可以看出,加减之后的区间宽度等于原来两个区间宽度之和。