]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex1_13.clj
solution to 4.43
[sicp.git] / src / sicp / ex1_13.clj
1 (ns sicp.ex1_13
2   (:use [sicp utils]
3         [clojure.contrib trace test-is]))
4
5 ;; exercise 1.13:
6 (comment
7 See the pdfs in the directory for the answers.
8 )
9
10 ;; ex 1.13 (contd)
11 (defn fib-approx [n]
12   (let [phi (/ (+ 1 (sqrt 5)) 2)]
13     (/ (expt phi n) (sqrt 5))))
14
15 ;; (comment
16 ;; user> (map fib-approx (range 10))
17 ;; (0.4472135954999579 0.7236067977499789 1.1708203932499368 1.8944271909999157 3.065247584249853 4.959674775249769 8.024922359499623 12.984597134749393 21.009519494249016 33.99411662899841)
18 ;; )