<< Previous exercise (2.11) | Index | Next exercise (2.13) >>

Do you think we need to abs the width as well? (this uses proportion instead of percent)

; e.g. for (make-center-percent -10 0.05) (define (make-center-percent c p) (make-interval (- c (abs (* c p))) (+ c (abs (* c p)))))

I think make-center-width, center, width can be used here to make it concise.

(define (make-center-percent c p) (make-center-width c (* c p))) (define (percent i) (/ (width i) (center i)))

;We are talking about percentages rather than fractions. Therefore (define (make-center-percent c p) (make-interval (- c (abs (* c (/ p 100)))) (+ c (abs (* c (/ p 100)))))) ;Also, for the percentage selector (define (percent i) (* 100 (/ (width i) (center i))))

There are a few ways to do this problem, e.g.: