Did I find the right examples for you? yes no

sympy.stats.FiniteRV

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
```Create a Finite Random Variable given a dict representing the density.

Returns a RandomSymbol.

>>> from sympy.stats import FiniteRV, P, E

>>> density = {0: .1, 1: .2, 2: .3, 3: .4}
>>> X = FiniteRV('X', density)

>>> E(X)(more...)
```

```        def FiniteRV(name, density):
"""
Create a Finite Random Variable given a dict representing the density.

Returns a RandomSymbol.

>>> from sympy.stats import FiniteRV, P, E

>>> density = {0: .1, 1: .2, 2: .3, 3: .4}
>>> X = FiniteRV('X', density)

>>> E(X)
2.00000000000000
>>> P(X>=2)
0.700000000000000
"""
```

```from sympy import (EmptySet, FiniteSet, S, Symbol, Interval, exp, erf, sqrt,
symbols, simplify, Eq, cos, And, Tuple, Or, Dict, sympify, binomial,
factor)
from sympy.stats import (DiscreteUniform, Die, Bernoulli, Coin, Binomial,
Hypergeometric, P, E, variance, covariance, skewness, sample, density,
```
```def test_FiniteRV():
F = FiniteRV('F', {1: S.Half, 2: S.One/4, 3: S.One/4})

assert dict(density(F).items()) == {S(1): S.Half, S(2): S.One/4, S(3): S.One/4}
assert P(F >= 2) == S.Half
```