Add Exercise 2.12
This commit is contained in:
parent
a14449600f
commit
a79350dd76
@ -105,3 +105,16 @@ and upper bound."
|
|||||||
a
|
a
|
||||||
(make-interval (/ 1.0 (upper-bound b))
|
(make-interval (/ 1.0 (upper-bound b))
|
||||||
(/ 1.0 (lower-bound b))))))
|
(/ 1.0 (lower-bound b))))))
|
||||||
|
|
||||||
|
;; Exercise 2.12
|
||||||
|
(defun make-center-width (c w)
|
||||||
|
(make-interval (- c w) (+ c w)))
|
||||||
|
(defun center (i)
|
||||||
|
(/ (+ (lower-bound i) (upper-bound i) 2.0)))
|
||||||
|
(defun width (i)
|
||||||
|
(/ (- (upper-bound i) (lower-bound i) 2.0)))
|
||||||
|
|
||||||
|
(defun make-center-percent (c p)
|
||||||
|
(make-interval (* c (- 1 (/ p 100)))
|
||||||
|
(* c (+ 1 (/ p 100)))))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user