SICP Exercise 1.37
Exercise 1.37. a. An infinite continued fraction is an expression of the form As an example, one can show that the infinite continued fraction expansion with the N i and the D i all equal to 1 produces 1/ , where is the golden ratio (described in section 1.2.2 ). One way to approximate an infinite continued fraction is to truncate the expansion after a given number of terms. Such a truncation -- a so-called k -term finite continued fraction -- has the form Suppose that n and d are procedures of one argument (the term index i ) that return the N i and D i of the terms of the continued fraction. Define a procedure cont-frac such that evaluating (cont-frac n d k) computes the value of the k -term finite continued fraction. Check your procedure by approximating 1/ using (cont-frac (lambda (i) 1.0) ...