Last active
August 29, 2015 14:26
-
-
Save dheaney/5e42f3d97d1cb58fe929 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| ; riemann.lisp | |
| ; 2 August 2015 | |
| ; David Heaney | |
| ; Public Domain | |
| (defun riemann (fun start finish divisions) | |
| (setq sum 0) | |
| (setq x (/ (- finish start) divisions)) | |
| (loop for i from start to (- finish x) by x do | |
| (setq sum (+ sum (* x (funcall fun i))))) | |
| (+ 0 sum)) | |
| (riemann (function (lambda (x) (* x x))) 1 10 9999) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment