SICP-2nd-Edition-Exercise-1.35
From Boozled
Contents |
Exercise 1.35 From SICP
Show that the golden ratio φ (section 1.2.2) is a fixed point of the transformation
, and use this fact to compute φ by means of the fixed-point procedure.
Attempt
This was a cut and paste exercise. Although if they wanted us to prove that φ is the fixed point that may be a different matter.
Scheme
(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))
(define (phi x) (+ 1 (/ 1 x)))
(display (fixed-point phi 1.0))
(newline)
(display (fixed-point cos 1.0))
(newline)
(display (fixed-point sin 0.5))
(newline)
(fixed-point (lambda (y) (+ (sin y) (cos y))) 1.0)
(newline)
Parent Course
6.001_Structure_and_Interpretation_of_Computer_Programs
Further Reading
- Fixed Points at Wikipedia
- Fixed Point Combinator at Wikipedia I think we may need to read this later.

