Skip to content

Instantly share code, notes, and snippets.

@liebke
Created Apr 15, 2010
Embed
What would you like to do?
; 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