在Mathematica 8中,我想定义一个离散分布,其密度质量由列表给出。例如,
In[1] f = ProbabilityDistribution[{2/3, 1/3}[[x]], {x, 1, 2, 1}];
这个似乎可行。然而,它发出了一个重复出现两次的警告:
"Part::pspec: Part specification x is neither an integer nor a list of integers."
然而,函数 f 的运行似乎是正确的。这个消息让我想到可能有一种更好的方法来定义相同的分布。如何使用列表定义离散分布,但又不会触发警告?