3 [clojure.contrib trace test-is]))
5 ;; simpson's rule of integration
6 (defn sum [term a next b]
10 (sum term (next a) next b))))
18 (defn simpson-sum [term a next-fn b n k]
19 (let [fac (make-fac k n)]
23 (simpson-sum term (next-fn a) next-fn b n (+ k 1))))))
25 (defn simpson-rule [f a b n]
26 (let [h (/ (- b a) n)]
27 (* (simpson-sum f a #(+ h %) b n 0)