>>> exec(open('5YourName.py').read())
>>> y = Drv([25, 33, 40, 50], [1/4]*4 )
>>> y.xk
[25, 33, 40, 50]
>>> y.pk
[0.25, 0.25, 0.25, 0.25]
>>> y
Discrete random variable: (25,0.25) (33,0.25) (40,0.25) (50,0.25)
>>> y.e()
37.0
>>> x = y.reweight()
>>> x
Discrete random variable: (25,0.16891891891891891) (33,0.22297297297297297) (40,0.2702702702702703) (50,0.33783783783783783)
>>> x.cdf(42)
0.6621621621621622
>>> x.cdf(52)
1.0
>>> b = Binomial(11, .5)
>>> b.cdf(6)
0.5
>>> b
Binomial random variable: (0,0.00048828125) (1,0.00537109375) (2,0.02685546875) (3,0.08056640625) (4,0.1611328125) (5,0.2255859375) (6,0.2255859375) (7,0.1611328125) (8,0.08056640625) (9,0.02685546875) ...
>>> b.cdf(0)
0
>>> b.cdf(1)
0.00048828125
>>> b.pdf(0)
0.00048828125
>>> br = b.reweight()
>>> br
Discrete random variable: (0,0.0) (1,0.0009765625) (2,0.009765625) (3,0.0439453125) (4,0.1171875) (5,0.205078125) (6,0.24609375) (7,0.205078125) (8,0.1171875) (9,0.0439453125) ...
>>> z = Uniform(3)
>>> z
Uniform random variable: (1,0.3333333333333333) (2,0.3333333333333333) (3,0.3333333333333333)
>>> z.e()
2.0
>>> z.pdf(2)
0.3333333333333333
>>> z.cdf(3)
0.6666666666666666
>>> z.cdf(4)
1.0
>>> g = Geometric(.1)
>>> g
Geometric random variable: (1,0.1) (2,0.09000000000000001) (3,0.08100000000000002) (4,0.0729) (5,0.06561) (6,0.05904900000000001) (7,0.05314410000000001) (8,0.04782969000000001) (9,0.04304672100000001) (10,0.03874204890000001) ...
>>> g.cdf(3)
0.19
>>> g.cdf(10)
0.6125795110000001
>>> g.cdf(100)
0.9999704873345701
>>> g.is_nonneg()
True
>>> g.e()
10.0
>>> g.reweight()
Traceback (most recent call last):
File "", line 1, in
File "", line 134, in reweight
NotImplementedError: reweight is not implemented for geometric variable!