Skip to content

Instantly share code, notes, and snippets.

@liebke
Created April 15, 2010 21:14
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 liebke/6aa65685559cdb5b6e5e to your computer and use it in GitHub Desktop.
Save liebke/6aa65685559cdb5b6e5e to your computer and use it in GitHub Desktop.
; the following code generates the plot below
; http://incanter.org/images/examples/latex/bday-paradox-chart.png
(use '(incanter core charts latex))
(defn f [n] (- 1 (pow (/ 364 365) (/ (* n (dec n)) 2))))
(doto (function-plot f 2 71 :step-size 1
:x-label "Number of People"
:y-label "Shared birthday probability")
(add-latex 50 0.3 "f(n) = 1 - \\left( \\frac{364}{365} \\right)^{\\frac{n(n-1)}{2}}")
view)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment