(wat-aro)

無職から有職者にランクアップしました

SICP 問題 2.14

(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)))))
gosh> (define small (make-center-percent 10 1.0))
small
gosh> small
(9.9 . 10.1)
gosh> (define lerge (make-center-percent 20.0 20))
lerge
gosh> lerge
(16.0 . 24.0)
gosh> (par1 small lerge)
(4.645161290322581 . 9.359073359073358)
gosh> (par2 small lerge)
(6.115830115830116 . 7.108504398826979)