Created
January 12, 2010 11:41
-
-
Save ocher/275128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn calc | |
([n] | |
(reduce #(+ %1 | |
(let [x (- (/ (* 20.0 %2) n) 10.0)] | |
(* (Math/pow Math/E (* x (- x)) ) (/ 20.0 n) ))) 0 | |
(range n)))) | |
(def N 10000) | |
(def M 5000) | |
(dotimes [_ 10] (time (println (apply + (map calc (range M)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment