Created
June 7, 2015 09:48
-
-
Save shigemk2/53e598c3180287bd6f63 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
(defun square(x) (* x x)) | |
(setq avg (/ (+ 0.0 2.0 8.0) 3)) | |
(setq var (/ (+ (square (- 2 avg)) (square (- 8 avg)) (square (- 0 avg))) 3)) | |
(print var) |
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
(defun variance4 (a b c d) | |
(defun square(x) (* x x)) | |
(setq average (/ (+ a b c d) 4)) | |
(/ (+ (square (- a average)) (square (- b average)) (square (- c average)) (square (- d average))) 4)) | |
(variance4 0.0 2.0 8.0 16.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment