Question: Given the following code: (define (new-sqrt x) (define (good-enough? guess) ( < (abs (- (square guess) x)) 0.000001)) (define (average x y) (/ (+ x

Given the following code:

 (define (new-sqrt x) (define (good-enough? guess) (< (abs (- (square guess) x)) 0.000001)) (define (average x y) (/ (+ x y) 2)) (define (improve guess) (average guess (/ x guess))) (define (sqrt-iter guess) (if (good-enough? guess) guess (sqrt-iter (improve guess)))) (sqrt-iter 1.0)) (new-sqrt 2.0) 

a) Draw a contour diagram during the evaluation of (new-sqrt) at the beginning of line 12, (before executing (sqrt-iter).

b) Draw a contour diagram at the start of line 11 (during the execution of sqrt-iter, before recursing).

Language is scheme.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!