class Geometric
Attributes
p[RW]
Public Class Methods
new(p)
click to toggle source
# File lib/probaberry/discrete.rb, line 62 def initialize p @p = p end
Public Instance Methods
<(x)
click to toggle source
# File lib/probaberry/discrete.rb, line 75 def < x 1 - (self >= x) end
<=(x)
click to toggle source
# File lib/probaberry/discrete.rb, line 78 def <= x 1 - (self > x) end
==(x)
click to toggle source
# File lib/probaberry/discrete.rb, line 65 def == x p * (1 - p) ** (x - 1) end
>(x)
click to toggle source
# File lib/probaberry/discrete.rb, line 68 def > x # tail lemma! (1 - p) ** x end
>=(x)
click to toggle source
# File lib/probaberry/discrete.rb, line 72 def >= x (self == x) + (self > x) end