Question: f(custom distribution) doesn't work

with(Statistics):

Variance(Distribution(ProbabilityFunction = (k -> piecewise(k > 0, 2^(-k)))));
Error, invalid input: Statistics:-Variance expects its 1st argument, X, to be of type
{algebraic, {array, list, rtable, DataFrame, DataSeries}}, but received _m1085629680096

dd := Distribution(ProbabilityFunction = (k -> piecewise(k > 0, 2^(-k))));

Variance(dd);
                               6

The first input works in neither 2D nor 1D input mode.

Another issue is that the value of the variance is in fact wrong; Maple takes the probability function to have value 1 at zero.

Please Wait...