## Note: this wiki is now retired and will no longer be updated!

The static final versions of the pages are left as a convenience for readers. Note that meta-pages such as "discussion," "history," etc., will not work.

# SICP exercise 1.35

## Problem

Show that the golden ratio $\phi\,$ (see section 1.2.2 of the text) is a fixed point of the transformation $x \mapsto 1 + 1/x$, and use this fact to compute $\phi\,$ by means of the fixed-point procedure.

## Solution

The fixed point of the function is

$1 + 1/x = x\,$

Solving for x, we get

$x^2 = x + 1\,$

$x^2 - x - 1 = 0\,$

Using the quadratic equation to solve for x, we find that one of the roots of this equation is $\frac{1 + \sqrt{5}}{2}$, which is the golden ratio $\phi\,$ (approximately 1.6.18).

Using the fixed-point procedure from the text to compute the numeric value:

(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.0)

The result produced by Chicken Scheme 3.1 on Mac OS X 10.5 on a MacBook Pro is

1.61803278688525