Skip to content

Instantly share code, notes, and snippets.

@dheaney
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save dheaney/5e42f3d97d1cb58fe929 to your computer and use it in GitHub Desktop.

Select an option

Save dheaney/5e42f3d97d1cb58fe929 to your computer and use it in GitHub Desktop.
; 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