Ex 1.8 – Structure and Interpretation of Computer Programs

; Ex 1.8
(define improve-cube-root
  (lambda (x y)
    (/ (+ (/ x (* y y)) (* 2 y))
       3)))

(define cube-root-iter
  (lambda (guess x )
    (define next-guess ( / ( + (/ x (* guess guess)) (* 2 guess))
                           3))
    (if (good-enough-2? next-guess guess)
        next-guess
        (cube-root-iter next-guess x))))

(define cube-root
  (lambda (x)
    (cube-root-iter 1.0 x)))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: