Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created April 11, 2012 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/237543a6327f100512ad to your computer and use it in GitHub Desktop.
Save amalloy/237543a6327f100512ad to your computer and use it in GitHub Desktop.
(defn delta [n]
(apply + (for [k (range (inc n))]
(/ (apply * (repeat k -1))
(inc (* 2 k))))))
(defn deltas [max]
(map-indexed (fn [idx n] (vector idx
(- (/ Math/PI 4)
(delta n))))
(range (inc max))))
user> (deltas 4)
([0 -0.21460183660255172] [1 0.11873149673078154] [2 -0.08126850326921842] [3 0.06158863958792449] [4 -0.04952247152318667])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment