How to use the DiscreteRandomVariable class?
The reference manual talks about DiscreteRandomVariable class. But, I do not understand how it should be initialized? There are variables "X" and "f" but the docs do not explain what they are, nor there is any example...
Additionally: is it possible to calculate functions on DiscreteRandomVariables? E.g, if X and Y are random variables, can I write "Z = X * Y" and have a new random variable Z?
This class seems to be in pretty bad shape. I guess that we would better get rid of it. Moreover, for defining two random variables you need a common probability space. And the law of X*Y highly depends on the correlations between X and Y. Were you thinking about the independent case?
@vdelecroix Yes, I was thinking about the independent case, For example, suppose X is a discrete random variable with the following distribution: {10: 0.3, 20: 0.7} and Y is discrete random variable with the following distribution: {30: 0.4, 40: 0.6}. Then, Z=X*Y is a discrete random variable with the following distribution: {300: 0.12, 600: 0.28, 400: 0.18, 800: 0.42}. It seems quite straightforward to implement.
Sure you can do