Hi David, When I was referring to the "probability space ps" and the "random variable ps", I was referring to the fact that ps is by inheritance a probability space and a random variable (is_DiscreteProbabilitySpace(ps) == is_DiscreteRandomVariable(ps) == True).
I do see that the values are necessarily probabilities, I'm not suggesting that that be changed. But right now if you ask for the expected value of ps, it uses the probability function (from the constructor) as both the probability function and the random variable. In other words, currently ps.expectation() = sum(P(x)^2 over all x). I only brought it up because after looking at the code I was unsure if it was intentional or just a side-effect of the class organization. I'm not aware of any formal definition of the expectation of a probability space, so I wanted to ask to clarify. You mentioned that continuous random variables are missing, which is something I wouldn't mind working on. I may follow up later with an email to get some input on what needs to be done, if you don't mind. -- Paul On Mon, Dec 1, 2008 at 4:50 PM, David Kohel <[EMAIL PROTECTED]> wrote: > > Hi Paul, > > > Thanks for explaining that, I see how that causes problems when S is not > a > > set of numbers. Even so, would it make sense for the random variable ps > to > > be the identity function X(x) = x on the probability space ps? Currently > the > > random variable ps is the function X(x) = P(x). Is this a useful random > > variable that I'm just not aware of? > > Well, ps is a probability space (you did create it as > DiscreteProbabilitySpace, > rather than DiscreteRandomVariable, which I had missed in my first > reply), > hence its values are necessarily probabilities. There is no other > valid choice. > > To create a DiscreteRandomVariable, you currently must first create a > probability space, then the function on that space. One could have > shorter > constructors which assume a finite uniform probability space, if not > given. > > The order of the arguments is probability space, then function or > values, > but if a probability space is no longer required, this order should > change. > > --David > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---