Blame


1 665c255d 2023-08-04 jrmu (define (add-interval x y)
2 665c255d 2023-08-04 jrmu (make-interval (+ (lower-bound x) (lower-bound y))
3 665c255d 2023-08-04 jrmu (+ (upper-bound x) (upper-bound y))))
4 665c255d 2023-08-04 jrmu (define (mul-interval x y)
5 665c255d 2023-08-04 jrmu (let ((p1 (* (lower-bound x) (lower-bound y)))
6 665c255d 2023-08-04 jrmu (p2 (* (lower-bound x) (upper-bound y)))
7 665c255d 2023-08-04 jrmu (p3 (* (upper-bound x) (lower-bound y)))
8 665c255d 2023-08-04 jrmu (p4 (* (upper-bound x) (upper-bound y))))
9 665c255d 2023-08-04 jrmu (make-interval (min p1 p2 p3 p4)
10 665c255d 2023-08-04 jrmu (max p1 p2 p3 p4))))
11 665c255d 2023-08-04 jrmu
12 665c255d 2023-08-04 jrmu (define (div-interval x y)
13 665c255d 2023-08-04 jrmu (mul-interval x
14 665c255d 2023-08-04 jrmu (make-interval (/ 1.0 (upper-bound y))
15 665c255d 2023-08-04 jrmu (/ 1.0 (lower-bound y)))))
16 665c255d 2023-08-04 jrmu
17 665c255d 2023-08-04 jrmu (define (make-interval a b)
18 665c255d 2023-08-04 jrmu (cons a b))
19 665c255d 2023-08-04 jrmu (define (upper-bound x)
20 665c255d 2023-08-04 jrmu (cdr x))
21 665c255d 2023-08-04 jrmu (define (lower-bound x)
22 665c255d 2023-08-04 jrmu (car x))
23 665c255d 2023-08-04 jrmu
24 665c255d 2023-08-04 jrmu