Show that the golden ratio ϕ (section 1.2.2) is a fixed point of the transformation x ↦ 1 + 1/x, and use this fact to compute ϕ by means of the fixed-point procedure.
(define ϕ (/ (+ 1 (sqrt 5)) 2)) (+ 1 (/ 1 ϕ)) ; => ϕ = 1.618033988749895 (define tolerance 0.00001) (define (fixed-point f first-guess) (define (close-enough? v1 v2) (< (abs (- v1 v2)) tolerance)) (define (try guess) (let ((next (f guess))) (if (close-enough? guess next) next (try next)))) (try first-guess)) (fixed-point (lambda (x) (+ 1 (/ 1 x))) 1) ; => 987 / 610 = 1.6180327869