(define (par1 r1 r2)
(div-interval (mul-interval r1 r2)
(add-interval r1 r2)))
(define (par2 r1 r2)
(let ((one (make-interval 1 1)))
(div-interval one
(add-interval (div-interval one r1)
(div-interval one r2)))))
Indeed the results are different:
1 ]=> (par1 (make-interval 3 4) (make-interval 5 7))
;Value 1: (1.3636363636363638 . 3.5)
1 ]=> (par2 (make-interval 3 4) (make-interval 5 7))
;Value 2: (1.875 . 2.5454545454545454)
with center-percent form also the results are different
1 ]=> (par1 (make-center-percent 5 10) (make-center-percent 10 5))
;Value 4: (2.671875 . 4.125)
1 ]=> (par2 (make-center-percent 5 10) (make-center-percent 10 5))
;Value 5: (3.053571428571429 . 3.609375)
No comments:
Post a Comment