solution to 1.40
authorRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Thu, 27 May 2010 12:45:53 +0000 (18:15 +0530)
committerRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Thu, 27 May 2010 12:45:53 +0000 (18:15 +0530)
src/sicp/ex1_40.clj [new file with mode: 0644]

diff --git a/src/sicp/ex1_40.clj b/src/sicp/ex1_40.clj
new file mode 100644 (file)
index 0000000..741b646
--- /dev/null
@@ -0,0 +1,15 @@
+(ns sicp.ex1_40
+  (:use [clojure.contrib test-is]
+       [sicp utils]
+       [sicp ch1_3]))
+
+(defn cubic [a b c]
+  (fn [x] (+ (cube x)
+            (* a (square x))
+            (* b x)
+            c)))
+
+(comment
+(newton-method (cubic 0 0 (* 3 3 -3)) 1.0)
+;;=> 3.0000000000019176
+)