2 (:use [sicp utils ch2_1_extended ex2_7]
5 ;; let us say, width of an interval [x,y] = d = (y-x)/2.
6 ;; add_interval [x,y] = [l1+l2, u1+u2]
7 ;; width of sum = (u1+u2 - (l1+l2))/2
8 ;; = (u1-l1 + u2 - l2)/2
11 ;; sub_interval [x,y] = [l1-u2, u1-l2]
12 ;; width of diff = (u1-l2 - (l1-u2))/2
13 ;; = (u1 - l2 - l1 + u2) / 2
14 ;; = ((u1 - l1) + (u2 - l2))/2
17 ;; Now, intuitively multiplication (and division), scales a range
18 ;; up or down. Since mul-range was essentially non-linear (is that the
19 ;; right term? ) because of the min/max calculations, these depend on
20 ;; absolute values of the range rather than the width.
21 ;; eg: [2 3] [3 4]. Width (d1, d2) => (1,1)
22 ;; mul-interval => [6 12]
24 ;; same with division as well.