Exercise 1.8: (back)
Scheme:
(define (square x) (* x x)) (define (average x y) (/ (+ x y) 2)) (define (good-enough? guess x) (< (/ (abs (- (improve guess x) guess)) guess) 0.001)) (define (improve guess x) (/ (+ (/ x (square guess)) (* 2 guess)) 3)) (define (cbrt-iter guess x) (if (good-enough? guess x) guess (cbrt-iter (improve guess x) x))) (define (my-cbrt x) (cbrt-iter 1.0 x))