Smatchcube's website 🌍

Exercise 1.37

a. Here is the cont-frac procedure.

(define (cont-frac n d k)
  (define (recur i)
    (if (> i k)
	(/ (n i)
	   (+ (d i) (recur (inc i))))))
  (recur 1))

Approximations of \(1/\varphi=0.6180339887498948482\) using cont-frac:

We need to use our cont-frac procedure with k=11 to have an approximation with 4-digits accuracy.

b. Our previous cont-frac procedure generates a recursive process, here is the iterative version of cont-frac.