Question: Why does Statistics:-Mean fails computing the mean?

For a lesson I'm preparing, I want to illustrate some probability concepts using Maple.
In particular, I need to use the fact that the Expectation operator(let say the Mean operator) is a linear operator with respect to random variables. 
However, I don't want to particularize my demonstration by using this or that statistical distribution but simply the notion of random variable.
I have therefore created a specific Distribution named  MinimalAbstractDistribution in which only the mean and variance are defined.

When Statistics:-Mean is applied to the expression (A*p+q) where p and q are names and A is a random variable with distribution MinimalAbstractDistribution, linearity is effectively used.
But not when it is applied to A/p or A-q.

Why that?
Is there a way of defining a statistical distribution so that Mean behaves as expected?

(You will easily understand that no workaround of the form

Mean(A+q);
eval(%, q=-q);

# or
add(Mean~([op(A-q)]))

can be accepted in a lesson).

Thanks for your attention
 

restart

with(Statistics):

 

MinimalAbstractDistribution := proc(i)
  Distribution(Mean=mu[i], Variance=sigma[i]^2)
end proc:

A := RandomVariable(MinimalAbstractDistribution(1))

_R

(1)

[Mean, Variance](A);

[mu[1], sigma[1]^2]

(2)

Mean(p*A+q);
Mean(p*(A+q))

p*mu[1]+q

 

p*(mu[1]+q)

(3)

# But

Mean(A-q);
Mean(A/p)

FAIL

 

FAIL

(4)
 

 

Download Mean_operator.mw

Please Wait...