Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started